-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Labels
help wantedGood candidate for contribution. Comment first to say you're working on it.Good candidate for contribution. Comment first to say you're working on it.
Description
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:
- Python: ignores the SSE connection when an error occurs (https://github.com/modelcontextprotocol/python-sdk/blob/db9e4515514255e7378c0e120b042dd5981ec120/src/mcp/client/streamable_http.py#L218)
- Typescript: retries several times and then ignores the error (https://github.com/modelcontextprotocol/typescript-sdk/blob/7387c44bf548b23c5cd8f1b7ae88020bfa7058ad/src/client/streamableHttp.ts#L291)
- Go: terminates the MCP session
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
Labels
help wantedGood candidate for contribution. Comment first to say you're working on it.Good candidate for contribution. Comment first to say you're working on it.