From 2140d21cb715b797873e6f921149f739380288e4 Mon Sep 17 00:00:00 2001 From: Stephen Halter Date: Tue, 26 May 2026 08:08:11 -0700 Subject: [PATCH 1/2] Rename `MinVersionForStandardHeaders` to `DraftProtocolVersion` The constant in src/Common/McpHttpHeaders.cs now gates more than just whether the standard MCP request headers are required: it also gates whether resources/read returns InvalidParams (-32602) instead of the legacy ResourceNotFound (-32002). Its old name referred only to headers, and the `Min` prefix wrongly implied an ordered/`>=` comparison even though the helpers do exact ordinal matches against a single value. Rename the constant to `DraftProtocolVersion` and update its XML docs to describe both gated behaviors. Pure rename plus doc clarification -- no behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Common/McpHttpHeaders.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Common/McpHttpHeaders.cs b/src/Common/McpHttpHeaders.cs index 5c631a0e7..adc888080 100644 --- a/src/Common/McpHttpHeaders.cs +++ b/src/Common/McpHttpHeaders.cs @@ -10,14 +10,27 @@ namespace ModelContextProtocol.Protocol; internal static class McpHttpHeaders { /// - /// The minimum protocol version that requires standard MCP request headers. + /// The draft MCP protocol version string used to gate behaviors that are only enabled + /// for clients negotiating the in-progress draft specification. /// /// - /// Servers enforce missing Mcp-Method and Mcp-Name headers as errors only when - /// the client's MCP-Protocol-Version header indicates this version or later. - /// Clients using older versions are not required to send these headers. + /// Behaviors currently gated on this version include: + /// + /// + /// Requiring the standard MCP request headers (Mcp-Method and Mcp-Name) + /// on Streamable HTTP POST requests; servers treat missing headers as errors only when + /// the client's MCP-Protocol-Version header matches this value. + /// + /// + /// Reporting unresolvable resource URIs from resources/read with the standard + /// JSON-RPC (-32602) code rather than the + /// legacy (-32002) code. + /// + /// + /// The associated helpers perform exact ordinal matches against this single value rather + /// than any ordered comparison. /// - public static readonly string MinVersionForStandardHeaders = "DRAFT-2026-v1"; + public static readonly string DraftProtocolVersion = "DRAFT-2026-v1"; /// The session identifier header. public const string SessionId = "Mcp-Session-Id"; @@ -67,7 +80,7 @@ internal static class McpHttpHeaders /// private static readonly HashSet s_versionsWithStandardHeaders = new(StringComparer.Ordinal) { - MinVersionForStandardHeaders, + DraftProtocolVersion, }; /// @@ -82,5 +95,5 @@ public static bool SupportsStandardHeaders(string? protocolVersion) /// rather than the legacy (-32002). /// internal static bool UseInvalidParamsForMissingResource(string? protocolVersion) - => string.Equals(protocolVersion, MinVersionForStandardHeaders, StringComparison.Ordinal); + => string.Equals(protocolVersion, DraftProtocolVersion, StringComparison.Ordinal); } From 59b5d19f2746c87bc935b959b1f7c622e6427396 Mon Sep 17 00:00:00 2001 From: Tarek Mahmoud Sayed <10833894+tarekgh@users.noreply.github.com> Date: Tue, 26 May 2026 13:33:08 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/Common/McpHttpHeaders.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Common/McpHttpHeaders.cs b/src/Common/McpHttpHeaders.cs index adc888080..0768cb442 100644 --- a/src/Common/McpHttpHeaders.cs +++ b/src/Common/McpHttpHeaders.cs @@ -30,7 +30,7 @@ internal static class McpHttpHeaders /// The associated helpers perform exact ordinal matches against this single value rather /// than any ordered comparison. /// - public static readonly string DraftProtocolVersion = "DRAFT-2026-v1"; + public const string DraftProtocolVersion = "DRAFT-2026-v1"; /// The session identifier header. public const string SessionId = "Mcp-Session-Id";