Skip to content

feat(mcp): speak MCP 2026-07-28 next to the initialize-era versions - #1163

Merged
dormancygrace merged 3 commits into
mainfrom
ai/mcp-2026-07-28
Dec 2, 2026
Merged

dormancygrace merged 3 commits into
mainfrom
ai/mcp-2026-07-28

Conversation

@dormancygrace

@dormancygrace dormancygrace commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

What changes

POST /api/mcp now speaks MCP 2026-07-28, the final revision, next to the initialize-era versions (2024-11-05 to 2025-11-25). Those older versions get the same answers as before.

A call counts as 2026-07-28 when its MCP-Protocol-Version header is 2026-07-28 or later, or when its params._meta carries io.modelcontextprotocol/protocolVersion of any date. The form is decided after the body is read, so an unsupported _meta version such as 1900-01-01 gets -32022, not the plain-text 400 of the older form. Such calls get:

  • server/discover (new): supportedVersions: ["2026-07-28"], capabilities: {"tools": {}}, ttlMs one hour, cacheScope: "public".

  • Results:

    • every result starts with resultType: "complete" and _meta["io.modelcontextprotocol/serverInfo"], tool results included;
    • the head goes in before the content, so a screenshot's base64 is still written once.
  • tools/list: ttlMs: 0 and cacheScope: "private". The list follows the administrator's tool permissions behind the API key, and those can change at any time.

  • subscriptions/listen:

    • answers on an event stream: first notifications/subscriptions/acknowledged, which agrees to no notification types (this server sends none), with the subscription id in _meta;
    • then the closing result with the same id;
    • a call without notifications is -32602.
  • Transport checks, in this order. Each answers with a JSON-RPC error and HTTP 400 unless noted:

    Check Error
    MCP-Protocol-Version header is missing -32020
    _meta protocol version is missing -32602
    header and _meta version disagree -32020
    version is not 2026-07-28 -32022, data: {supported, requested}
    _meta clientCapabilities is missing or not an object -32602
    logLevel is not one of the eight levels -32602
    Mcp-Method is missing or differs from the body -32020
    method is not one this server has in 2026-07-28 -32601, HTTP 404
    Mcp-Name of a tools/call is missing or differs from the tool name -32020
    • The methods missing in 2026-07-28 are initialize, ping, logging/setLevel, the prompt, resource and completion methods, and unknown methods.
    • Mcp-Name is also accepted in its =?base64?…?= form.
  • Last-Event-ID is ignored: 2026-07-28 has no stream resumption.

  • The upstream watch reads version_new (2026-07-28), the version server/discover reports. It no longer reads the initialize default (2025-11-25).

Unchanged:

  • errors raised inside a method (unknown tool, bad cursor) stay JSON-RPC errors with HTTP 200;
  • notifications are accepted with 202, since the revision defines no headers for notification POSTs;
  • the built-in agent's local calls stay in the initialize-era form.

Checked on a NanoKVM PCIe

The same 46 requests went to a server built from the base of this branch and to this branch's server, with MCP mode on and a test API key. For each answer, the status, the content type, a hash of the headers without Date, and a hash of the whole body were compared. In the body hash, a picture's data and size were masked.

Initialize-era requests (18). 16 answers were equal in all four. The requests covered:

  • initialize for 2025-11-25 and 2024-11-05, and for 2026-07-28 (answered with 2025-11-25);
  • notifications/initialized, the whole tools/list, ping, prompts/list, logging/setLevel;
  • an unknown tool, arguments failing validation, an unknown method, server/discover (-32601), subscriptions/listen;
  • a batch on the default version, an unsupported old header, and Last-Event-ID.

The other two were tool results that carry live data:

  • screen_state: the same shape, with a screen score of 0.8 and of 0.793;
  • screenshot: equal bodies after masking, with a different Content-Length for a different JPEG.

2026-07-28 requests (28). Each got the answer described above:

  • server/discover, tools/list, tools/call of screen_state and of screenshot (image content after the head);
  • Mcp-Name in base64 form, and Mcp-Name missing or different;
  • arguments failing validation (isError result with the head), and an unknown tool (-32602, 200);
  • Mcp-Method missing or different, the version header missing;
  • _meta without a version, without capabilities, with a bad or a good log level;
  • versions 2027-01-01, 2026-01-01, 1900-01-01 and 2025-11-25 in _meta with a matching header (-32022, also with a Last-Event-ID), header and _meta disagreeing;
  • ping, initialize, prompts/list, an unknown method (404);
  • subscriptions/listen with and without notifications;
  • Last-Event-ID, a cursor, and a notification (202).

