feat: dual-era support for the 2026-07-28 protocol version - #238
feat: dual-era support for the 2026-07-28 protocol version#238sideeffffect wants to merge 3 commits into
Conversation
Make chimp a dual-era server: alongside the legacy initialize handshake (2025-11-25 and earlier), it now speaks the modern 2026-07-28 revision, where each request carries its protocol version in _meta. - ProtocolVersion.V2026_07_28 + a `supported` list; `Latest` still points at the latest legacy revision used by the initialize handshake. - server/discover returns a DiscoverResult (supported versions, capabilities, serverInfo in _meta), so a modern/dual-era client no longer gets an error from a chimp server (addresses the softwaremill#235 review). - A request declaring an unsupported protocol version in _meta[io.modelcontextprotocol/protocolVersion] is rejected with UnsupportedProtocolVersion (-32022) listing the supported versions. - New protocol types (DiscoverResult, CacheScope, ProtocolMeta) are validated against the official 2026-07-28 JSON schema (Schema2026ConformanceSpec), following the existing schema-conformance convention; the 2025-11-25 types are left untouched. WIP: modern client mode, HTTP transport-level validation (headers / 400 semantics), resultType on all results, and packaging extensions (e.g. Tasks) as separate modules are follow-ups. Groundwork for softwaremill#163. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Keep the domain type while the wire stays integer milliseconds, via a file-private millis codec. supportedVersions stays List[String] on purpose: the field must carry version strings the receiver may not recognise (a newer peer), which a closed ProtocolVersion enum would reject on decode. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Parses the raw supportedVersions strings into Either[String, ProtocolVersion]: Right for a known version, Left with the raw string for an unrecognised one, so callers get the typed view without the wire field rejecting newer versions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Hello @kubinio123 , what do this about adding support for dual-era like this? |
|
Relevant field data point if useful: I maintain a 2026-07-28-only (not dual-era) MCP server implementation, and one thing worth testing explicitly once We went the other direction on the design question this PR is solving (latest-only rather than dual-era — wrote up the tradeoff here if the reasoning is useful as a comparison point, not a suggestion to change course) — dual-era is clearly the more correct choice for a general-purpose client-facing library like this, ours was a narrower bet made for a specific reason. |
Groundwork for
2026-07-28(the "modern" era) support, making chimp dual-era. This is the foundation the reviews on #234 and #235 pointed to (relates to #163).Why
Per the
2026-07-28versioning compatibility matrix,server/discoverand extensions like Tasks belong to the modern era. Today chimp is legacy-only, so — as @kubinio123 noted on #235 — a modern/dual-era client callingserver/discovershould get an error. This PR makes chimp genuinely dual-era, so answeringserver/discover(and recognising modern per-request versions) becomes correct.What
ProtocolVersion.V2026_07_28+ asupportedlist.Lateststill points at the latest legacy revision used by theinitializehandshake, so legacy negotiation is unchanged.server/discover→DiscoverResult(supported versions, capabilities,serverInfoin_meta,resultType: "complete",ttlMs,cacheScope)._meta["io.modelcontextprotocol/protocolVersion"]that the server doesn't support is rejected withUnsupportedProtocolVersion(-32022) listing the supported versions; a supported/absent version is processed as before (chimp already handles each request statelessly).DiscoverResult,CacheScope,ProtocolMeta(the reserved_metakeys).Addressing the review feedback
2026-07-28schema inSchema2026ConformanceSpec, mirroringSchemaConformanceSpec— I bundledschema/2026-07-28/schema.jsonas a test resource.2025-11-25(feat: MCP Tasks extension (full: protocol, server execution, client) #234): no fields were added to the shared types (e.g. noextensionsonServerCapabilities); chimp'sServerCapabilitiesis already a valid subset of the2026-07-28one. The2025-11-25schema conformance and the legacyinitializepath are untouched.Deliberately out of scope (WIP / follow-ups)
initializehandshake).MCP-Protocol-Versionheader,400semantics, era detection).resultTypeon all existing results (modern clients already treat an absentresultTypeas"complete", so this is backward-compatible).clientCapabilities,-32021) and the tasks/other extension modules.Tests
Schema2026ConformanceSpec(DiscoverResult + the-32022envelope vs. the official schema) andMcpHandlerSpeccases:server/discoverreturns supported versions + capabilities + identity; an unsupported version →-32022; a supported modern version is processed; legacyinitializestill works.sbt scalafmtCheckAll compile Test/compile compileDocsand the unit suites pass locally. Draft/WIP.🤖 Generated with Claude Code