Repository navigation
feat(mcp): speak MCP 2026-07-28 next to the initialize-era versions - #1163
Conversation
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
left a comment
There was a problem hiding this comment.
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.
…-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
left a comment
There was a problem hiding this comment.
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.
What changes
POST /api/mcpnow 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-Versionheader is 2026-07-28 or later, or when itsparams._metacarriesio.modelcontextprotocol/protocolVersionof any date. The form is decided after the body is read, so an unsupported_metaversion 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": {}},ttlMsone hour,cacheScope: "public".Results:
resultType: "complete"and_meta["io.modelcontextprotocol/serverInfo"], tool results included;tools/list:ttlMs: 0andcacheScope: "private". The list follows the administrator's tool permissions behind the API key, and those can change at any time.subscriptions/listen:notifications/subscriptions/acknowledged, which agrees to no notification types (this server sends none), with the subscription id in_meta;notificationsis-32602.Transport checks, in this order. Each answers with a JSON-RPC error and HTTP 400 unless noted:
MCP-Protocol-Versionheader is missing-32020_metaprotocol version is missing-32602_metaversion disagree-32020-32022,data: {supported, requested}_metaclientCapabilitiesis missing or not an object-32602logLevelis not one of the eight levels-32602Mcp-Methodis missing or differs from the body-32020-32601, HTTP 404Mcp-Nameof atools/callis missing or differs from the tool name-32020initialize,ping,logging/setLevel, the prompt, resource and completion methods, and unknown methods.Mcp-Nameis also accepted in its=?base64?…?=form.Last-Event-IDis ignored: 2026-07-28 has no stream resumption.The upstream watch reads
version_new(2026-07-28), the versionserver/discoverreports. It no longer reads theinitializedefault (2025-11-25).Unchanged:
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:
initializefor 2025-11-25 and 2024-11-05, and for 2026-07-28 (answered with 2025-11-25);notifications/initialized, the wholetools/list,ping,prompts/list,logging/setLevel;server/discover(-32601),subscriptions/listen;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 differentContent-Lengthfor a different JPEG.2026-07-28 requests (28). Each got the answer described above:
server/discover,tools/list,tools/callofscreen_stateand ofscreenshot(image content after the head);Mcp-Namein base64 form, andMcp-Namemissing or different;isErrorresult with the head), and an unknown tool (-32602, 200);Mcp-Methodmissing or different, the version header missing;_metawithout a version, without capabilities, with a bad or a good log level;_metawith a matching header (-32022, also with aLast-Event-ID), header and_metadisagreeing;ping,initialize,prompts/list, an unknown method (404);subscriptions/listenwith and withoutnotifications;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.
supportedVersionsand the-32022list name only 2026-07-28. The older versions are served only throughinitialize. The revision does not say how a_metarequest with an initialize-era version is served. Listing those versions would send a retrying client down that undefined path.notifications/cancelled:notifications/cancelledto stdio;notifications/cancelledon any teardown.Mcp-Methodor_meta. The revision leaves header requirements for notifications undefined.🤖 Generated with Claude Code