Skip to content

Commit 711e5bb

Browse files
authored
Rename MinVersionForStandardHeaders to DraftProtocolVersion (#1603)
1 parent 168c371 commit 711e5bb

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

src/Common/McpHttpHeaders.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,27 @@ namespace ModelContextProtocol.Protocol;
1010
internal static class McpHttpHeaders
1111
{
1212
/// <summary>
13-
/// The minimum protocol version that requires standard MCP request headers.
13+
/// The draft MCP protocol version string used to gate behaviors that are only enabled
14+
/// for clients negotiating the in-progress draft specification.
1415
/// </summary>
1516
/// <remarks>
16-
/// Servers enforce missing <c>Mcp-Method</c> and <c>Mcp-Name</c> headers as errors only when
17-
/// the client's <c>MCP-Protocol-Version</c> header indicates this version or later.
18-
/// Clients using older versions are not required to send these headers.
17+
/// Behaviors currently gated on this version include:
18+
/// <list type="bullet">
19+
/// <item><description>
20+
/// Requiring the standard MCP request headers (<c>Mcp-Method</c> and <c>Mcp-Name</c>)
21+
/// on Streamable HTTP POST requests; servers treat missing headers as errors only when
22+
/// the client's <c>MCP-Protocol-Version</c> header matches this value.
23+
/// </description></item>
24+
/// <item><description>
25+
/// Reporting unresolvable resource URIs from <c>resources/read</c> with the standard
26+
/// JSON-RPC <see cref="McpErrorCode.InvalidParams"/> (-32602) code rather than the
27+
/// legacy <see cref="McpErrorCode.ResourceNotFound"/> (-32002) code.
28+
/// </description></item>
29+
/// </list>
30+
/// The associated helpers perform exact ordinal matches against this single value rather
31+
/// than any ordered comparison.
1932
/// </remarks>
20-
public static readonly string MinVersionForStandardHeaders = "DRAFT-2026-v1";
33+
public const string DraftProtocolVersion = "DRAFT-2026-v1";
2134

2235
/// <summary>The session identifier header.</summary>
2336
public const string SessionId = "Mcp-Session-Id";
@@ -67,7 +80,7 @@ internal static class McpHttpHeaders
6780
/// </summary>
6881
private static readonly HashSet<string> s_versionsWithStandardHeaders = new(StringComparer.Ordinal)
6982
{
70-
MinVersionForStandardHeaders,
83+
DraftProtocolVersion,
7184
};
7285

7386
/// <summary>
@@ -82,5 +95,5 @@ public static bool SupportsStandardHeaders(string? protocolVersion)
8295
/// rather than the legacy <see cref="McpErrorCode.ResourceNotFound"/> (-32002).
8396
/// </summary>
8497
internal static bool UseInvalidParamsForMissingResource(string? protocolVersion)
85-
=> string.Equals(protocolVersion, MinVersionForStandardHeaders, StringComparison.Ordinal);
98+
=> string.Equals(protocolVersion, DraftProtocolVersion, StringComparison.Ordinal);
8699
}

0 commit comments

Comments
 (0)