Skip to content

MCP SSE transport ignores the server's endpoint event and POSTs to a guessed URL, so standard SSE servers fail to connect #508

Closed

Description

@AnKiT-GaRG2

Summary

The sse MCP transport cannot connect to standard MCP SSE servers. It guesses the POST URL with self.url.replace("/sse", "/message") instead of using the endpoint the server announces, so requests go to a URL that does not exist and connect() fails after a 30s timeout.

Cause

In agent_core/core/impl/mcp/server.py, SSETransport:

  • The MCP SSE spec says the server's first event is event: endpoint, whose data is the URL JSON-RPC requests must be POSTed to. _listen_sse never reads it (it only parses data: lines as JSON, so the endpoint line is dropped).
  • send_request then POSTs to self.url.replace("/sse", "/message"). The official Python SDK serves GET /sse and POST /messages/?session_id=..., so the guess is /message (no s, no session) and returns 404.
  • Unlike the stdio and websocket transports, it never sends notifications/initialized after initialize.

Reproduction

Server: official MCP Python SDK (mcp==1.30.0), FastMCP(...).run(transport="sse") with one tool. Client: CraftBot's MCPServerConnection with MCPServerConfig(name="official", transport="sse", url="http://127.0.0.1:8771/sse").

CraftBot:

CraftBot MCPServerConnection.connect() -> False in 30.1s
SSE initialize failed: {'code': -1, 'message': 'Request timeout'}

server log:
  "POST /message HTTP/1.1" 404 Not Found
  "GET /sse HTTP/1.1" 200 OK

Control, the official SDK client against the same server:

official client OK, tools: ['add']
  "GET /sse HTTP/1.1" 200 OK
  "POST /messages/?session_id=a5ad5e8a... HTTP/1.1" 202 Accepted   (x3)

So the server is fine; the difference is the URL CraftBot POSTs to.

Expected

The transport POSTs to the endpoint announced in the server's endpoint event and sends notifications/initialized.

Notes

Activity

  1. added a commit that references this issue on Nov 7, 2026
    f5b5f60
  2. added 4 commits that reference this issue on Nov 19, 2026
    59436f7
    c8365d2
    e921b5e
    4c859b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions