SEP-2164 standardizes the resource not found error code, and the SDK 2.0 line exposes McpErrorCode.ResourceNotFound with McpProtocolException(message, code). Repl.Mcp currently throws code-less McpException for unknown lookups, which surfaces as generic InternalError (-32603):
McpServerHandler.ReadResourceAsync: throw new McpException($"Unknown resource: {uri}") → should be McpErrorCode.ResourceNotFound (-32002).
McpServerHandler.GetPromptAsync: throw new McpException($"Unknown prompt: {promptName}") → should be McpErrorCode.InvalidParams (-32602), the JSON-RPC code for prompts/get with a bad name.
Hosts branch on these codes to distinguish 'gone' from 'broken'.
Ready-made regressions
Two RED tests already exist (parked during PR #71 review to keep that PR scoped): When_ReadingUnknownResource_Then_ResourceNotFoundCodeIsReturned and When_GettingUnknownPrompt_Then_InvalidParamsCodeIsReturned — observed failures: InternalError -32603 in both cases.
Dependency
Requires the SDK 2.0 line (PR #71): McpProtocolException(message, McpErrorCode) does not exist in 1.4.1. Land as a small follow-up PR right after #71 merges.
Related compliance notes
Problem (2026-07-28 spec compliance, see modelcontextprotocol/csharp-sdk#1539)
SEP-2164 standardizes the resource not found error code, and the SDK 2.0 line exposes
McpErrorCode.ResourceNotFoundwithMcpProtocolException(message, code). Repl.Mcp currently throws code-lessMcpExceptionfor unknown lookups, which surfaces as genericInternalError(-32603):McpServerHandler.ReadResourceAsync:throw new McpException($"Unknown resource: {uri}")→ should beMcpErrorCode.ResourceNotFound(-32002).McpServerHandler.GetPromptAsync:throw new McpException($"Unknown prompt: {promptName}")→ should beMcpErrorCode.InvalidParams(-32602), the JSON-RPC code forprompts/getwith a bad name.Hosts branch on these codes to distinguish 'gone' from 'broken'.
Ready-made regressions
Two RED tests already exist (parked during PR #71 review to keep that PR scoped):
When_ReadingUnknownResource_Then_ResourceNotFoundCodeIsReturnedandWhen_GettingUnknownPrompt_Then_InvalidParamsCodeIsReturned— observed failures:InternalError -32603in both cases.Dependency
Requires the SDK 2.0 line (PR #71):
McpProtocolException(message, McpErrorCode)does not exist in 1.4.1. Land as a small follow-up PR right after #71 merges.Related compliance notes