Repository navigation
M5: dual era (2025-11-25 and 2025-06-18 next to 2026-07-28) - #6
Merged
Merged
Conversation
A dual-era server serves the initialize handshake of 2025-11-25 and 2025-06-18 (2025-03-26 accepted as a version string) next to the 2026-07-28 core on the same process. New-McpServer defaults to all three revisions; the era of every request is chosen in one place (Get-McpMessageEra) and legacy results and errors are converted in one place (Era.ps1): no resultType, ttlMs, cacheScope or io.modelcontextprotocol/ _meta keys, -32002 for unknown resources. LegacySession.ps1 implements the session (version and capability negotiation, ping, logging/setLevel, resources/subscribe and unsubscribe), unsolicited list-changed and resource-updated notifications, and server-initiated elicitation, sampling and roots requests: the MRTR cmdlets stay era-agnostic, in a legacy session the worker sends the request and blocks until the dispatcher correlates the client's response, the request is cancelled or it times out. Requests of a session are keyed with the session's prefix. A modern-only server answers initialize with -32022 and its versions; a legacy-only server answers requests before initialize with -32600. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rvihdz4S9tqxJNrZGrX3qD
A server with legacy revisions speaks the Streamable HTTP of 2025-11-25 and 2025-06-18 on the same endpoint: initialize mints an Mcp-Session-Id (a UUID), requests carrying it belong to that session and skip the header validation of 2026-07-28 (MCP-Protocol-Version is optional and must be a legacy version), notifications are dispatched, responses to server-initiated requests are accepted with 202, GET opens the session's stream (one per session, 409 for a second one) for list-changed and resource-updated notifications, DELETE ends the session, unknown or expired sessions answer 404. Errors of a session are JSON-RPC responses with status 200 (404 would end the client's session). Server-initiated requests go out on the SSE stream of the request that asked. Start-McpServer -SessionIdleTimeoutSeconds (default 1800) ends idle sessions without an open GET stream; -MaxSessions (default 100) answers further initialize requests with 503. A modern-only server keeps answering GET and DELETE with 405 and ignores Mcp-Session-Id. initialize with the per-request _meta of 2026-07-28 is a modern request for a removed method (404, -32601), as the 2026-07-28 conformance suite checks on the dual-era fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rvihdz4S9tqxJNrZGrX3qD
Connect-McpServer -Era Auto (default) probes with server/discover and falls back to the initialize handshake when the answer is neither a DiscoverResult nor an error only revision 2026-07-28 has (-32020, -32021, -32022), or when no answer arrives within five seconds; -Era Modern and -Era Legacy skip the detection. The era of an HTTP endpoint is remembered for later connections of the process. A legacy version given with -ProtocolVersion is requested in initialize. A legacy session sends no per-request _meta or headers of 2026-07-28 but the Mcp-Session-Id and the negotiated MCP-Protocol-Version, answers the server's elicitation, sampling, roots and ping requests with the existing callbacks (on stdio, on response streams and on the GET stream), sets the log level with logging/setLevel (new Set-McpLogLevel for both eras), maps subscriptions to unsolicited notifications and resources/subscribe with a GET stream reader over HTTP, initializes a new session after HTTP 404, resumes a response stream that ends before its response with GET and Last-Event-ID after the announced retry time, and sends DELETE on disconnect. 2025-03-26 is accepted from servers. Tests cover the compatibility matrix of client and server eras in memory, the legacy session over stdio, HTTP and in memory, and resumption against a mock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rvihdz4S9tqxJNrZGrX3qD
The fixture server is one dual-era instance for both requirement sets (-Era Dual|Modern|Legacy) with the tools and the resource of the 2025-11-25 scenarios; the fixture client detects the era and fills forms from schema defaults. The Conformance task and workflow run 2026-07-28 and 2025-11-25: all scored server scenarios of both sets pass; on the client side initialize, tools_call, elicitation-sep1034-client-defaults and sse-retry pass, and the baseline still holds only the authorization scenarios (M6). Legacy HTTP clients open the session's GET stream after initialize, as the TypeScript SDK does, because servers send requests that belong to no client request there; the stream is read without blocking on the caller's thread, also while a request waits for its response, instead of in a background runspace (whose module import competed with the timing of sse-retry). Resumption prepares the GET before the announced retry time and sends it then. GET streams use Connection: close on both sides: the managed HttpListener reset the connection of a stream that ended while the client still read it when the next request reused it. Docs: dual-era concept, transports, conformance state after M5, development, README, about help, ROADMAP (M5 done, exit criterion: server 30/30, client 4/4 outside authorization) and the implementation plan with the corrections and deviations of M5; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rvihdz4S9tqxJNrZGrX3qD
Contributor
Author
|
CI on The one failing test is This does not look caused by this PR:
Likely cause: http.sys buffers the keep-alive chunks, so a write to a client that has already gone does not fail reliably within the test window. No fix exists yet. Next steps:
Generated by Claude Code |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Milestone M5 Dual era (ROADMAP.md). One server process or endpoint now serves the stateless 2026-07-28 core and the
initializehandshake of 2025-11-25 and 2025-06-18 side by side. 2025-03-26 is accepted as a version string. The client detects which era a server speaks and falls back to the handshake when needed.Server
New-McpServer -SupportedVersionsnow defaults to2026-07-28, 2025-11-25, 2025-06-18. The era follows from this list; there is no separate-Eraparameter.2026-07-28makes the server modern-only. It then answersinitializewith-32022and its supported versions.initializewith-32600.Get-McpMessageErainEra.ps1:_metacarries the 2026-07-28 protocol version is modern. This includesinitialize, which then gets 404 and-32601as a removed method; the 2026-07-28 suite checks exactly that.initializewithout that_metaopens a legacy session.Mcp-Session-Id(HTTP) or to the process-wide session (stdio).LegacySession.ps1handles the legacy session:ping,logging/setLevel,resources/subscribeandresources/unsubscribe;Request-McpElicitation,Request-McpSamplingandRequest-McpRootblock in a legacy session until the answer arrives, instead of throwing to start an input round.resultType,ttlMs,cacheScopeorio.modelcontextprotocol/keys in_meta. An unknown resource becomes-32002via the newMcpResourceNotFoundException.initializereturns anMcp-Session-Id.Connection: close); DELETE ends the session; an unknown or expired session gets 404.Start-McpServer -SessionIdleTimeoutSeconds(default 1800) and-MaxSessions(default 100, then 503) bound the sessions.Client
Connect-McpServer -Era Auto|Modern|Legacy(default Auto) probes withserver/discover:-32020/-32021/-32022means modern;initialize: another error, no answer within 5 s, an HTTP error without a JSON-RPC body, or a result that is not a DiscoverResult.Mcp-Session-Idand the negotiatedMCP-Protocol-Versioninstead of the per-request headers and_meta;initializeand reads it on the caller's thread without blocking, also while one of its own requests waits for a response;Last-Event-IDafter the announcedretrytime;Set-McpLogLevel, for both eras.Conformance
-Era Dual|Modern|Legacy) and has the 2025-11-25 tools.Conformancetask and the workflow now run both requirement sets.server-session-lifecycleinitialize,tools_call,elicitation-sep1034-client-defaults,sse-retryconformance-baseline.ymlkeeps only the authorization scenarios (M6). They count toward both requirement sets.Corrections to the plan, documented in
docs/implementation-plan.md§7 andROADMAP.md:auth/*and belong to M6.sse-retryis scored, so the client resumes interrupted streams. Server-side resumability stays out of scope;server-sse-pollingis still marked pending in the suite.-32042is not used; the blocking server-initiated request replaces it.Known risk: the suite starts all client scenarios at once, and
sse-retryallows the reconnect only +200 ms. Under heavy load it can be flaky. Locally, under the suite's concurrency, I measured 510 to 631 ms against a target of 500 ms. That is why the legacy GET stream no longer runs in a background runspace.Checklist
./build.ps1 -Task CIpasses locally (Analyze, Test, Package, PublishLocal). Pester: 556 passed, 5 skipped, on PowerShell 7.4.20 / Linux. ModuleBuilder was stood in for locally because the PowerShell Gallery was not reachable from the environment; CI uses the real one.Era.Tests.ps1, legacy status mapping, SSEid/retry;LegacyServer.Tests.ps1,LegacyHttp.Tests.ps1, andLegacyClient.Tests.ps1, which includes the compatibility matrix client Auto/Modern/Legacy × server modern-only/legacy-only/dual and resumption against a mock.CHANGELOG.mdhas an entry under[Unreleased]conformance-baseline.ymlis unchanged in content; only its comment was updated.docs/concepts/dual-era.md,transports.md,conformance.md,development.md, README, about help, ROADMAP, implementation plan.Also checked against the Inspector CLI in its default legacy mode:
tools/listandtools/callwork over stdio and over Streamable HTTP.🤖 Generated with Claude Code
https://claude.ai/code/session_01Rvihdz4S9tqxJNrZGrX3qD
Generated by Claude Code