Should McpClient normalize JSON-RPC errors across stdio and Streamable HTTP #1847
Replies: 1 comment
|
For C# SDK 2.1.0, the behavior you observed matches the current implementation, but it is an SDK compatibility choice rather than a transport-independent MCP contract.
Every other non-success status—including a 404 carrying So, today:
SEP-2575 requires an unsupported 2026 RPC to use both HTTP 404 and JSON-RPC I do not see a complete public server-error-to-client-exception matrix in the current C# SDK docs. Given that the response is a valid addressed JSON-RPC error, normalizing it would make cross-transport callers simpler—but it would be a behavioral change and needs a narrowly scoped SDK issue/test that preserves the distinct session-expired and plain HTTP 404 paths. For Azure MCP Server tests on 2.1.0, I would assert both the exception type and the HTTP/JSON-RPC evidence per transport rather than collapsing all 404s into MethodNotFound. |
Uh oh!
There was an error while loading. Please reload this page.
Pre-submission Checklist
Question Category
Your Question
We are adding Streamable HTTP coverage to the Azure MCP Server and found that unsupported MCP methods produce different client exceptions depending on transport when using C# MCP SDK 2.1.0:
stdio:
McpProtocolExceptionwithMcpErrorCode.MethodNotFoundStreamable HTTP:
HttpRequestExceptionwith HTTP 404The HTTP response appears to contain a valid JSON-RPC error envelope with error code
-32601. We understand that SEP-2575 mapsMethodNotFoundto HTTP 404, and that the client currently preserves most 404 responses asHttpRequestExceptionfor backward compatibility.Is this transport-dependent client behavior intentional and part of the expected public contract?
More generally:
Should callers catch both
McpProtocolExceptionandHttpRequestExceptionfor the same logical MCP error?Should a valid JSON-RPC error envelope take precedence over the HTTP status when choosing the client exception?
Is there a documented mapping of server errors to client exceptions for stdio and Streamable HTTP?
Which error scenarios are intentionally transport-specific?
This affects how we write transport-agnostic error handling and tests. We want to ensure that accommodating this case does not hide other incorrectly handled scenarios.
All reactions