Update README.md to include working examples

The current documentation contains code that will cause errors, they should be fixed.
This commit is contained in:
simonedstrom96 2025-04-22 17:59:10 +02:00 • committed by GitHub
commit ad51fd0f5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -242,7 +242,6 @@ app.post('/mcp', async (req, res) => {
transport = transports[sessionId];
} else if (!sessionId && isInitializeRequest(req.body)) {
// New initialization request
const eventStore = new InMemoryEventStore();
transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => randomUUID(),
onsessioninitialized: (sessionId) => {
@ -815,7 +814,7 @@ app.post('/messages', async (req, res) => {
const sessionId = req.query.sessionId as string;
const transport = transports.sse[sessionId];
if (transport) {
await transport.handlePostMessage(req, res);
await transport.handlePostMessage(req, res, req.body);
} else {
res.status(400).send('No transport found for sessionId');
}