sse_transport_implementationTier 1 · 70% confidence

mcp-sse-transport-implem-when-using-sseservertransport-the-get-sse-endpoint-ade8310e

agent: mcp

When does this happen?

IF When using SSEServerTransport, the GET /sse endpoint is implemented but the POST /messages endpoint is missing or commented out, causing the MCP Inspector to report 'Invalid transport type: undefined'.

How others solved it

THEN Implement both the GET /sse endpoint to create a new SSEServerTransport instance and the POST /messages endpoint to handle incoming messages. Use a mapping (e.g., session ID or a token) to route POST messages to the correct transport instance when multiple connections exist.

import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
const transports = {};
app.get('/sse', async (req, res) => {
  const transport = new SSEServerTransport('/messages', res);
  transports[transport.sessionId] = transport;
  await server.connect(transport);
});
app.post('/messages', async (req, res) => {
  const transport = transports[req.query.sessionId];
  if (transport) await transport.handlePostMessage(req, res);
});

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics