fix sse examples

This commit is contained in:
ihrpr 2025-04-23 22:32:56 +01:00
commit 9db5b8363c
No known key found for this signature in database
2 changed files with 1 additions and 5 deletions

View file

@ -102,10 +102,6 @@ app.get('/mcp', async (req: Request, res: Response) => {
const server = getServer();
await server.connect(transport);
// Start the SSE transport to begin streaming
// This sends an initial 'endpoint' event with the session ID in the URL
await transport.start();
console.log(`Established SSE stream with session ID: ${sessionId}`);
} catch (error) {
console.error('Error establishing SSE stream:', error);

View file

@ -194,7 +194,7 @@ app.post("/messages", async (req: Request, res: Response) => {
return;
}
if (transport) {
await transport.handlePostMessage(req, res);
await transport.handlePostMessage(req, res, req.body);
} else {
res.status(400).send('No transport found for sessionId');
}