fix sse examples
This commit is contained in:
parent
3f95b76dcf
commit
9db5b8363c
2 changed files with 1 additions and 5 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue