Skip to content

[BUG] Custom MCP SSE message endpoints create a different transport and cannot resolve the SSE session #8045

Closed

Description

@Aias00

Environment

Current master 34f2ed036747936a5e28aea2c94cd9b3cddcce47; MCP server plugin, SSE transport.

Reproduction

  1. Configure selector /mcp/** with handle {"messageEndpoint":"/rpc"} and an enabled tool rule.
  2. Open an SSE connection at /mcp. The server advertises /mcp/rpc?sessionId=<id>.
  3. POST an MCP JSON-RPC initialization message to the advertised URL using that session ID.

Code-derived actual behavior

The original SSE connection belongs to the transport keyed by /mcp. However, handleSseRequest passes the full incoming /mcp/rpc URI to getOrCreateMcpServerTransport. normalizeServerPath strips only fixed suffixes (/message, /sse, /streamablehttp), so /mcp/rpc becomes a different server key. A new transport is created, and its session map does not contain the original SSE session. The message handler returns 404 Session not found. It also leaves an unintended extra server/transport registered.

Code evidence

Expected behavior / acceptance

Use the matched selector's canonical server path to obtain its SSE transport; resolve the configured message endpoint separately from server identity. Add coverage with a non-default endpoint such as /rpc: SSE setup and subsequent JSON-RPC POST must share the same transport/session, with no extra shared server created. Keep /message compatibility coverage.

Validation

Confirmed through source-level tracing, not an executed end-to-end reproduction. This occurs on initial configuration and does not require an endpoint update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions