Skip to content

Commit cb8316f

Browse files
committed
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 modelcontextprotocol#187
1 parent 0fa2397 commit cb8316f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ const server = new McpServer({
223223
// ... set up server resources, tools, and prompts ...
224224

225225
const app = express();
226+
let transport: SSEServerTransport;
226227

227228
app.get("/sse", async (req, res) => {
228-
const transport = new SSEServerTransport("/messages", res);
229+
transport = new SSEServerTransport("/messages", res);
229230
await server.connect(transport);
230231
});
231232

0 commit comments

Comments
 (0)