Not exercised: a third-party MCP client or conformance suite speaking 2026-07-28. The checks follow the revision's text, not a reference implementation.

Readings of the revision

These are points where the revision's text allows more than one reading.

  • supportedVersions and the -32022 list name only 2026-07-28. The older versions are served only through initialize. The revision does not say how a _meta request with an initialize-era version is served. Listing those versions would send a retrying client down that undefined path.
  • The listen stream is ended with the result right after the acknowledgement. It is not ended with notifications/cancelled:
    • the subscriptions page says a server ending a subscription SHOULD send a completion result;
    • the schema limits a server's notifications/cancelled to stdio;
    • the cancellation page asks for notifications/cancelled on any teardown.
  • Notification POSTs need no Mcp-Method or _meta. The revision leaves header requirements for notifications undefined.

🤖 Generated with Claude Code

A call in the 2026-07-28 form (the version and the client's capabilities in
params._meta, the version also in MCP-Protocol-Version) now gets what that
version defines:

- server/discover: the supported version, the tools capability, cacheable
  for an hour by anyone;
- results with resultType "complete" and the server in
  _meta["io.modelcontextprotocol/serverInfo"]; tools/list is not cached and
  private, since it follows the tool permissions behind the API key;
- subscriptions/listen: an event stream that acknowledges no notifications
  (this server sends none) and ends with the result;
- the checks and errors of the transport: Mcp-Method and, for tools/call,
  Mcp-Name (also in its "=?base64?...?=" form) must match the body (-32020),
  a version other than 2026-07-28 is -32022 with the supported list,
  missing capabilities or a wrong log level are -32602, all with HTTP 400;
  methods that version does not have here (initialize, ping,
  logging/setLevel, prompts, resources, completion) are -32601 with 404;
- a Last-Event-ID is ignored, as the version has no stream resumption.

Calls without the 2026-07-28 form are answered as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dormancygrace dormancygrace left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built the HTTP handler and exercised it locally with a fixture API key. Discovery, the eight-tool list, subscription acknowledgement and closing result all validate against the official 2026-07-28 JSON schema. Version negotiation still has a blocking interoperability bug. There is also a follow-up for the dependency report on main.

Comment thread server-cpp/src/ai/mcp.cpp Resolved
Comment thread server-cpp/src/ai/mcp.cpp Resolved
dormancygrace and others added 2 commits December 2, 2026 20:06
…-32022

A call in the 2026-07-28 form (a version in params._meta) with an
unsupported version dated before 2026-07-28, such as 1900-01-01 or
2026-01-01, got the plain-text 400 of the initialize era, which a client
speaking both forms can take for a server of the older form. The form is
now told after the body is read, by a _meta version or a header version
of 2026-07-28 or later. Calls in that form get -32022 with the supported
and requested versions whatever the date, and their Last-Event-ID is
ignored. Calls in the initialize-era form keep the plain-text answers.

The upstream watch now reads version_new (2026-07-28), the version
server/discover reports. It no longer reads the initialize default
(2025-11-25), so a newer specification is compared with the newest
version spoken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@dormancygrace dormancygrace left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified both fixes on 8b9ae59. The native handler returns HTTP 400 with JSON-RPC -32022, the requested version and the supported list for 1900-01-01, 2026-01-01 and 2027-01-01, including with Last-Event-ID. Missing or mismatched version headers return -32020; a legacy request with an unsupported header still returns the expected plain-text 400. Discovery, all eight listed tools and both subscription frames pass the official 2026-07-28 response schemas. The upstream inventory now reports MCP 2026-07-28 from the discovery constant. Both previous findings are resolved. No further code blocker found.

@dormancygrace
dormancygrace merged commit dda44d9 into main Dec 2, 2026
11 of 12 checks passed
@dormancygrace
dormancygrace deleted the ai/mcp-2026-07-28 branch December 2, 2026 18:24
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Build outputs

Compared with the build of main at 6f0a42d; main is at 485f39e, so outputs changed since then are listed too.

1 changed, 0 added, 0 removed of 722 outputs.

directory files
changed server server/NanoKVM-Server
Hashes: outputs-sha256 artifact of this run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant