Skip to content

Offer every MCP protocol version from the remote MCP server - #4837

Merged
Mpdreamz merged 1 commit into
chore/bump-modelcontextprotocolfrom
feat/mcp-offer-all-protocol-versions
Nov 16, 2026
Merged

Mpdreamz merged 1 commit into
chore/bump-modelcontextprotocolfrom
feat/mcp-offer-all-protocol-versions

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

Removes the ProtocolVersion pin from the remote MCP server, so it serves clients on the 2026-07-28 protocol as well as the ones that still use initialize.

Affects: MCP

Prompt summary: After moving to ModelContextProtocol 2.4, decide whether to lift the pin to 2025-11-25, check what current guidance says, and prepare the change with the reasons.

Why

Program.cs pins ProtocolVersion to 2025-11-25. With the 2.x SDK the pin has two costs:

  • New clients are refused. A client on the 2026-07-28 protocol gets 400 with code -32022 and supported: ["2025-11-25"]. SDK clients fall back to initialize. Other clients may not.
  • Old clients are overridden. A client that asks for 2024-11-05 gets 2025-11-25 back.

Pinning to 2026-07-28 instead is not an option. The SDK documents that it makes the server reject every initialize handshake, and nearly every client still uses initialize. I did not run that pin on our server.

The spec describes the alternative. A server that supports both eras is called dual-era, and the versioning page of the 2026-07-28 revision says:

  • A server that wishes to support both legacy and modern clients MAY implement both behaviours, and MAY serve both eras on the same endpoint.
  • A legacy client with a dual-era server works: the server answers initialize and serves the client by the negotiated legacy revision.
  • A legacy client with a modern-only server fails, because legacy clients have no way to move forward.
  • Servers MUST implement server/discover.
  • A server that refuses a version MUST answer with an UnsupportedProtocolVersionError that lists the versions it supports. That is the -32022 response above.

The C# SDK versioning page says a v2 server keeps accepting initialize from down-level clients. It does not recommend a value for ProtocolVersion. The SDK's own reference for the property says that null supports all versions.

What

The server

ProtocolVersion is left null, with a comment that says why. That is the dual-era setup of the spec. Stateless HTTP stays as it is.

What clients see

Measured on the test host:

Client Before After
initialize asking for 2025-11-25 2025-11-25 Same
initialize asking for 2024-11-05 2025-11-25 2024-11-05
server/discover and tools/list on 2026-07-28 400, -32022 200

On 2026-07-28 the request needs the Mcp-Protocol-Version and Mcp-Method headers, and the server/discover result has a tools capability and no logging capability. The results carry no caching hints. The tools and their schemas are the same as for an initialize client.

Tests

mcp-protocol-versions.http pins the three behaviours above. The two handshake files, in Mcp.Remote.Tests and the journeys project, now ask for 2025-11-25, which is what clients send today, so their snapshots do not change. They asked for 2024-11-05 before only to guard the pin. I put the pin back once and the new test failed.

Verify

mise run test
dotnet test --project tests/Elastic.Documentation.Journeys.Tests --treenode-filter "/*/*/McpHttp/*"

Risk: an older client now negotiates the version it asks for, not 2025-11-25. I did not check how a real old client behaves without 2025-11-25 features. I did not run a tools/call over 2026-07-28 either, because it needs the search backend. Try Claude Desktop and VS Code against the preview before merging.

Stack: 4 of 4, on top of #4836.

The server pinned ProtocolVersion to 2025-11-25, which refuses clients on the
2026-07-28 protocol and overrides the version older clients ask for. Leaving it
null makes the server dual-era: initialize clients get the version they ask for
and 2026-07-28 clients are served through server/discover.

A new http test pins the three behaviours. The handshake tests now send
2025-11-25, which is what clients send today.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner November 12, 2026 13:55
@Mpdreamz
Mpdreamz requested a review from technige November 12, 2026 13:56
@Mpdreamz
Mpdreamz merged commit 1d9dda7 into chore/bump-modelcontextprotocol Nov 16, 2026
45 checks passed
@Mpdreamz
Mpdreamz deleted the feat/mcp-offer-all-protocol-versions branch November 16, 2026 10:35
Mpdreamz added a commit that referenced this pull request Nov 16, 2026
* Format project files the way curb 0.14 does

Curb 0.14 formats XML with the editorconfig indent. The 16 project files
and the solution file change in whitespace only.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Move the nullean libraries and tools to the latest releases

