Skip to content

Relax SSE connection response handling #610

@zhxie

Description

@zhxie

This issue is similar to #393.

As described in the previous issue, a MCP server may return an error code instead of 405 Method Not Allowed when the client initializes an SSE connection for incoming events.

Previously, We have addressed this by allowing 404 Not Found response code. However, I have encountered an MCP server that responds with 400 Bad Request on the SSE connection.

When testing with MCP Inspector, it also reports a Bad Request error in thsis case, but the session proceeds normally afterward. I also checked other SDK implementations:

Would it make sense to further relax the requirement to accept non-200 responses in non-strict mode? I can submit a patch if sounds reasonable.

CC @findleyr

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedGood candidate for contribution. Comment first to say you're working on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions