mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-21 21:35:15 +02:00
Merge branch 'main' into patch-1
This commit is contained in:
@@ -456,6 +456,7 @@ A growing set of community-developed and maintained servers demonstrates various
|
|||||||
- **[SearXNG](https://github.com/ihor-sokoliuk/mcp-searxng)** - A Model Context Protocol Server for [SearXNG](https://docs.searxng.org)
|
- **[SearXNG](https://github.com/ihor-sokoliuk/mcp-searxng)** - A Model Context Protocol Server for [SearXNG](https://docs.searxng.org)
|
||||||
- **[SEC EDGAR](https://github.com/stefanoamorelli/sec-edgar-mcp)** - (by Stefano Amorelli) A community Model Context Protocol Server to access financial filings and data through the U.S. Securities and Exchange Commission ([SEC](https://www.sec.gov/)) `Electronic Data Gathering, Analysis, and Retrieval` ([EDGAR](https://www.sec.gov/submit-filings/about-edgar)) database
|
- **[SEC EDGAR](https://github.com/stefanoamorelli/sec-edgar-mcp)** - (by Stefano Amorelli) A community Model Context Protocol Server to access financial filings and data through the U.S. Securities and Exchange Commission ([SEC](https://www.sec.gov/)) `Electronic Data Gathering, Analysis, and Retrieval` ([EDGAR](https://www.sec.gov/submit-filings/about-edgar)) database
|
||||||
- **[ServiceNow](https://github.com/osomai/servicenow-mcp)** - A MCP server to interact with a ServiceNow instance
|
- **[ServiceNow](https://github.com/osomai/servicenow-mcp)** - A MCP server to interact with a ServiceNow instance
|
||||||
|
- **[Shodan MCP](https://github.com/Hexix23/shodan-mcp)** - MCP server to interact with [Shodan](https://www.shodan.io/)
|
||||||
- **[Shopify](https://github.com/GeLi2001/shopify-mcp)** - MCP to interact with Shopify API including order, product, customers and so on.
|
- **[Shopify](https://github.com/GeLi2001/shopify-mcp)** - MCP to interact with Shopify API including order, product, customers and so on.
|
||||||
- **[Siri Shortcuts](https://github.com/dvcrn/mcp-server-siri-shortcuts)** - MCP to interact with Siri Shortcuts on macOS. Exposes all Shortcuts as MCP tools.
|
- **[Siri Shortcuts](https://github.com/dvcrn/mcp-server-siri-shortcuts)** - MCP to interact with Siri Shortcuts on macOS. Exposes all Shortcuts as MCP tools.
|
||||||
- **[Slack](https://github.com/korotovsky/slack-mcp-server)** - The most powerful MCP server for Slack Workspaces. This integration supports both Stdio and SSE transports, proxy settings and does not require any permissions or bots being created or approved by Workspace admins 😏.
|
- **[Slack](https://github.com/korotovsky/slack-mcp-server)** - The most powerful MCP server for Slack Workspaces. This integration supports both Stdio and SSE transports, proxy settings and does not require any permissions or bots being created or approved by Workspace admins 😏.
|
||||||
|
|||||||
@@ -11,24 +11,31 @@ const { server, cleanup } = createServer();
|
|||||||
let transport: SSEServerTransport;
|
let transport: SSEServerTransport;
|
||||||
|
|
||||||
app.get("/sse", async (req, res) => {
|
app.get("/sse", async (req, res) => {
|
||||||
console.log("Received connection");
|
console.error("Received connection");
|
||||||
transport = new SSEServerTransport("/message", res);
|
transport = new SSEServerTransport("/message", res);
|
||||||
await server.connect(transport);
|
await server.connect(transport);
|
||||||
|
|
||||||
server.onclose = async () => {
|
server.onclose = async () => {
|
||||||
await cleanup();
|
await cleanup();
|
||||||
await server.close();
|
await server.close();
|
||||||
process.exit(0);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/message", async (req, res) => {
|
app.post("/message", async (req, res) => {
|
||||||
console.log("Received message");
|
console.error("Received message");
|
||||||
|
|
||||||
await transport.handlePostMessage(req, res);
|
await transport.handlePostMessage(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.on("SIGINT", async () => {
|
||||||
|
await cleanup();
|
||||||
|
await server.close();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
const PORT = process.env.PORT || 3001;
|
const PORT = process.env.PORT || 3001;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server is running on port ${PORT}`);
|
console.error(`Server is running on port ${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const { server, cleanup } = createServer();
|
|||||||
const transports: { [sessionId: string]: StreamableHTTPServerTransport } = {};
|
const transports: { [sessionId: string]: StreamableHTTPServerTransport } = {};
|
||||||
|
|
||||||
app.post('/mcp', async (req: Request, res: Response) => {
|
app.post('/mcp', async (req: Request, res: Response) => {
|
||||||
console.log('Received MCP POST request');
|
console.error('Received MCP POST request');
|
||||||
try {
|
try {
|
||||||
// Check for existing session ID
|
// Check for existing session ID
|
||||||
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
||||||
@@ -31,7 +31,7 @@ app.post('/mcp', async (req: Request, res: Response) => {
|
|||||||
onsessioninitialized: (sessionId) => {
|
onsessioninitialized: (sessionId) => {
|
||||||
// Store the transport by session ID when session is initialized
|
// Store the transport by session ID when session is initialized
|
||||||
// This avoids race conditions where requests might come in before the session is stored
|
// This avoids race conditions where requests might come in before the session is stored
|
||||||
console.log(`Session initialized with ID: ${sessionId}`);
|
console.error(`Session initialized with ID: ${sessionId}`);
|
||||||
transports[sessionId] = transport;
|
transports[sessionId] = transport;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -40,7 +40,7 @@ app.post('/mcp', async (req: Request, res: Response) => {
|
|||||||
transport.onclose = () => {
|
transport.onclose = () => {
|
||||||
const sid = transport.sessionId;
|
const sid = transport.sessionId;
|
||||||
if (sid && transports[sid]) {
|
if (sid && transports[sid]) {
|
||||||
console.log(`Transport closed for session ${sid}, removing from transports map`);
|
console.error(`Transport closed for session ${sid}, removing from transports map`);
|
||||||
delete transports[sid];
|
delete transports[sid];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -85,7 +85,7 @@ app.post('/mcp', async (req: Request, res: Response) => {
|
|||||||
|
|
||||||
// Handle GET requests for SSE streams (using built-in support from StreamableHTTP)
|
// Handle GET requests for SSE streams (using built-in support from StreamableHTTP)
|
||||||
app.get('/mcp', async (req: Request, res: Response) => {
|
app.get('/mcp', async (req: Request, res: Response) => {
|
||||||
console.log('Received MCP GET request');
|
console.error('Received MCP GET request');
|
||||||
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
const sessionId = req.headers['mcp-session-id'] as string | undefined;
|
||||||
if (!sessionId || !transports[sessionId]) {
|
if (!sessionId || !transports[sessionId]) {
|
||||||
res.status(400).json({
|
res.status(400).json({
|
||||||
@@ -102,9 +102,9 @@ app.get('/mcp', async (req: Request, res: Response) => {
|
|||||||
// Check for Last-Event-ID header for resumability
|
// Check for Last-Event-ID header for resumability
|
||||||
const lastEventId = req.headers['last-event-id'] as string | undefined;
|
const lastEventId = req.headers['last-event-id'] as string | undefined;
|
||||||
if (lastEventId) {
|
if (lastEventId) {
|
||||||
console.log(`Client reconnecting with Last-Event-ID: ${lastEventId}`);
|
console.error(`Client reconnecting with Last-Event-ID: ${lastEventId}`);
|
||||||
} else {
|
} else {
|
||||||
console.log(`Establishing new SSE stream for session ${sessionId}`);
|
console.error(`Establishing new SSE stream for session ${sessionId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const transport = transports[sessionId];
|
const transport = transports[sessionId];
|
||||||
@@ -126,7 +126,7 @@ app.delete('/mcp', async (req: Request, res: Response) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Received session termination request for session ${sessionId}`);
|
console.error(`Received session termination request for session ${sessionId}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const transport = transports[sessionId];
|
const transport = transports[sessionId];
|
||||||
@@ -150,17 +150,17 @@ app.delete('/mcp', async (req: Request, res: Response) => {
|
|||||||
// Start the server
|
// Start the server
|
||||||
const PORT = process.env.PORT || 3001;
|
const PORT = process.env.PORT || 3001;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`MCP Streamable HTTP Server listening on port ${PORT}`);
|
console.error(`MCP Streamable HTTP Server listening on port ${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle server shutdown
|
// Handle server shutdown
|
||||||
process.on('SIGINT', async () => {
|
process.on('SIGINT', async () => {
|
||||||
console.log('Shutting down server...');
|
console.error('Shutting down server...');
|
||||||
|
|
||||||
// Close all active transports to properly clean up resources
|
// Close all active transports to properly clean up resources
|
||||||
for (const sessionId in transports) {
|
for (const sessionId in transports) {
|
||||||
try {
|
try {
|
||||||
console.log(`Closing transport for session ${sessionId}`);
|
console.error(`Closing transport for session ${sessionId}`);
|
||||||
await transports[sessionId].close();
|
await transports[sessionId].close();
|
||||||
delete transports[sessionId];
|
delete transports[sessionId];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -169,6 +169,6 @@ process.on('SIGINT', async () => {
|
|||||||
}
|
}
|
||||||
await cleanup();
|
await cleanup();
|
||||||
await server.close();
|
await server.close();
|
||||||
console.log('Server shutdown complete');
|
console.error('Server shutdown complete');
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user