Snapshots 0.11, Argh and Make.Fs 0.29, Proc 0.22, Cdp 0.11, Mermaider 0.17,
curb 0.14 and the release-notes tool. The 0.11 snapshot engine keeps whitespace
inside pre, so those verified files now show the real markup, and the MCP
event stream snapshot lists the JSON of each event.

ScopedFileSystem stays on 0.6.0, Snapshots on 0.11.0 and Pagefind.Net on 0.5.0.
The newer releases need System.IO.Abstractions 23, whose Testably interface
adds IFile.CreateHardLink, and ScopedFileSystem 0.7.1 does not implement it.

Docker targets now fail up front when docker is missing (needsTool).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Match the MCP handshake journey to the SSE rendering of the new Nullean.Snapshots

The snapshot library now pretty-prints event-stream bodies itself, so the
SSE scrubber is a no-op and the prose mask no longer matched. Mask the prose
in the new format and regenerate the verified file.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Bring the other dependencies and dotnet tools up to date

AWSSDK 4.1, Elastic.Clients.Elasticsearch 9.5, Elastic.Transport 1.1,
Elastic.Ingest 0.56, HtmlSanitizer 11, AngleSharp 1.10, Markdig 1.6, OpenTelemetry
1.21, TUnit 1.83, WireMock 2, Spectre.Console 0.57, Slugify 5, MinVer 8, husky
and the other packages that had a newer release. Slugify 5 no longer takes a
null, so Slugify() passes an empty string for one.

Four stay behind. RazorSlices 0.12 writes empty attributes, which changes the
HTML of 77 snapshots. ModelContextProtocol 2 changes the tool annotations and
input schemas that the MCP server returns. Elastic.OpenTelemetry 1.7 ships a
ReadOnlyMemoryStream that collides with the one in the net11 BCL. Elastic.Transport 8
breaks the client code that uses JsonResponse.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Test that Slugify returns an empty string for null input

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Keep Slugify.Core on 4.0.1

Slugify 5 rejects a null argument and Slugify() takes a nullable string. A
null-coalescing workaround would hide a behaviour change, so the package stays
until the repo has its own slug method.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Take Elastic.OpenTelemetry 1.7 and stop using ReadOnlyMemoryStream in the API tests

Elastic.OpenTelemetry 1.7 ships a public System.IO.ReadOnlyMemoryStream in its
netstandard2.1 asset. The net11 runtime has a type of that name too, so the API
test projects, which reference the package, fail with CS0433. The tests read a
byte array, so a read-only MemoryStream does the same job.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Take RazorSlices 0.12 and leave empty attributes out of the HTML

RazorSlices 0.12 writes an attribute bound to an empty string as name="", where
0.11 left it out. The tab and applies-switch radios bound checked to "checked" or
"", so every radio would have been checked. The templates now bind null instead,
through NullIfEmpty and JoinOrNull, so the HTML stays the same and no snapshot
changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Make Slugify() return an empty string for null

Slugify.Core 4.0.1 throws a NullReferenceException for null although Slugify()
takes a string?. The guard lives in our method, so it holds for any version of
the package or a replacement (see the issue about our own slug method).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Take ModelContextProtocol 2.4

The six tools, their descriptions, input schemas and annotations are the same.
tools/list now returns them in a different order and no longer advertises
execution.taskSupport. Both handshake snapshots follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Offer every MCP protocol version instead of pinning one (#4837)

The server pinned ProtocolVersion to 2025-11-25, which refuses clients on the
2026-07-28 protocol and overrides the version older clients ask for. Leaving it
null makes the server dual-era: initialize clients get the version they ask for
and 2026-07-28 clients are served through server/discover.

A new http test pins the three behaviours. The handshake tests now send
2025-11-25, which is what clients send today.

Co-authored-by: Claude Sonnet 5.5 <[email protected]>

* Cover a tools/call over the 2026-07-28 protocol

The protocol versions test sent server/discover and tools/list on 2026-07-28 but
no call that runs a tool. A get_document_by_url call with an empty URL now goes
through the per-request path and snapshots the tool result.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Stub the document gateway in the MCP handshake tests

The tools/call request in the protocol versions test still reached
Elasticsearch: the gateway searches even for an empty URL. The test host now
replaces IDocumentGateway with one that echoes the URL, so the test does not
depend on a cluster and its snapshot shows that the argument arrived.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Run the MCP handshake cases one at a time

With two .http files the cases run in parallel, and each sets and restores the
process-wide MCP_SERVER_PROFILE, so one could restore it while the other host
starts. They now share a NotInParallel key.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Co-authored-by: Mpdreamz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant