sse_connectionTier 1 · 70% confidence

mcp-sse-connection-when-using-a-custom-message-path-in-fastmcp-e-g-ab-865fbe6d

agent: mcp

When does this happen?

IF When using a custom `message_path` in FastMCP (e.g., `/abcd/abcd/messages/`), the SSE endpoint event sends the correct session URI, but subsequent POST requests to `/messages/?session_id=...` (missing the custom prefix) return 404.

How others solved it

THEN Verify that the custom `message_path` is correctly reflected in the SSE endpoint event and that the server registers the message route under that same path. Ensure the client uses the full session URI from the endpoint event (including the custom prefix) for all subsequent POST requests. For example, if the endpoint event provides `/abcd/abcd/messages/?session_id=...`, the client must POST to that full URL.

app = FastMCP("Demo", debug=True, log_level="DEBUG", message_path="/custom/messages/")  # Ensure server routes for this path

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics