From cb8316f101951f0866eedd216499e8dad153080a Mon Sep 17 00:00:00 2001 From: cliffhall Date: Thu, 13 Mar 2025 19:11:13 -0400 Subject: [PATCH] The HTTP with SSE example doesn't work because the transport is declared as a const inside the handler for /sse endpoint and referenced in the handler for the /messages endpoint. This fixes #187 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fe4caa3f..1fdd8b26 100644 --- a/README.md +++ b/README.md @@ -223,9 +223,10 @@ const server = new McpServer({ // ... set up server resources, tools, and prompts ... const app = express(); +let transport: SSEServerTransport; app.get("/sse", async (req, res) => { - const transport = new SSEServerTransport("/messages", res); + transport = new SSEServerTransport("/messages", res); await server.connect(transport); });