From 5751a62f444b41bfc263145f6d09ec8f1a407dcc Mon Sep 17 00:00:00 2001 From: Nevo David Date: Sun, 1 Mar 2026 17:13:39 +0700 Subject: [PATCH] feat: multiple sses --- libraries/nestjs-libraries/src/chat/start.mcp.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libraries/nestjs-libraries/src/chat/start.mcp.ts b/libraries/nestjs-libraries/src/chat/start.mcp.ts index 7e8fab5c..a9018a50 100644 --- a/libraries/nestjs-libraries/src/chat/start.mcp.ts +++ b/libraries/nestjs-libraries/src/chat/start.mcp.ts @@ -13,12 +13,14 @@ export const startMcp = async (app: INestApplication) => { const agent = mastra.getAgent('postiz'); const tools = await agent.getTools(); - const server = new MCPServer({ + const serverConfig = { name: 'Postiz MCP', version: '1.0.0', tools, agents: { postiz: agent }, - }); + }; + + const server = new MCPServer(serverConfig); app.use('/mcp', async (req: Request, res: Response, next: () => void) => { // Skip if this is the /mcp/:id route @@ -140,7 +142,7 @@ export const startMcp = async (app: INestApplication) => { // @ts-ignore { requestId: req.params.id, auth: req.auth }, async () => { - await server.startSSE({ + await new MCPServer(serverConfig).startSSE({ url, ssePath: `/sse/${req.params.id}`, messagePath: `/message/${req.params.id}`,