From 9c30fa4cdea19bf652e90cac6556c5c3b88cb0e6 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 05:18:47 -0600 Subject: [PATCH 1/7] docs(mcpx): disposition section A of the revision-conflicts register (#1974) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sweep of the 54 Undisposed items in docs/spec/revision-conflicts.md (task 14963), section A (lifecycle/versioning): all 10 items verified against current code and re-dispositioned with site evidence — C2 recorded reading (client request IDs are a monotonic atomic counter, never reused), C6 recorded reading (finishLegacy aborts with UnsupportedVersionError: the schema MUST in effect), C7 peer-settled (advertised-capability gate #2436), C9 recorded reading (fixed named _meta keys taken at face value), C16 peer-settled (peerFor builds caps per request on the modern path), C18 peer-settled (cancelled(): modern HTTP cancels by stream close), C10 recorded reading (emissions audit: no server -32000..-32019), C12 peer-settled (withMeta always sends required _meta; server missingMeta rejects), C14 recorded reading (probe judge(): any non-modern 4xx is legacy), C22 recorded reading (resultType lenient fall-through in mcpspec validation). No code changes: every behaviour was already implemented; the register now records it. Sections B-E and headline items remain (44 Undisposed mentions incl. legend). --- pkgs/mcpx/docs/spec/revision-conflicts.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index 5f1371c8f2..95a0a1a143 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -73,7 +73,7 @@ instead of a silent choice. - Effect: a batch is mandatory-to-accept only for 2025-03-26. A server serving 2025-03-26 and 2025-06-18 cannot know the version before parsing, so it has to accept arrays on the wire anyway (the version is inside the elements). mcpx rejects arrays (-32700). **C2. Request-ID uniqueness scope.** -- **Disposition:** Undisposed — open question: does mcpx's client reuse request IDs after completion on a 2026-07-28 connection, and can a stale `subscriptions/listen` notification then collide with a new listen reusing the ID? No site verified in Phase 1; check request-ID allocation in internal/mcpclient. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep): mcpx's client never reuses request IDs. Every allocation is `nextID.Add(1)` on a monotonic `atomic.Int64` (internal/mcpclient/client.go:79, :1328; listen.go:145; probe.go:74), so the stricter legacy rule (never reuse within a session) holds on every era and the 2026 relaxation is simply not exercised; a stale listen notification cannot collide with a later listen, whose ID is always fresh. - 2024-11-05..2025-11-25: "The request ID **MUST NOT** have been previously used by the requestor within the same session." https://modelcontextprotocol.io/specification/2025-11-25/basic/index#requests - 2026-07-28: "The request ID **MUST NOT** match the ID of any other request the sender has issued and not yet received a response for." https://modelcontextprotocol.io/specification/2026-07-28/basic/index#requests - Reuse after completion is legal in 2026, illegal in legacy. Internal tension in 2026: changelog item 9 says a broken stream's request must be re-issued "as a new request with a new request ID" (https://modelcontextprotocol.io/specification/2026-07-28/changelog#major-changes), and `subscriptionId` is "the JSON-RPC ID of the `subscriptions/listen` request" (schema NotificationMetaObject) — with reuse legal once a listen ends, a stale notification can carry an ID now used by a different listen. @@ -98,19 +98,19 @@ instead of a silent choice. - The example is a server doing what the MUST forbids. 2026 then standardises that example's shape under -32022 for modern requests only. mcpx now follows the legacy MUST: `negotiate()` (internal/mcpserver/server.go) counter-offers a supported version (its latest when the request is unknown or modern); `-32022` is used only for modern `_meta`-versioned requests, as 2026 specifies. (When this item was recorded, mcpx returned -32022 on legacy `initialize` too.) **C6. Client on an unsupported negotiated version: SHOULD vs MUST (prose vs schema, 2024-11-05..2025-11-25).** -- **Disposition:** Undisposed — open question: when a server negotiates a version mcpx's client cannot support, does the client disconnect (prose SHOULD) or treat disconnect as mandatory (schema MUST)? No site verified in Phase 1; check the client negotiation path in internal/mcpclient. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep): the schema's MUST is what the code does. `finishLegacy` (internal/mcpclient/client.go) returns `UnsupportedVersionError` when the answered version is not in `LegacyVersions` — the handshake aborts, no `notifications/initialized` is sent, and the connection is not used; the code comment cites the prose SHOULD and follows the stricter reading ("Carrying on would mean speaking a revision nobody agreed to"). The modern path agrees: `probe` errors out when `newestMutual` finds no shared version (internal/mcpclient/probe.go). - Prose: "If the client does not support the version in the server's response, it **SHOULD** disconnect." https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#version-negotiation - Schema `InitializeResult.protocolVersion`: "If the client cannot support this version, it MUST disconnect." https://modelcontextprotocol.io/specification/2025-11-25/schema#initializeresult - Unchanged in all four legacy revisions. **C7. Using un-negotiated capabilities: SHOULD → MUST (2025-06-18).** -- **Disposition:** Undisposed — open question: does mcpx's server refuse a capability-gated method the peer never negotiated on a 2026-07-28 request (the MethodNotFoundError comment's reading), or does its accept-liberally rule apply across eras? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep): the advertised-capability gate (#2436, Phase 2 of #2434; internal/mcpserver/server.go) refuses a gated method with `-32601` (method-not-found) when its gating capability was not in the advertisement governing that peer and era — the snapshot taken at initialize for a legacy peer, `capabilities()` computed per request for a modern one. The gated set is deliberately the two proven advertisement/dispatch disagreements (completion/complete, resources/subscribe|unsubscribe); widening needs its own evidence per #2434. Outside the gated set the accept-liberally rule still applies, so the 2026 comment's reading holds exactly where a disagreement was proven. - 2024-11-05, 2025-03-26: "Both parties **SHOULD**: … Only use capabilities that were successfully negotiated" https://modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle#operation - 2025-06-18, 2025-11-25: "Both parties **MUST**: …" https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#operation ; changelog "Change **SHOULD** to **MUST** in Lifecycle Operation". - A server *accepting* an un-negotiated method (mcpx's accept-liberally rule) is not clearly "using" a capability; a *client* calling one clearly is. The 2026 MethodNotFoundError comment ("or one gated behind a server capability the server did not advertise") says the server should refuse such calls — https://modelcontextprotocol.io/specification/2026-07-28/schema#methodnotfounderror — contradicting accept-liberally for 2026. **C9. Reserved `_meta` prefixes changed incompatibly (2025-06-18 → 2025-11-25).** -- **Disposition:** Undisposed — open question: does mcpx validate or generate `_meta` prefixes per era, and would a 2025-06-18 peer's legal `io.modelcontextprotocol/` data be misread as protocol data? No site verified in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep): mcpx neither validates `_meta` prefixes per era nor varies the prefixes it generates by era. It reads and writes the fixed named 2026 protocol keys (`io.modelcontextprotocol/protocolVersion`, `/clientCapabilities`, `/clientInfo`, `/serverInfo`, `/subscriptionId`, `/logLevel`, `/related-task`; internal/mcpserver/conn.go, listen.go) and takes them at face value wherever they appear — `requestVersion` (internal/mcpserver/server.go) trusts the protocolVersion key on any request. A 2025-06-18 peer's own data under those exact keys would be read as protocol data, but a legacy peer declares its version at initialize, not in `_meta`; stamping the protocol keys is itself the modern declaration, so the face-value reading is the recorded choice. - 2025-06-18: "Any prefix beginning with zero or more valid labels, followed by `modelcontextprotocol` or `mcp`, followed by any valid label, is **reserved** … `modelcontextprotocol.io/`, `mcp.dev/`, `api.modelcontextprotocol.org/`, and `tools.mcp.com/` are all reserved." https://modelcontextprotocol.io/specification/2025-06-18/basic/index#meta - 2025-11-25+: "Any prefix where the second label is `modelcontextprotocol` or `mcp` is **reserved** … `io.modelcontextprotocol/` … However, `com.example.mcp/` is NOT reserved" https://modelcontextprotocol.io/specification/2026-07-28/basic/index#meta - `io.modelcontextprotocol/` — the prefix of every 2026 protocol key — is **not** reserved under the 2025-06-18 rule (nothing follows `modelcontextprotocol`), so a 2025-06-18 implementation could legally have used it for its own data. Conversely `modelcontextprotocol.io/` and `tools.mcp.com/` are reserved in 2025-06-18 and free in 2025-11-25. @@ -127,7 +127,7 @@ instead of a silent choice. - 2026-07-28: "All implementations **MUST** support the base protocol, versioning, and the message patterns." — and `initialize` is an unknown method to a modern-only server. https://modelcontextprotocol.io/specification/2026-07-28/basic/index **C16. Where capabilities live, and whether they persist.** -- **Disposition:** Undisposed — open question: does any modern-path handler read capabilities stored from an earlier request on the same connection, contrary to the 2026 statelessness rule? Legacy session state is era-correct; no modern-path site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep): no modern-path handler reads stored capabilities. `peerFor` (internal/mcpserver/conn.go) builds the governing `Peer` per request: a request carrying an `_meta` version gets its capabilities from that request's own `clientCapabilities` (`requestCapabilities(params)`); connection-stored caps (`SetCapabilities`, from the legacy handshake) are consulted only when the request declares no `_meta` version — the legacy path, where remembering is required. The `Peer` type comment records the rule: modern "forbids a server from remembering the last one". - Legacy: capabilities "establish which optional protocol features will be available during the session" https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#capability-negotiation - 2026: "Servers **MUST NOT** rely on prior requests … (e.g., capabilities, protocol version, client identity)" and schema "Servers MUST NOT infer capabilities from prior requests." https://modelcontextprotocol.io/specification/2026-07-28/basic/index#statelessness - Remembering caps is required in one era and forbidden in the other; a dual-era server must key the rule off the request, not the connection. @@ -139,7 +139,7 @@ instead of a silent choice. - mcpx's discover answer now uses the 2026 placement: `supportedVersions` in the result and `serverInfo` in `_meta` (added by the envelope to every modern result). The discover result also carries `ttlMs`/`cacheScope`, added by the modern envelope as for every cacheable result (headline 12). **C18. Timeouts relocated and reworded.** -- **Disposition:** Undisposed — open question: on a 2026-07-28 HTTP request, does mcpx's sender cancel a timed-out request by closing the stream rather than sending `notifications/cancelled`? The relocation makes the two eras' timeout behaviour differ; no timeout-path site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep): yes — the era split is implemented in `Client.cancelled` (internal/mcpclient/modern.go). Over modern Streamable HTTP the client sends no `notifications/cancelled` at all (closing the response stream is the cancellation, and the caller's context has already closed it); on legacy transports and modern stdio (where it is a MUST) the notification is sent. Timeouts take the same path, with the reason preserved (`cancelReason`: a deadline reports "timeout", PC-08/#1924). - 2025-03-26..2025-11-25 lifecycle: "the sender **SHOULD** issue a cancellation notification for that request" https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#timeouts - 2026-07-28 cancellation page: "the sender **SHOULD** cancel the request and stop …" https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/cancellation#timeouts (cancellation owner has the details; the change matters because on HTTP 2026 cancellation is closing the stream, not a notification). @@ -149,13 +149,13 @@ instead of a silent choice. - **Disposition:** Recorded reading — the literal reading is recorded: the sentence restricts requests, so notifications before `initialized` are not restricted by it, whatever the drafters intended by "logging". **C10. -32000..-32019: "legacy" (prose) vs "implementation-defined" (schema), 2026-07-28.** -- **Disposition:** Undisposed — open question: does mcpx emit any code in `-32000..-32019` of its own on a 2026-07-28 request (prose: SHOULD NOT; schema/changelog: grandfathered)? No emissions audit done in Phase 1. +- **Disposition:** Recorded reading — audited 2026-11-11 (#1974 sweep): mcpx's server emits no code in `-32000..-32019` on any era. The server's `-320xx` emissions are `-32002` (legacy resource-not-found, era-keyed — item C11), `-32020`/`-32021`/`-32022` (2026 spec-defined), and `-32042` (2025-11-25 era; see section E spec-internal item 2 for its server-side gap). The only `-32000` in the codebase is client-local and synthesized — `codeStreamLost` and the receive loop's "connection closed" (internal/mcpclient) — errors mcpx's client reports to its own host about a dead transport, never an answer sent to a peer, so the prose SHOULD NOT is satisfied where it binds and no grandfathering is needed. - Prose: "**`-32000` to `-32019` — legacy.** … new implementations **SHOULD NOT** use codes from this sub-range at all." https://modelcontextprotocol.io/specification/2026-07-28/basic/index#error-codes - Schema comment: "`-32000` to `-32019`: implementation-defined. Existing SDKs and implementations use codes here for their own purposes; the specification will never define codes in this sub-range" — no SHOULD NOT. Changelog item 12: "`-32000` to `-32019` remains implementation-defined (existing SDK usage is grandfathered)". https://modelcontextprotocol.io/specification/2026-07-28/changelog#minor-changes - Also prose "Apart from `-32002` … receivers **MUST NOT** assume any specific meaning" — but -32002 is in the legacy sub-range, and the same page tells clients to accept it as resource-not-found: a single spec-assigned meaning inside a range the schema says "the specification will never define codes in". **C12. Request `params` optional (prose/type) vs required `_meta` (schema), 2026-07-28.** -- **Disposition:** Undisposed — open question: does mcpx's client ever send a params-less 2026-07-28 request, and does its server reject a 2026 request whose `_meta` lacks the required fields? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep): both halves hold in code. The modern client always sends params carrying the required `_meta`: `withMeta` (internal/mcpclient/modern.go) builds the params object (from empty/null if needed) and sets `protocolVersion`, `clientCapabilities`, and `clientInfo` on every modern request. The server rejects the mirror case: a modern request missing a required `_meta` field gets the `missingMeta` answer (internal/mcpserver/transport.go), and `-32602` maps to HTTP 400. - basic/index shows `params?: { [key: string]: unknown }` for requests. https://modelcontextprotocol.io/specification/2026-07-28/basic/index#requests - Schema `RequestParams { _meta: RequestMetaObject }` with required `protocolVersion`/`clientCapabilities`; "fields marked as required **MUST** be included on every request". So every 2026 request has `params`, including ones legacy defined without params. The generic `Request.params?` is kept "to allow unofficial extensions". @@ -166,7 +166,7 @@ instead of a silent choice. - stdio page: legacy servers answer pre-initialize probes "commonly `-32601` or `-32602`". Unknown-method (-32601) and malformed (-32602) are both reachable; the MUST picks one, the matrix says either. **C14. HTTP era detection: `400` vs `4xx`, 2026-07-28.** -- **Disposition:** Undisposed — open question: which statuses trigger mcpx client era fallback — only `400` (binding page) or any `4xx` without a recognised modern error body (matrix)? See also section B item C9. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep): the matrix governs. In `judge` (internal/mcpclient/probe.go), a reply to `server/discover` carrying a recognised modern error is judged modern whatever the status; any other 4xx (400–499) is `isLegacy` — "A 4xx that is not a recognised modern error is how a legacy Streamable HTTP server rejects a request it does not understand" — while a 5xx concludes nothing about the era (`isFatal`, nothing cached). See also section B item C9. - Streamable HTTP: "On `400 Bad Request`, the client **SHOULD** inspect the response body before falling back" https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http#backward-compatibility - Versioning matrix (Dual-era/Legacy): "the modern request returns a `4xx` without a recognized modern error body, and the client falls back" https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning#compatibility-matrix - A legacy 2025-03-26..2025-11-25 server answering a session-less non-initialize POST commonly returns 400 or 404 (session required / unknown session); the binding page only covers 400. @@ -188,7 +188,7 @@ instead of a silent choice. - schema CancelledNotification: "On stdio, the server also sends this notification, solely to terminate a `subscriptions/listen` stream" and CancelledNotificationParams.requestId "MUST correspond to the ID of a request the client previously issued" — a server-sent cancel that refers to the client's request, i.e. not "scoped to" a request it is answering but terminating it. (Cancellation/subscriptions owners hold the full version of this.) **C22. `resultType` unknown-value rule vs open type, 2026-07-28.** -- **Disposition:** Undisposed — open question: how does mcpx's client treat an unrecognised `resultType`, and an absent one on a response to a request that carried `protocolVersion: 2026-07-28`? No site verified in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep): mcpx follows the schema's open type over the basic page's MUST. In response validation (internal/mcpspec/message.go), `resultType` is a discriminator only for the two shapes mcpx must tell apart — `input_required` validates as InputRequiredResult and `task` is an extension error; any other value, recognised or not, and an absent `resultType` alike fall through to validation against the method's own result definition (an absent field therefore behaves as `complete`). An unrecognised `resultType` whose payload matches the method's result is accepted, contrary to the basic page's "MUST be considered invalid"; the lenient reading is recorded here rather than silently chosen. - basic/index: "A `resultType` of any value unrecognized by the client **MUST** be considered invalid." https://modelcontextprotocol.io/specification/2026-07-28/basic/index#resulttype - schema: `type ResultType = "complete" | "input_required" | string;` and "Servers implementing this protocol version MUST include this field. For backward compatibility, when a client receives a result from a server implementing an earlier protocol version … the client MUST treat the absent field as `\"complete\"`." A client cannot tell a pre-2026 server from a 2026 server that forgot the field, and on a response to a request that carried `protocolVersion: 2026-07-28` the server by definition is not "implementing an earlier protocol version" — yet the only rule given is absent ⇒ complete. From df13292d860cca79e5dc239e7210fae8a5e3a14f Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 07:30:04 -0600 Subject: [PATCH 2/7] =?UTF-8?q?docs(mcpx):=20correct=20C22=20disposition?= =?UTF-8?q?=20=E2=80=94=20client=20rejects=20unknown=20resultType=20end-to?= =?UTF-8?q?-end=20(Codex=20PR=20#8652)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/mcpx/docs/spec/revision-conflicts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index 95a0a1a143..d5262e2313 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -188,7 +188,7 @@ instead of a silent choice. - schema CancelledNotification: "On stdio, the server also sends this notification, solely to terminate a `subscriptions/listen` stream" and CancelledNotificationParams.requestId "MUST correspond to the ID of a request the client previously issued" — a server-sent cancel that refers to the client's request, i.e. not "scoped to" a request it is answering but terminating it. (Cancellation/subscriptions owners hold the full version of this.) **C22. `resultType` unknown-value rule vs open type, 2026-07-28.** -- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep): mcpx follows the schema's open type over the basic page's MUST. In response validation (internal/mcpspec/message.go), `resultType` is a discriminator only for the two shapes mcpx must tell apart — `input_required` validates as InputRequiredResult and `task` is an extension error; any other value, recognised or not, and an absent `resultType` alike fall through to validation against the method's own result definition (an absent field therefore behaves as `complete`). An unrecognised `resultType` whose payload matches the method's result is accepted, contrary to the basic page's "MUST be considered invalid"; the lenient reading is recorded here rather than silently chosen. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep; corrected the same day on Codex review of PR #8652, which caught that the first verification stopped at the schema validator): end-to-end, mcpx follows the basic page's MUST, not the schema's open type. In response validation (internal/mcpspec/message.go), `resultType` is a discriminator only for the two shapes mcpx must tell apart — `input_required` validates as InputRequiredResult and `task` is an extension error; any other value, recognised or not, falls through to validation against the method's own result definition. But the validator is not the final acceptance decision: on the modern client path, `Client.callReissue` (internal/mcpclient/client.go, the resultType switch) returns `InvalidResultError` for any unrecognised `resultType` — covered by `TestResultType`'s `resulttype-unknown-invalid` subtest (internal/mcpclient/conformance_client_test.go), which expects `"partial"` to be rejected. An absent `resultType` still behaves as `complete` at both layers. So the conflict resolves in favour of the basic page at the client layer; the schema's open type survives only as the validator's shape rule. - basic/index: "A `resultType` of any value unrecognized by the client **MUST** be considered invalid." https://modelcontextprotocol.io/specification/2026-07-28/basic/index#resulttype - schema: `type ResultType = "complete" | "input_required" | string;` and "Servers implementing this protocol version MUST include this field. For backward compatibility, when a client receives a result from a server implementing an earlier protocol version … the client MUST treat the absent field as `\"complete\"`." A client cannot tell a pre-2026 server from a 2026 server that forgot the field, and on a response to a request that carried `protocolVersion: 2026-07-28` the server by definition is not "implementing an earlier protocol version" — yet the only rule given is absent ⇒ complete. From 03a08d835f06fc9d00838643cbe62e770804513d Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 07:39:13 -0600 Subject: [PATCH 3/7] docs(mcpx): disposition section B of the revision-conflicts register (#1974) --- pkgs/mcpx/docs/spec/revision-conflicts.md | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index d5262e2313..c19de88792 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -210,18 +210,18 @@ C2. **JSON-RPC batching: required-to-accept in 2025-03-26, removed 2025-06-18.** - 2024-11-05 transports page is silent on batching (JSON-RPC 2.0 allows it). C3. **Relatedness of messages on a POST's SSE stream: SHOULD → MUST.** -- **Disposition:** Undisposed — open question: does mcpx's server scope every notification on a POST's SSE stream to the originating request on a 2026-07-28 connection (MUST), and only by default on legacy (SHOULD)? No site verified in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B): yes, by construction in both eras. Request handling is bound to that POST's own exchange sender (`withSender(ctx, ex.send)` in serveModern/serveLegacy, internal/mcpserver/server.go), so a notification emitted while handling a request can only go on that request's stream; there is no code path that writes an unrelated notification to a POST exchange. Session-level notifications take the other home: `streamPush` (internal/mcpserver/transport.go) writes only to the session's GET stream and drops the message when none is open — mcpx keeps no redelivery buffer and never reroutes one onto a POST stream. On modern connections the unrelated-message home is `subscriptions/listen`, as the 2026 text prescribes. - 2025-11-25: "These messages **SHOULD** relate to the originating client _request_." (#sending-messages-to-the-server) - 2026-07-28: "These notifications **MUST** relate to the originating client request." (#receiving-messages). Unrelated server messages have no home except `subscriptions/listen`. C4. **Closing a POST SSE stream before the response.** -- **Disposition:** Undisposed — open question: per era, when may mcpx's server close a POST SSE stream before the response — is the 2025-11-25 connection/stream distinction implemented, and is early close on 2026 treated as losing the request? No site verified in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B): mcpx's server never closes a POST SSE stream before the response, in any era, and the 2025-11-25 connection/stream distinction is not implemented — its precondition (resumability) is absent server-side: SSE frames are written with no event IDs (`eventStream.write`, internal/mcpserver/transport.go, `data:` only) and there is no replay buffer. `finish` (internal/mcpserver/server.go) ends a streaming exchange only by sending the response on it ("The stream carried the questions; it carries the answer too, and then ends"). So early close happens only when the client goes away, which is the cancellation/lost-request case of item C6 — on 2026 exactly the prescribed semantics; on legacy a client may resume against other servers, but an mcpx POST stream carries no ID to resume from. - 2025-03-26..2025-06-18: "The server **SHOULD NOT** close the SSE stream before sending the JSON-RPC _response_ ... unless the session expires." — https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#sending-messages-to-the-server - 2025-11-25: "the server **MAY** close the _connection_ (without terminating the _SSE stream_) at any time" (after an event id) — https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#sending-messages-to-the-server . Legal only via the connection/stream distinction, which requires resumability. - 2026-07-28: no resumability, and closing the stream **is** cancellation (C6), so a server can no longer close early without losing the request. C5. **Resumability / `Last-Event-ID` / event IDs: optional 2025-03-26..2025-11-25 (with priming SHOULD in 2025-11-25), removed 2026.** -- **Disposition:** Undisposed — legacy resumability is implemented on the client (GET resume with `Last-Event-ID`, internal/mcpclient/http.go:332, :407); open question: does the modern path ignore `Last-Event-ID` as the 2026 backcompat text prescribes? No modern-path site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section B): the modern path never resumes and never sends `Last-Event-ID`. In the HTTP transport's SSE loop (internal/mcpclient/http.go), a broken modern stream goes straight to `lost(reqID)` ("2026-07-28 has no resumption: a broken response stream loses the in-flight request"); `resume()` with its GET + `Last-Event-ID` (internal/mcpclient/http.go, `get`) is reachable only for legacy frames. The conformance suite asserts the negative: no request of a modern session carries a `Last-Event-ID` header (internal/conformance/transport_test.go, `streamable-http-no-resumability`). Server-side, GET is a legacy session's notification stream only; a modern-versioned GET is refused 405 (internal/mcpserver/transport.go, serveGET). - 2025-11-25: "The server **SHOULD** immediately send an SSE event consisting of an event ID and an empty `data` field" ; "Resumption is always via HTTP GET with `Last-Event-ID`." — #resumability-and-redelivery - 2026-07-28: "Resumable SSE streams via `Last-Event-ID` are not supported." (#receiving-messages); modern-only server "SHOULD" ignore `Last-Event-ID` (#earlier-streamable-http-revisions). @@ -238,24 +238,24 @@ C7. **HTTP 404 meaning.** - Also a change against JSON-RPC-over-HTTP practice in 2025-*, where a method-not-found error was an ordinary response (status not specified; in practice 200). C8. **Missing `MCP-Protocol-Version` header.** -- **Disposition:** Undisposed — open question: does mcpx assume `2025-03-26` for a header-less legacy request (2025-06-18..2025-11-25 SHOULD) and reject a header-less 2026 request as a header mismatch (`-32020`)? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section B): both halves, exactly as the texts prescribe. Era routing (internal/mcpserver/server.go, the POST handler) sends a request to the modern path only when its body `_meta` names a protocol version or its header names a modern one; everything else is legacy, where serveLegacy records "Absent means 2025-03-26, or whatever the session negotiated". A request that lands on the modern path without the header is rejected by `checkModernHeaders` (internal/mcpserver/transport.go) with `headerMismatch` — code `-32020`, "MCP-Protocol-Version header is required". - 2025-06-18..2025-11-25: server "**SHOULD** assume protocol version `2025-03-26`" — https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#protocol-version-header - 2026-07-28: "**MAY** treat a request that omits the header as protocol version `2025-03-26`. A server that does not support such clients **MUST** reject a request without the header" (#protocol-version-header); Server Validation lists a missing `MCP-Protocol-Version` as a HeaderMismatch failure (#server-validation) → 400/-32020. Also 2025-11-25: "invalid or unsupported" header → 400 with no body format; 2026: unsupported → 400 + `UnsupportedProtocolVersionError`, mismatch → 400 + `HeaderMismatch`. - 2025-06-18 header rule applies to "all subsequent requests" (after initialize); 2026: "Every POST request". C9. **HTTP+SSE fallback trigger narrowed twice.** -- **Disposition:** Undisposed — open question: which status/body combinations make mcpx's client fall back to HTTP+SSE against each era's rule, including the 2026 recognised-modern-error-body condition? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section B): the fallback trigger is `legacyHTTPRefusal` (internal/mcpclient/probe.go): a legacy `initialize` failure converts to `LegacyHTTPRefusedError` — the signal to try the deprecated HTTP+SSE transport next (internal/pool/pool.go constructs `LegacySSETransport` on it) — only when the status is 400, 404, or 405 (the 2025-11-25 list) AND the body carries no JSON-RPC error at all (`he.rpc != nil` disqualifies). A recognised modern error body therefore never triggers the fallback, which is the 2026 condition; a 2025-03-26-era bare 4xx refusal still does. Era judging proper is the separate probe `judge` (see section A item C14). - 2025-03-26..2025-06-18: "If it fails with an HTTP 4xx status code (e.g., 405 Method Not Allowed or 404 Not Found)" — https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#backwards-compatibility - 2025-11-25: "\"400 Bad Request\", \"404 Not Found\" or \"405 Method Not Allowed\"" — https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#backwards-compatibility (401/403 no longer trigger it — matters for OAuth-protected servers). - 2026-07-28: those codes "**and** the response body is not a recognized modern JSON-RPC error" — https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http#httpsse-transport-2024-11-05 . A 2025-11-25-rule client probing a modern-only 2026 server gets 400 (missing headers → HeaderMismatch) and then GETs, gets 405, and fails with a misleading diagnosis. C10. **Re-issue-after-broken-stream MUST lives only in the changelog.** -- **Disposition:** Undisposed — open question: does mcpx's client re-issue a request lost to a broken modern stream under a new request ID, and does it guard non-idempotent `tools/call` re-issue? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section B): yes to both, and the changelog's MUST is implemented even though the transport page never states it. `roundTrip` (internal/mcpclient/client.go) re-issues a modern-era request exactly once, with a fresh ID, when its response stream broke unanswered (`isStreamLost` — the transport's own marked `-32000`, never a server-sent one); a second stream-lost surfaces, and a caller cancellation is never re-issued. `tools/call` is guarded: re-issue is allowed only when the tool's retained list-time annotations declare `readOnlyHint` or `idempotentHint` (`toolCallReissueAllowed`); an unknown or unannotated tool closes the gate, because re-issuing could execute it twice. Every other method re-issues automatically. - Changelog major 9: "clients **MUST** re-issue it as a new request with a new request ID" — https://modelcontextprotocol.io/specification/2026-07-28/changelog - Transport page only: "Resumable SSE streams via `Last-Event-ID` are not supported." — no MUST; stdio page: "in-flight requests are simply lost and the client can retry them" (no keyword) — https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio#unexpected-termination . Also re-issuing a non-idempotent `tools/call` is not qualified anywhere. C11. **Notification POSTs in 2026 have no defined header requirements, yet all POSTs need them.** -- **Disposition:** Undisposed — open question: what header requirements does mcpx apply to notification POSTs from a 2026-07-28 peer, given the revision defines none? No site verified in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B): mcpx takes the MUST side of the contradiction. `checkModernHeaders` (internal/mcpserver/transport.go) requires `MCP-Protocol-Version` on every modern POST, notifications included — its own comment records the split: "Notification POSTs have no header requirements in 2026-07-28; what a client did send must still agree." So `Mcp-Method`/`Mcp-Name` are required only of requests, but any header a notification does carry must mirror its body, and a modern notification (one whose body `_meta` names the version, which is what routes it to the modern path) without the version header is a `-32020` mismatch. As a client, mcpx mirrors headers on every modern frame it sends, notifications included (`setHeadersFor`, internal/mcpclient/http.go). - "The client **MUST** include the request metadata headers on each POST request." / "Every POST request to the MCP endpoint **MUST** include an `MCP-Protocol-Version` header." vs Note: "header requirements for notification POSTs are not defined by this revision." and `Mcp-Method` "Required For: All requests" — https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http#sending-messages . The same Note says no client→server notifications exist on HTTP in 2026 at all, while the rules for accepting them (202) remain. C12. **Server-sent `notifications/cancelled` for subscription teardown: scope disagreement (2026-07-28).** @@ -265,34 +265,34 @@ C12. **Server-sent `notifications/cancelled` for subscription teardown: scope di - schema.ts `SubscriptionsListenResult`: "signalling that the subscription has ended gracefully ... this result is sent only when the server tears the subscription down" — so graceful teardown has two mandated signals (a result response and a cancelled notification), and on stdio the notification is also the only server→client message the 2026 index's "server-sent _responses_ and _notifications_" permits beyond responses. The stdio page's list of "three kinds of messages" the server writes does not include a server-sent `notifications/cancelled`. (Detail belongs to the subscriptions/cancellation owner; recorded here because it is transport-scoped.) C13. **`MCP-Protocol-Version` header in 2025-03-26 authorization before the transport defines it.** -- **Disposition:** Undisposed — open question (spec-internal/historical): does mcpx send `MCP-Protocol-Version` on authorization discovery requests while omitting it on 2025-03-26 MCP requests, as that era's own pages imply? mcpx's discovery surface was not audited in Phase 1. +- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section B): mcpx sends no authorization discovery requests at all (no well-known or metadata fetch exists in the client; see item C15), so the discovery half of the question never arises. The MCP-request half matches the era's implication by construction: the client sends `MCP-Protocol-Version` only from the 2025-06-18 floor up (`headerVersionFloor`, internal/mcpclient/http.go) — a frame negotiated to 2025-03-26 carries no version header. - 2025-03-26 authorization: "MCP clients _SHOULD_ include the header `MCP-Protocol-Version: ` during Server Metadata Discovery" with example `MCP-Protocol-Version: 2024-11-05` — https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#server-metadata-discovery-headers - 2025-03-26 transports page defines no such header; it arrives in 2025-06-18 (#protocol-version-header), whose backcompat rule assumes a header-less request is 2025-03-26 — i.e. a 2025-03-26 client following its own auth page sends a header on discovery but not on MCP requests. C14. **Dynamic Client Registration: SHOULD → MAY → deprecated.** -- **Disposition:** Undisposed — open question: does mcpx implement Dynamic Client Registration at all, and if so under which era's strength? Its authorization surface was not audited in Phase 1. +- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section B): mcpx implements no Dynamic Client Registration under any era's strength — there is no registration-endpoint code anywhere in the client — because it implements no OAuth flow at all: the `OAuth` config type (internal/mcpauth/mcpauth.go) exists so a configuration can express the flow and `mcpx doctor` can report what is missing, and its own comment records "The flow itself needs a browser and a callback listener and is not yet implemented" (`NeedsOAuth` is how a server requiring it is reported). A deprecated mechanism inside an unimplemented flow has no mcpx behaviour to disposition. - 2025-03-26..2025-06-18: "**SHOULD** support the OAuth 2.0 Dynamic Client Registration Protocol" — https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#dynamic-client-registration - 2025-11-25: "**MAY** support" — https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#dynamic-client-registration - 2026-07-28: "Dynamic Client Registration is deprecated." — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration#dynamic-client-registration . Yet 2026 adds a new MUST inside it (`application_type`). - 2026 security-considerations still links the proxy-consent MUST to "dynamically registered client" — a MUST scoped to a deprecated mechanism. C15. **Where the authorization server lives / discovery.** -- **Disposition:** Undisposed — open question: which discovery rule does mcpx's client follow per era — 2025-03-26 default paths or Protected Resource Metadata with path-inserted well-known URIs? Not audited in Phase 1. +- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section B): neither. mcpx's client performs no authorization-server discovery in any era: no Protected Resource Metadata fetch, no well-known URI construction, and no 2025-03-26 default-path fallback exists in the code (the only well-known handling in mcpx is the daemon's own unrelated surfaces). Authorization is configuration, not discovery: static bearer headers from `internal/mcpauth`, or a declared `OAuth` config that resolves to `NeedsOAuth` because the flow is unimplemented (item C14). - 2025-03-26: MCP server is (or fronts) the AS; "authorization base URL **MUST** be determined ... by discarding any existing `path` component"; default `/authorize`, `/token`, `/register` fallbacks **MUST** be used — https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization#authorization-base-url - 2025-06-18+: MCP server is a resource server only; clients "**MUST** use OAuth 2.0 Protected Resource Metadata for authorization server discovery" and no default-path fallback exists — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#overview . 2025-11-25+ uses path-inserted well-known URIs (keeps the path the 2025-03-26 rule discarded). C16. **Token acceptance subject.** -- **Disposition:** Undisposed — open question: where does mcpx validate token audience — authorization server or resource server — for each era? Not audited in Phase 1. +- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section B): nowhere, in any era — mcpx has no token-audience validation because it has no audience-bearing tokens. What it accepts is an opaque configured bearer: the daemon's `requireBearer` (internal/daemon/bearer.go) constant-time-compares the presented token against the configured one, and what it sends is the configured header from `internal/mcpauth` (whose `OAuth.Resource` is the RFC 8707 resource indicator a future flow would send, not a validation). With no JWT and no authorization server, there is no `aud` claim for either subject to check; the 2025-11-25 move of the MUST from AS to server changes nothing here. - 2025-06-18: "Authorization servers **MUST** only accept tokens that are valid for use with their own resources." — https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#token-handling - 2025-11-25+: "MCP servers **MUST** only accept tokens that are valid for use with their own resources." — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#token-handling C17. **`WWW-Authenticate` on 401.** -- **Disposition:** Undisposed — open question: does mcpx's server emit `WWW-Authenticate` on 401, publish Protected Resource Metadata at the well-known URI, or both? Not audited in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B): the header only. When a bearer token is configured, the daemon's `requireBearer` middleware (internal/daemon/bearer.go) — which guards every /v1 and /mcp route — answers an unauthenticated request 401 with `WWW-Authenticate: Bearer`. mcpx publishes no Protected Resource Metadata: no well-known route for it exists on the daemon or the MCP server. That satisfies the 2025-06-18 MUST and the header branch of the 2025-11-25+ "one of the following" rule. - 2025-06-18: "MCP servers **MUST** use the HTTP header `WWW-Authenticate` when returning a _401 Unauthorized_" — https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#authorization-server-location - 2025-11-25+: "MCP servers **MUST** implement one of the following discovery mechanisms" (header or well-known) — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/authorization-server-discovery#protected-resource-metadata-discovery-requirements . A 2025-06-18 client that only parses the header fails against a well-known-only 2025-11-25 server. C18. **Who accumulates scopes on step-up.** -- **Disposition:** Undisposed — open question: on an insufficient-scope step-up, does mcpx's client union previously granted scopes itself (2026 rule) or rely on the server including them (2025-11-25 recommendation)? Not audited in Phase 1. +- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section B): mcpx's client has no step-up handling to accumulate with: no `insufficient_scope` processing exists anywhere in the client, because the OAuth flow it would belong to is unimplemented (item C14). What exists is up-front configuration only — `OAuth.Scopes` are "requested up front" and the server's `WWW-Authenticate` challenge is recorded in `internal/mcpauth` as "authoritative at runtime", which is as far as the code goes. Neither era's accumulation rule is implemented or violated. - 2025-11-25 (server side): "**Recommended approach**: Include both existing relevant scopes and newly required scopes to prevent clients from losing previously granted permissions" ; client step 2 uses the Scope Selection Strategy — https://modelcontextprotocol.io/specification/2025-11-25/basic/authorization#runtime-insufficient-scope-errors - 2026-07-28: "servers are not required to include the client's previously granted scopes" ; "Scope accumulation across operations is a client-side responsibility" ; client step 2: "computing the union of the client's previously requested scope set and the scopes from the current challenge" — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#runtime-insufficient-scope-errors . A 2025-11-25 client against a 2026 server that emits per-operation scopes drops earlier grants. From 83d03d6a6653708e3c792c5ef5d9de7e4e01b959 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 07:49:34 -0600 Subject: [PATCH 4/7] =?UTF-8?q?mcpx:=20disposition=20headlines=207/9/13=20?= =?UTF-8?q?+=20section=20C=20C8/C10/C11=20(#1974)=20=E2=80=94=20render=20n?= =?UTF-8?q?on-object=20structuredContent=20for=20object-only=20hosts;=20re?= =?UTF-8?q?fuse=20non-augmented=20legacy=20calls=20to=20required=20tools?= =?UTF-8?q?=20with=20-32601?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/mcpx/docs/spec/revision-conflicts.md | 12 ++--- pkgs/mcpx/internal/mcpserver/revisions.go | 21 ++++++++ .../mcpserver/structured_downgrade_test.go | 54 +++++++++++++++++++ pkgs/mcpx/internal/mcpserver/tasks.go | 12 +++++ .../mcpserver/tasks_required_legacy_test.go | 32 +++++++++++ 5 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 pkgs/mcpx/internal/mcpserver/structured_downgrade_test.go create mode 100644 pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index c19de88792..2d01ddf66f 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -37,13 +37,13 @@ instead of a silent choice. 4. **Recorded reading** — the legacy MUST governs legacy `initialize`: `negotiate()` counter-offers a supported version; `-32022` applies to modern `_meta`-versioned requests only. See A/C5. 5. **Undisposed** — open question (#1481 decision): the client choke keeps `-32602` (internal/mcpclient/schemacheck.go, internal/daemon/callerr.go); should the serve seam era-split `isError` for >=2025-11-25 hosts while /v1 and the client API keep `-32602`? 6. **Peer-settled** — era-split codes in code: legacy `-32002` (internal/mcpserver/server.go, `codeResourceNotFoundLegacy`), 2026 `-32602`. -7. **Undisposed** — open question: `downgrade()` (internal/mcpserver/revisions.go) deletes `structuredContent` only for pre-2025-06-18; a non-object value to a 2025-06-18..2025-11-25 (object-only) host passes unchanged. Render into content, wrap, or error? Check the conformance rows first. +7. **Peer-settled (implemented)** — the conformance rows decided it (tools-structured-object-only: "downgrade must wrap/strip non-object values"; tools-structured-any-json: "must NOT send non-object structuredContent to 2025-06-18/2025-11-25 clients"), and `downgrade()` (internal/mcpserver/revisions.go) now does it in the established style of the pre-2025-06-18 case: a non-object `structuredContent` spelled for a 2025-06-18..2025-11-25 host is rendered into `content` as a text block and the field is removed — data preserved, forbidden shape never sent. Covered by `TestNonObjectStructuredContentIsRenderedForObjectOnlyHosts`. 8. **Peer-settled** — `nextPage` (internal/mcpclient/client.go): a missing cursor ends results in every revision; in 2026 an empty string is a valid cursor, not the end. -9. **Undisposed** — open question: the logging gate. The client relay gates on a requested level (internal/mcpclient/relay.go, `moreVerbose`); if no path relays upstream logs to a host that requested no level, this item is moot in the relay direction and should be closed saying so, with the site. +9. **Moot (relay direction)** — closed as the item itself proposed: no path relays upstream logs to a host that requested no level. `relayNotification` (internal/mcpclient/relay.go) delivers `notifications/message` only to relays with `LogLevel != ""` at or above the requested level, and the Relay contract records empty = "it asked for none, and OnMessage is never called"; upstream is not asked either — `beginRelay` stamps the `_meta` log level only when the host named one. See section C item C8. 10. **Peer-settled** — legacy session-404 re-initialisation is era-keyed in internal/mcpclient's legacy session recovery (internal/mcpclient/client.go:1138-1145): a session-carrying 404 re-initialises on the legacy path, a modern-era 404 surfaces; on the server side an unknown method on the modern path is answered 404 with `-32601` (internal/mcpserver/server.go:879). See section B item C7. 11. **Peer-settled** — `batchRefused` (internal/mcpserver/transport.go): batches are refused outside 2025-03-26, the one revision that mandates receiving them. 12. **Recorded reading** — the schema and caching page govern over the changelog's list: `server/discover` results are `CacheableResult`s, and mcpx implements it that way — the discover result (internal/mcpserver/server.go) emits `supportedVersions`, and the modern envelope adds `ttlMs`/`cacheScope` to it as to every cacheable result (server.go:762-763; covered by `TestModernEnvelope`). -13. **Undisposed** — both halves stay open, with the actual behaviour now recorded for one: cancelled-task finality (core vs extension) has no verified site (section C item C11), and the missing-required-task code (`-32601` vs `-32600`) is not implemented either way — a non-augmented call executes ordinarily (section C item C10, internal/mcpserver/tasks.go:237-245). +13. **Peer-settled** — both halves now era-split in code. Cancelled-task finality: the legacy path cancels sticky (`Store.CancelImmediate`, section C item C11) while the extension path cancels cooperatively (`CancelWithReason`). Missing-required-task: a non-augmented legacy call to a `taskSupport: "required"` tool is now refused `-32601` in `maybeTask` (internal/mcpserver/tasks.go) — the tool-level MUST over the error list's `-32600` (section C item C10). ## Headline items @@ -351,7 +351,7 @@ C21. **Header name casing drift.** 2025-03-26..2025-06-18 `Mcp-Session-Id`; 2025 - Schema: "The progress thus far. This should increase every time progress is made, even if the total is unknown." https://modelcontextprotocol.io/specification/2026-07-28/schema#progressnotificationparams . Lowercase, not RFC — treat prose as governing. **C8 — log messages without a requested level: MAY ≤2025-11-25 → MUST NOT 2026-07-28.** -- **Disposition:** Undisposed — headline 9: the client relay gates on a requested level (`moreVerbose`, internal/mcpclient/relay.go); whether any path relays upstream logs to a host that requested no level — which would settle this item as moot in the relay direction — is the open question named there. +- **Disposition:** Moot in the relay direction — verified 2026-11-11 (#1974 sweep): no path relays upstream logs to a host that requested no level. In `relayNotification` (internal/mcpclient/relay.go) a `notifications/message` is delivered only to relays whose `LogLevel` is non-empty and whose requested level the message meets (`LogAtLeast`); the Relay contract states it outright — LogLevel empty "means it asked for none, and OnMessage is never called". Nor is upstream asked on such a host's behalf: `beginRelay` stamps the `_meta` log level (the more verbose of the host's and the client's own, `moreVerbose`) only when the host named a level. The server direction is per-request by construction in 2026: the level rides the request's `_meta` and is validated there (internal/mcpserver/server.go), and a modern server with no level named sends its host nothing through mcpx's relay. Headline 9 closed on this site. - ≤2025-11-25 schema: "If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically." https://modelcontextprotocol.io/specification/2025-11-25/schema#loggingmessagenotification - 2026: "The server **MUST NOT** emit `notifications/message` for a request that does not include this field." https://modelcontextprotocol.io/specification/2026-07-28/server/utilities/logging#per-request-log-level . Also session-wide → per-request, and `logging/setLevel` removed (changelog 5). Invalid level: ≤2025-11-25 rejects the `setLevel` call; 2026 "SHOULD reject that request" — i.e. the `tools/call` (or whatever) carrying the bad `_meta`. - mcpx `docs/protocol.md` §2.2 says logging is "removed in 2026-07-28"; the spec *deprecates* it (still in schema `ServerCapabilities.logging`, still has a MUST-declare rule). Only `logging/setLevel` is removed. @@ -360,12 +360,12 @@ C21. **Header name casing drift.** 2025-03-26..2025-06-18 `Mcp-Session-Id`; 2025 - **Disposition:** Peer-settled — the client gates `completion/complete` on the declared `completions` capability, with the era exception implemented: a 2024-11-05 upstream (which had no capability to declare) is asked anyway, and its `-32601` is read as the same absence a later server signals by not declaring (internal/mcpclient/request.go:52-65, covered by request_test.go). The server side is not moot: mcpx serves from 2024-11-05 (`Oldest`, internal/mcpserver/revisions.go:14). **C10 — "task required but not used" error code (2025-11-25, spec-internal).** -- **Disposition:** Undisposed — the actual behaviour is recorded, and it follows neither text: a non-task-augmented legacy call executes ordinarily, because `maybeTask()` returns nil before any task-support check when the call does not request a task (internal/mcpserver/tasks.go:237-240); the `-32601` branch at :241-245 covers the opposite case, an augmented call to a tool whose support is "forbidden". Open question: should the missing-required-task case refuse with `-32601` (tool-level MUST) or `-32600` (error list), or is ordinary execution the intended reading? See headline 13. +- **Disposition:** Peer-settled (implemented) — verified 2026-11-11 (#1974 sweep): the tool-level MUST wins for `tools/call`, as the item text argues. `maybeTask()` (internal/mcpserver/tasks.go) now refuses a non-task-augmented legacy call to a tool whose `execution.taskSupport` is `"required"` with `-32601` (`codeMethodNotFound`, "this tool requires task-augmented execution"), before anything runs; the `-32600` of the protocol-errors list remains for request types with no tool-level rule. Previously the call executed ordinarily — `maybeTask` returned nil before any task-support check when no task was requested — which followed neither text. Covered by `TestLegacyNonAugmentedCallToRequiredToolIsRefused` (an "optional" tool called plainly still runs plainly). See headline 13. - Tool-level: "If `execution.taskSupport` is `"required"` … Servers **MUST** return a `-32601` (Method not found) error if a client does not attempt to do so." https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks#tool-level-negotiation - Protocol errors: "receivers **MAY** return …: Non-task-augmented request when receiver requires task augmentation for that request type: `-32600` (Invalid request)" …#protocol-errors (and the "Task augmentation required" example there uses -32600). For `tools/call` the MUST (-32601) should win; for other request types -32600. **C11 — cancelled task finality: MUST stay cancelled (2025-11-25) → may end non-cancelled (2026 extension).** -- **Disposition:** Undisposed — headline 13, first half: whether mcpx's tasks implementation holds a cancelled task in `cancelled` (2025-11-25 core) or permits a later non-`cancelled` terminal status (extension) was not verified from internal/mcpserver/tasks.go in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep): the era split is implemented in the task store, keyed by which cancel entry point the path uses. The legacy path (internal/mcpserver/tasks.go, `tasks/cancel`) calls `Store.CancelImmediate` (internal/tasks/tasks.go): `cancelled` is recorded at once, before the reply, and stands whatever the work does afterwards — `finish` lets the first terminal recording under the lock win (conformance: tasks-cancelled-sticky). The modern extension path uses `Store.CancelWithReason`: a cooperative grace window in which the work may still reach a non-`cancelled` terminal status (`finish` records "completed during cancellation"). Each era gets its own text's behaviour from the same store. See headline 13. - 2025-11-25: "…**MUST** transition the task to `cancelled` status before sending the response." "Once a task is cancelled, it **MUST** remain in `cancelled` status even if execution continues to completion or fails." …#task-cancellation ; and the `tasks/cancel` response is the Task. - Extension: "Acknowledge cancellation requests with an empty result. Honor them when possible, but cancellation is cooperative — the task may still reach a non-`cancelled` terminal status." docs/extensions/tasks/overview.mdx#for-mcp-servers ; lifecycle table: "`cancelled` | The operation was cancelled (not always honored)." - Also 2025-11-25 "Receivers **MUST** reject cancellation requests for tasks already in a terminal status … `-32602`" has no counterpart in the overview. diff --git a/pkgs/mcpx/internal/mcpserver/revisions.go b/pkgs/mcpx/internal/mcpserver/revisions.go index 9c6c02db23..e3104c1f81 100644 --- a/pkgs/mcpx/internal/mcpserver/revisions.go +++ b/pkgs/mcpx/internal/mcpserver/revisions.go @@ -240,6 +240,27 @@ func downgrade(result any, version string) any { } } } + if Defines(version, FeatStructuredContent) { + // 2025-06-18..2025-11-25 define structuredContent as an object + // only ("structuredContent?: { [key: string]: unknown }"); + // 2026-07-28 allows any JSON value and never reaches here (it + // defines FeatResultType, which returns above). A non-object + // value spelled for an object-only host is a shape its schema + // forbids, so it is rendered into content exactly as the + // pre-2025-06-18 case renders it: the data survives, and the + // field is never sent a value the host must reject. + // Conformance rows tools-structured-object-only and + // tools-structured-any-json; #1974 headline 7. + if sc, present := m["structuredContent"]; present { + if _, isObject := sc.(map[string]any); !isObject { + delete(m, "structuredContent") + if b, err := json.MarshalIndent(sc, "", " "); err == nil { + m["content"] = appendContent(m["content"], + map[string]any{"type": "text", "text": string(b)}) + } + } + } + } if c, present := m["content"]; present { m["content"] = downgradeContent(c, version) } diff --git a/pkgs/mcpx/internal/mcpserver/structured_downgrade_test.go b/pkgs/mcpx/internal/mcpserver/structured_downgrade_test.go new file mode 100644 index 0000000000..c4322ea9f9 --- /dev/null +++ b/pkgs/mcpx/internal/mcpserver/structured_downgrade_test.go @@ -0,0 +1,54 @@ +package mcpserver_test + +import ( + "strings" + "testing" + + "github.com/developing-today/code/pkgs/mcpx/internal/mcpserver" +) + +// #1974 headline 7: 2025-06-18..2025-11-25 define structuredContent as an +// object only, while 2026-07-28 allows any JSON value. A non-object value +// must not reach an object-only host in the field; it is rendered into +// content instead, so the data survives in a shape the host can read. +// Oracle: the receiving revision's own CallToolResult schema +// (tools-structured-object-only / tools-structured-any-json conformance +// rows). +func TestNonObjectStructuredContentIsRenderedForObjectOnlyHosts(t *testing.T) { + srv := mcpserver.New(nil, "mcpx", "test") + result := map[string]any{ + "content": []any{map[string]any{"type": "text", "text": "hello"}}, + "structuredContent": []any{1, 2, 3}, + } + for _, version := range []string{"2025-06-18", "2025-11-25"} { + out := protoJSON(t, srv.Downgrade(result, version)) + if strings.Contains(out, "structuredContent") { + t.Errorf("%s is object-only and must not be sent a non-object structuredContent:\n%s", version, out) + } + if !strings.Contains(out, "1") || !strings.Contains(out, "3") { + t.Errorf("%s: the data should survive rendered as text:\n%s", version, out) + } + } + + // An object value is exactly what those revisions define: kept. + obj := map[string]any{ + "content": []any{map[string]any{"type": "text", "text": "hello"}}, + "structuredContent": map[string]any{"n": 42}, + } + for _, version := range []string{"2025-06-18", "2025-11-25", "2026-07-28"} { + out := protoJSON(t, srv.Downgrade(obj, version)) + if !strings.Contains(out, "structuredContent") { + t.Errorf("%s defines object structuredContent and should keep it:\n%s", version, out) + } + } + + // A scalar value is a non-object too. + scalar := map[string]any{"structuredContent": "just text"} + out := protoJSON(t, srv.Downgrade(scalar, "2025-11-25")) + if strings.Contains(out, "structuredContent") { + t.Errorf("a scalar structuredContent must not reach a 2025-11-25 host in the field:\n%s", out) + } + if !strings.Contains(out, "just text") { + t.Errorf("the scalar should survive rendered as text:\n%s", out) + } +} diff --git a/pkgs/mcpx/internal/mcpserver/tasks.go b/pkgs/mcpx/internal/mcpserver/tasks.go index 94274f7091..5d8b2ce753 100644 --- a/pkgs/mcpx/internal/mcpserver/tasks.go +++ b/pkgs/mcpx/internal/mcpserver/tasks.go @@ -297,6 +297,18 @@ func (s *Server) maybeTask(ctx context.Context, c *Conn, req request, peer Peer) if !peer.Modern { want, ttl := wantsTask(req.Params) if !want { + // 2025-11-25 tool-level negotiation: a tool whose + // execution.taskSupport is "required" MUST be refused + // when the client does not attempt task augmentation. + // The code is the tool-level rule's -32601, not the + // protocol-errors list's -32600: that list is for + // request types with no tool-level rule, and for + // tools/call the MUST wins (#1974 headline 13, + // section C item C10). + if s.legacyTaskSupport(ctx, req.Params) == supportRequired { + return &response{JSONRPC: "2.0", ID: req.ID, Error: &rpcError{Code: codeMethodNotFound, + Message: "this tool requires task-augmented execution (execution.taskSupport is required)"}} + } return nil } if sup := s.legacyTaskSupport(ctx, req.Params); sup != supportOptional && sup != supportRequired { diff --git a/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go b/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go new file mode 100644 index 0000000000..b50ea1b6fb --- /dev/null +++ b/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go @@ -0,0 +1,32 @@ +package mcpserver_test + +import ( + "testing" +) + +// #1974 headline 13 / section C item C10: on the legacy (2025-11-25) path +// a non-task-augmented call to a tool whose execution.taskSupport is +// "required" is refused -32601 — the tool-level MUST ("Servers MUST +// return a -32601 (Method not found) error if a client does not attempt +// to do so") — not the protocol-errors list's -32600, which covers +// request types with no tool-level rule. Oracle: the 2025-11-25 tasks +// page's tool-level negotiation rule. +func TestLegacyNonAugmentedCallToRequiredToolIsRefused(t *testing.T) { + s := rawTaskServer() + m := postQuery(s, "codemode=false", frame(1, "tools/call", + map[string]any{"name": "db_job", "arguments": map[string]any{}})) + if errCode(m) != -32601 { + t.Fatalf("non-augmented legacy call to a required tool: want -32601, got %v", m) + } + + // An optional tool called the plain way still runs the plain way: + // the refusal is only for "required". + m = postQuery(s, "codemode=false", frame(2, "tools/call", + map[string]any{"name": "db_nap", "arguments": map[string]any{}})) + if errCode(m) != 0 { + t.Fatalf("non-augmented legacy call to an optional tool should run: got %v", m) + } + if _, isTask := m["result"].(map[string]any)["task"]; isTask { + t.Fatalf("a plain call must not silently become a task: %v", m) + } +} From e8739ac846e776b015e385672c7b413357e8ee9c Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 07:54:06 -0600 Subject: [PATCH 5/7] docs(mcpx): disposition section D of the revision-conflicts register (#1974) --- pkgs/mcpx/docs/spec/revision-conflicts.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index 2d01ddf66f..315a682f10 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -406,20 +406,20 @@ C21. **Header name casing drift.** 2025-03-26..2025-06-18 `Mcp-Session-Id`; 2025 2026 tools/prompts say "to clients that have opened a `subscriptions/listen` stream with `toolsListChanged: true`", and SubscriptionFilter says "the server **MUST NOT** send notification types the client has not explicitly requested here" — https://modelcontextprotocol.io/specification/2026-07-28/schema#subscriptionfilter. Read literally, the resources page permits an unsolicited push that the schema forbids; the resources page was not updated. Follow the schema: only on a listen stream with `resourcesListChanged: true`. **C4 — `resources.subscribe` capability meaning (cross-revision).** -- **Disposition:** Undisposed — open question: is the legacy `resources/subscribe` RPC answered only on legacy connections, and is the same capability flag read as the listen-filter meaning on 2026-07-28? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section D): both halves. The RPC is legacy-only: `resources/subscribe`/`unsubscribe` map to `FeatResourceSubscribe` (internal/mcpserver/revisions.go method-features), which 2026-07-28 no longer defines, so a modern peer's call is answered method-not-found by the dispatch `Removed` check (internal/mcpserver/server.go) before it can run; on legacy connections the handler records the per-connection URI set and feeds the same notifier. The modern meaning of the flag is the listen filter: a legacy subscribe is itself re-expressed as `restartListen` with `ListenFilter{ResourceSubscriptions: uris}` (server.go), and a modern client's `resourceSubscriptions` filter on `subscriptions/listen` (internal/mcpserver/listen.go) drives the same delivery. The one capability bit — `resources.subscribe` in `capabilities()` (server.go) — gates the legacy RPC through the advertised-capability gate (`gatedCapability`) and describes listen-filter support on modern connections, exactly the flag's two lives. Legacy: client may call `resources/subscribe` (https://modelcontextprotocol.io/specification/2025-11-25/server/resources#capabilities). 2026: "whether the server supports resource-specific update notifications for resources requested through subscriptions/listen using the resourceSubscriptions filter" (https://modelcontextprotocol.io/specification/2026-07-28/server/resources#capabilities). `resources/subscribe`/`unsubscribe` are removed ("Replaces the former `resources/subscribe` RPC", schema#subscriptionfilter; changelog item 4). Same flag, different method behind it. **C5 — `structuredContent` / `outputSchema` shape (cross-revision; prose vs schema in 2025-06-18/11-25).** -- **Disposition:** Undisposed — headline 7: `downgrade()` (internal/mcpserver/revisions.go:237) deletes `structuredContent` only for pre-2025-06-18; what happens to a non-object value headed for a 2025-06-18..2025-11-25 host is the open question named there. +- **Disposition:** Peer-settled (implemented) — headline 7, dispositioned there: `downgrade()` (internal/mcpserver/revisions.go) now renders a non-object `structuredContent` into `content` for a 2025-06-18..2025-11-25 host and removes the field, per the conformance rows; see the headline index item 7 and `TestNonObjectStructuredContentIsRenderedForObjectOnlyHosts`. 2025-06-18/2025-11-25 schema: `structuredContent?: { [key: string]: unknown }`; outputSchema "Currently restricted to type: \"object\" at the root level." — https://modelcontextprotocol.io/specification/2025-11-25/schema#calltoolresult. 2026-07-28: "This can be any JSON value (object, array, string, number, boolean, or null)"; outputSchema "can be any valid JSON Schema 2020-12" — https://modelcontextprotocol.io/specification/2026-07-28/server/tools#structured-content. A 2026 upstream's array result is illegal to send to a 2025-11-25 client verbatim. (The 2025-06-18/11-25 prose says "a JSON object"; consistent with its schema.) **C6 — list/changed delivery and per-connection variance (cross-revision).** -- **Disposition:** Undisposed — open question: does mcpx's server deliver list_changed per era (session-wide legacy vs opted-in listen streams in 2026), and can its served lists vary per connection against the 2026 MUST NOT? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section D): delivery is era-split. Legacy: `NotifyToolsListChanged` (internal/mcpserver/reactive.go) broadcasts to the default connection and every session, unsolicited, as the legacy revisions allow. Modern: a connection is reached only through its `subscriptions/listen` stream, and `ListenFilter.allows` (internal/mcpserver/listen.go) is checked on the way out as well as at the notifier — a type the client's filter did not request is not sent, per the schema's MUST NOT (see item C3). Per-connection variance: no — for a given server mode every peer's `tools/list` is built from the same `surface(ctx)` (internal/mcpserver/passthrough.go): the merged pass-through list plus the gateway's own tools, or the reactive working set, which is server-wide state, not per-connection state. What differs per peer is only revision shaping (`downgrade`), never membership. Legacy list_changed is sent on the session to any client; 2026 only to opted-in listen streams (tools/prompts pages). 2026 adds "**MUST NOT** vary per-connection" for tools/prompts/resources lists — https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities; legacy imposes nothing, so session-scoped tool sets were legal before. **C7 — where capabilities are declared (page vs page, 2026).** -- **Disposition:** Undisposed — open question: does mcpx's `DiscoverResult` declare the `prompts` capability in the result itself, as the 2026 prompts page requires, and the `tools`/`resources` capabilities observably at all? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section D): yes, all three, in the result itself. The `server/discover` handler (internal/mcpserver/server.go) returns `capabilities` computed by the same `capabilities()` that answers `initialize`, whose map always carries `tools`, `resources` (with `subscribe`), and `prompts` (each with its `listChanged` bit) — so the prompts page's MUST is met in the DiscoverResult, and tools/resources are observable in exactly the same place. (serverInfo is deliberately absent from the result body: 2026 moved it to `_meta`, which the modern envelope adds — item C12.) 2026 prompts: "**MUST** declare the `prompts` capability in their `DiscoverResult`" — https://modelcontextprotocol.io/specification/2026-07-28/server/prompts#capabilities. 2026 tools/resources: "**MUST** declare the `tools` capability" with no location — https://modelcontextprotocol.io/specification/2026-07-28/server/tools#capabilities. Meanwhile discover prose makes calling discover optional ("a client may invoke any RPC inline"). So a client that never calls discover never sees server capabilities, yet tools/resources/prompts listChanged/subscribe semantics depend on them. Not a contradiction, but the capability is only observable via discover (or the listen ack's echoed filter). **C8 — embedded resource "MUST include … MIME type" vs schema (prose vs schema, all revs).** @@ -443,7 +443,7 @@ Changelog: "Require `ttlMs` and `cacheScope` fields on results returned by `tool InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it moves to `_meta['io.modelcontextprotocol/serverInfo']` and is optional SHOULD (https://modelcontextprotocol.io/specification/2026-07-28/server/discover#discoverresult). Same for `protocolVersion` (single) → `supportedVersions` (list). **C13 — tool name guidance vs aggregator reality.** -- **Disposition:** Undisposed — open question: when mcpx prefixes upstream tool names for disambiguation, what happens to names that would exceed 128 chars or leave the charset? No site verified in Phase 1. +- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section D): mcpx never prefixes. Pass-through tool names are served verbatim from the merged surface (`lookupPass`, internal/mcpserver/passthrough.go), and the collision the 2026 note's prefixing strategy exists to solve is handled the other way: two upstreams offering the same name are refused with an error naming both, and the operator chooses — drop one from `mcp.passthrough`, or reach it through `mcpx_call` under its namespace (where the name travels as an argument, not as a listed tool name). No listed name is ever lengthened by mcpx, so the 128-char/charset squeeze the prefixing strategy creates does not arise; an upstream name that itself violates the guidance arrives and leaves unchanged. "Tool names **SHOULD** be unique within a server" + charset `[A-Za-z0-9_.-]` + ≤128 chars (2025-11-25+) vs the 2026 note that proxies "**SHOULD** implement a disambiguation strategy such as prefixing tool names with a server identifier" — prefixing makes the 128 limit and charset binding on the proxy's separator and on upstream names that are already long or non-conforming. Not contradictory; a squeeze. **C14 — isError vs "tool not found" (schema vs mcpx, not spec-internal).** Recorded here because it is easy to misread: the CallToolResult comment keeps "errors in _finding_ the tool … should be reported as an MCP error response" in every revision; only *argument* validation moved (C1). From aef7a66866e5a4c1850b71ef6b85411dae2d3477 Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 08:05:42 -0600 Subject: [PATCH 6/7] docs(mcpx): disposition section E of the revision-conflicts register; name #1481 on the excluded item (#1974) --- pkgs/mcpx/docs/spec/revision-conflicts.md | 38 +++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index 315a682f10..b8958a8f17 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -391,7 +391,7 @@ C21. **Header name casing drift.** 2025-03-26..2025-06-18 `Mcp-Session-Id`; 2025 ## D. Tools, resources, prompts, discover **C1 — tool input-validation errors: protocol error → execution error (cross-revision).** -- **Disposition:** Undisposed — headline 5: the client choke keeps `-32602` (internal/mcpclient/schemacheck.go, internal/daemon/callerr.go); whether the serve seam era-splits `isError` for >=2025-11-25 hosts is the open question named there. +- **Disposition:** Undisposed — headline 5, gated on the #1481 decision (not decided or implemented in the #1974 sweep): the client choke keeps `-32602` (internal/mcpclient/schemacheck.go, internal/daemon/callerr.go); whether the serve seam era-splits `isError` for >=2025-11-25 hosts is the open question named there. 2024-11-05…2025-06-18: "Protocol Errors: Standard JSON-RPC errors for issues like: … Invalid arguments" and execution errors are "Invalid input data" — https://modelcontextprotocol.io/specification/2025-06-18/server/tools#error-handling. 2025-11-25+: "Tool Execution Errors … Input validation errors (e.g., date in wrong format, value out of range)"; protocol errors are only "Malformed requests (requests that fail to satisfy CallToolRequest schema)" — https://modelcontextprotocol.io/specification/2025-11-25/server/tools#error-handling. Changelog: "Clarify that input validation errors should be returned as Tool Execution Errors rather than Protocol Errors" (SEP-1303). A server emitting `-32602` for a bad date is following 2025-06-18 and deviating from 2025-11-25. `isError:true` is legal in both, so the conservative choice is isError. @@ -477,13 +477,13 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it - **Disposition:** Recorded reading — deprecation is read as "should not adopt anew": mcpx continues to implement roots and sampling because its legacy peers require them; it does not treat the features as removed. (https://modelcontextprotocol.io/specification/2026-07-28/deprecated). Elicitation is not deprecated. 6. **Sampling error path.** ≤2025-11-25: "Clients **SHOULD** return errors for common failure cases" with `-1` for a -- **Disposition:** Undisposed — open question: under MRTR there is no error channel (see the spec-internal item 6 below); how does mcpx's client signal a declined or failed sampling request to a 2026-07-28 server — absence of a retry only? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): client-side failure, the second of the two expressible options. On the legacy wire an answer error keeps its typed code (`UserRejectedError` is -1, tool-shape -32602; internal/mcpclient `answer`, internal/mcpclient/modern.go). Under MRTR the same error makes `resolveInput` (internal/mcpclient/modern.go) return the error instead of a retry: the original call fails on the client and is never replayed — mcpx never omits the key silently and never fabricates an answer (the rate-limit design states the principle: a fabricated result "would claim a person decided, and nobody did"). The server observes exactly what the 2026 text prescribes: no replay. rejected request (https://modelcontextprotocol.io/specification/2025-11-25/client/sampling#error-handling). 2026-07-28: "If an error occurs or the user declines the sampling request, the client does not need to replay the initial call with an error message" (https://modelcontextprotocol.io/specification/2026-07-28/client/sampling#error-handling). Roots has the same change (`-32601`/`-32603` → no error path). 7. **Tools in sampling** exist only from 2025-11-25 (`tools`, `toolChoice`, `tool_use`/`tool_result` content, content -- **Disposition:** Undisposed — open question: does mcpx shape sampling messages per peer era (single-block content for pre-2025-11-25 peers, arrays and tool content after), as it shapes `structuredContent` in `downgrade()` (internal/mcpserver/revisions.go)? The sampling path was not verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): yes, at the relay's validator. `Client.answer` stamps the sampling era (`WithSamplingEra`, internal/mcpclient/modern.go) for the relay that answers, and internal/elicit/sampling.go validates against it: `content` is a single block before 2025-11-25 and a block or array from 2025-11-25 (`decodeSampleContent` with the era's `arrayOK`), tool_use/tool_result linkage and the user-message only-tool-results rule are checked per era, and a shape the peer's era cannot represent is answered -32602 (`ToolShapeError`) rather than relayed. arrays, `stopReason: "toolUse"`). 2024-11-05 `SamplingMessage.content` is `TextContent | ImageContent` (single block); 2025-03-26 adds audio; arrays only from 2025-11-25. A 2025-11-25+ result with array `content` is unparseable by an older peer. @@ -494,15 +494,15 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it 2026 changelog says "Reclassify ... (soft-deprecated since protocol version `2025-11-25`) as Deprecated" — consistent in substance, differing in which date is "deprecated". 9. **Elicitation sensitive information.** 2025-06-18: "Servers **MUST NOT** use elicitation to request sensitive -- **Disposition:** Undisposed — open question: does mcpx gate elicitation modes per era — form mode barred from sensitive information from 2025-11-25, URL mode required for it, the 2025-06-18 all-modes ban before that? The elicitation path (internal/mcpserver/ask.go) was not audited for this in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section E): the ban binds the server that *originates* an elicitation, and in this path that server is the upstream, not mcpx: mcpx relays questions and originates none, so there is no era-scoped sensitive-mode gate in the relay to find. What mcpx does control, it controls era-independently: mode gating is by declared capability (`Question.Sendable`/`Peer.CanElicit(mode)`, internal/mcpserver/conn.go; an undeclared mode is answered -32602 by the client, internal/mcpclient/modern.go), and credential-shaped form fields are routed to a human, never the agent, and masked in the answer review (`Route`/`IsSensitiveField`, internal/elicit/elicit.go) in every era. information." (all modes; https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation#user-interaction-model). 2025-11-25+: only form mode is forbidden, and URL mode is **required** for it. 10. **Client UI obligations promoted SHOULD → MUST** in 2025-11-25: which-server indication, review/modify (form), -- **Disposition:** Undisposed — open question (host-side): mcpx's client surfaces elicitation to its host UI; whether the 2025-11-25 MUSTs (which-server indication, review/modify, decline/cancel) are all met by that surface was not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): which-server indication is done by the relay itself: `shapeQuestion` (internal/mcpserver/conn.go) prefixes the message with the originator (" (via mcpx) asks: …") when the upstream is not already named, so the surface cannot present an anonymous question. Decline/cancel are distinct end-to-end: an unanswered-because-nobody-was-asked question returns `action: "cancel"`, never "decline" (internal/mcpclient/modern.go `answer`), and a person's decline travels as their own ElicitResult action. Review/modify is the broker surface's shape: schema defaults are pre-populated (`applyDefaults`) and the answerer sets or omits each field before the answer is validated (`checkElicitationAnswer`) and sent. decline/cancel options. 2025-06-18 "Applications **SHOULD**: ..." vs 2025-11-25 "MCP clients **MUST**: ..." (https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation#user-interaction-model). 11. **Elicitation request shape.** 2025-06-18 `params: {message, requestedSchema}` — no `mode`, no `default`, enum is -- **Disposition:** Undisposed — open question: are elicitation params shaped per peer era (`mode`/`elicitationId`/url mode withheld from a 2025-06-18 peer, `elicitationId` withheld from 2026-07-28)? No site verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): yes, in `shapeQuestion` (internal/mcpserver/conn.go). Before 2025-11-25: `mode` and `elicitationId` are deleted and the requested schema's enums are downgraded (`downgradeEnumSchemaForOldHost`); a url-mode question never reaches such a peer at all (`Question.Sendable` refuses it, so it stays with the broker). 2026-07-28: `elicitationId` is deleted. 2025-11-25 url mode: `elicitationId` is REQUIRED, and when the upstream omitted one mcpx mints it from the question's own id ("mcpx-") rather than relay a request the client's schema rejects. `{enum, enumNames}`. 2025-11-25 adds `mode`, url mode, `elicitationId`, defaults, `oneOf`/array enums, `LegacyTitledEnumSchema`. 2026-07-28 removes `elicitationId`. Sending `mode`/`elicitationId` to a 2025-06-18 peer is sending fields its schema lacks; sending url mode to it is sending a request it cannot represent. @@ -511,24 +511,24 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it 2025-11-25. 2026-07-28 changelog item 11 removes the first two; basic/index: "Implementations of this protocol version **MUST NOT** emit these codes: ... `-32042`" (https://modelcontextprotocol.io/specification/2026-07-28/basic/index#error-codes). 13. **Elicitation statefulness.** 2025-11-25: "Most practical uses of elicitation require that the server maintain state" -- **Disposition:** Undisposed — open question: does mcpx's URL-mode elicitation keep server state keyed by anything other than a session ID alone (2025-11-25 rule), and does it rely on no state at all in 2026 form mode? Not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): no session keying anywhere. The modern round-trip state is a self-contained signed token (`stateSigner`, internal/mcpserver/state.go): HMAC-signed, expiring, carrying the call id, the round count, and a binding that is a hash of the exact request (method + canonical params, `requestBinding`, internal/mcpserver/ask.go) — the server stores nothing for the retry to find, and an unbound token cannot be minted ("a requestState must be bound to something"). The pending call itself lives in the daemon's task store under its call id, which is call state, not elicitation state keyed by session. The 2025-11-25 URL flow rides the same machinery plus its era's `elicitationId` (item 11). + "State **MUST NOT** be associated with session IDs alone" (https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation#statefulness). 2026-07-28: "Elicitations do not require that the server maintain state ... However, if state is stored ..." and the session-ID rule is gone (sessions no longer exist) (https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#statefulness). 14. **Elicitation error handling.** 2025-11-25 prescribes `-32042` (server) and `-32602` for an undeclared mode (client). -- **Disposition:** Undisposed — open question: which error surface does mcpx use per era — `-32042` / `-32602` in 2025-11-25 (but see the spec-internal item 2 below) vs decline/cancel handling with no codes in 2026-07-28? Cross-reference headline 5's serve-seam question. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): era-split as the texts prescribe. 2025-11-25: -32602 for an undeclared mode (client `answer`, internal/mcpclient/modern.go) and for tool-shape violations; -32042 returned by the server for an undeliverable URL question and handled by the client (item 12; the server-side return gap for the broker-held case is the recorded gap at spec-internal item 2, unchanged). 2026-07-28: no codes exist to send — a decline or failure surfaces as the ElicitResult action (accept/decline/cancel) or as no retry at all (cross-revision item 6), which is the handling the 2026 text requires. (This item is the error surface only; headline 5's serve-seam isError question is separate and remains gated on #1481.) 2026-07-28 replaces both with "Servers **SHOULD NOT** assume ... and **MUST** handle cases where the user declines or cancels ..." (https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#error-handling). 15. **Client rate limiting** for elicitation: SHOULD in 2025-06-18 and 2025-11-25, dropped in 2026-07-28 (sampling keeps it). -- **Disposition:** Undisposed — open question: does mcpx's client rate-limit elicitation requests at all, and if so is the limit era-scoped now that 2026-07-28 drops the SHOULD? Not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): yes, and deliberately not era-scoped. internal/mcpclient/ratelimit.go enforces per-server and per-session per-minute limits on sampling and elicitation at the entry of `Client.answer` — the one function both eras converge on (wire request or MRTR input request) — so an over-limit question reaches no handler on either path; refusal is a -32603 naming the setting that set the limit, never a fabricated answer. 2026 dropping the SHOULD changes nothing: the limit is mcpx's own cost/attention control (#2192, design #2333), not an era behaviour. 16. **New 2026-only sampling MUSTs**: "Sampling messages **MUST** contain a `role` ... and a `content` field", "The client -- **Disposition:** Undisposed — open question: does mcpx's client enforce the 2026 sampling MUSTs (`role` and `content` present, `maxTokens` respected, no retention between requests) on MRTR-carried sampling? Not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): yes. Presence: the relay validator (internal/elicit/sampling.go) decodes every message and fails a missing `content` ("content is missing") or an undecodable role/content shape as -32602 before the question reaches a handler, on MRTR-carried requests exactly as on wire ones (both converge on `Client.answer`). `maxTokens`: the local sampler treats the request's `maxTokens` as a bound, capped by the model budget (internal/daemon/sampling_local.go), and a relayed answer is the answering client's own result. Retention: mcpx keeps no sampling state between requests — each answer is produced per call and nothing is carried into the next request. **MUST** respect the `maxTokens` parameter", "SHOULD NOT be retained between separate requests" (https://modelcontextprotocol.io/specification/2026-07-28/client/sampling#messages, https://modelcontextprotocol.io/specification/2026-07-28/client/sampling#sampling-parameters). 17. **Task-augmented sampling/elicitation** (`params.task`, `tasks.requests.sampling.createMessage`, -- **Disposition:** Undisposed — headline 13 area: task augmentation exists only in 2025-11-25 core; whether mcpx strips or rejects a `task` param headed for a 2026-07-28 peer was not verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): a `task` param is never constructed toward a 2026-07-28 peer. The client builds a task-augmented `tools/call` only on the legacy task path (`callToolAsLegacyTask`, internal/mcpclient/tasks.go) for a legacy peer whose tool requires it; the modern path's task surface is the tasks extension (separate methods and the flat `resultType: "task"` answer), whose params have no `task` field. Server side, `withoutTask` (internal/mcpserver/server.go) strips any `task` param before a request runs in the background, so an augmentation cannot recurse or leak into a re-issued call. `tasks.requests.elicitation.create`) exist in 2025-11-25 core (https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks). The 2026-07-28 `CreateMessageRequestParams` and `ElicitRequest*Params` have no `task` field, and 2026 `ClientCapabilities` has no `tasks`. @@ -553,7 +553,7 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it proper access controls" and servers "**SHOULD** ... Validate all paths against provided roots" (https://modelcontextprotocol.io/specification/2026-07-28/client/roots#security-considerations). 4. **Roots: change monitoring without a change signal** (2026-07-28). "Clients **SHOULD**: ... Monitor for root changes" -- **Disposition:** Undisposed — open question: in 2026-07-28 there is no signal to monitor with; does mcpx's client re-list roots per request instead of caching them, and if it caches, what invalidates the cache? Not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): there is no cache to invalidate. mcpx's client answers each `roots/list` — wire or MRTR input request — from its current root set at the moment of answering (`Client.answer` reads `c.roots` fresh, or relays the question to the client it serves, internal/mcpclient/modern.go), so a server that asks again after any change gets the new list; in 2026 that re-asking is the only mechanism the revision leaves, and it is the one that works here because nothing was cached. (https://modelcontextprotocol.io/specification/2026-07-28/client/roots#implementation-guidelines) survives, but there is no longer any way to tell the server; and "Cache root information appropriately" has no invalidation signal. 5. **Deprecated but MUST declare** (2026-07-28): roots and sampling pages say new implementations "**SHOULD NOT** adopt it" @@ -561,31 +561,31 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it while still "Clients that support roots **MUST** declare ... on each request" — consistent only if read as "if you implement it anyway". 6. **Tools-without-capability: client MUST error, but 2026 has no error channel.** Schema 2026: "The client MUST return an -- **Disposition:** Undisposed — open question (same gap as the cross-revision item 6 above): the only expressible client "error" under MRTR is not retrying, or a client-side failure; which one mcpx's client produces for an undeclared `sampling.tools` field was not verified in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): client-side failure, by the same mechanism as cross-revision item 6. `samplingShape` (internal/mcpclient/modern.go) rejects a request carrying `tools`/`toolChoice` when `sampling.tools` was not declared, with -32602 and a message saying so. On the legacy wire that error is the answer; under MRTR it is raised inside `resolveInput`, so the retry is never sent and the call fails on the client — the MUST's "return an error" discharged in the only form MRTR carries. error if this field is provided but ClientCapabilities.sampling.tools is not declared." (https://modelcontextprotocol.io/specification/2026-07-28/schema#createmessagerequestparams). In 2026 the request arrives inside `InputRequiredResult.inputRequests`; `InputResponse` is `CreateMessageResult | ListRootsResult | ElicitResult` — no error member — and the sampling page says "the client does not need to replay the initial call with an error message". The only expressible "error" is not retrying, or a client-side failure. 7. **Elicitation "client fails to process" in 2026.** "**MUST** handle cases where ... the client fails to process the -- **Disposition:** Undisposed — open question: under MRTR the server sees only absence; does mcpx's server re-request missing elicitation input (the mrtr SHOULD) or fail the original request? Not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): it re-requests. The ask loop (internal/mcpserver/ask.go) matches a retry's upfront answers against the pending questions; what is still unanswered stays pending and is returned in a fresh `InputRequiredResult` with a newly minted state token (round count carried in the signed state, so the client cannot reset it), exactly the mrtr SHOULD. Only when the rounds bound (`Timing.AskRounds`) is exhausted does the server abandon the call and fail the original request (-32603, "still asking for input after N rounds"). request" (https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#error-handling) — under MRTR the server cannot observe that; it sees only absence of a retry, or a retry missing that key (mrtr: "SHOULD respond with a new `InputRequiredResult` requesting the missing information again"). 8. **Missing capability: error vs. omit** (2026-07-28). basic/index: "the server **MUST** return a -- **Disposition:** Undisposed — open question: when mcpx's server requires elicitation a client has not declared, does it return `-32021` (MissingRequiredClientCapabilityError), and when it can degrade, does it degrade silently? Not audited in Phase 1. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): both, each where its text puts it. Where the capability is a hard requirement of the request itself, the answer is -32021 with `requiredCapabilities` data: task notifications requested on `subscriptions/listen` without the tasks extension declared (internal/mcpserver/listen.go), and the task paths' missing-capability result (internal/mcpserver/tasks.go). Elicitation is never a hard requirement in mcpx's server — a question is optional to the call — so an undeclared client is never sent one and never errored: `canAsk` (internal/mcpserver/ask.go) routes the call down the direct path and the broker's ordinary routing, which is the silent degrade. mcpx never sends an `inputRequests` entry the client has not declared support for (the mrtr MUST NOT). `MissingRequiredClientCapabilityError` (`-32021`)" (https://modelcontextprotocol.io/specification/2026-07-28/basic/index#meta) vs mrtr: "Servers **MUST NOT** send an `inputRequests` that the client has not declared support for" and elicitation: "Servers **SHOULD NOT** assume that elicitation requests will always succeed". Together they force: a server that *requires* elicitation errors `-32021`; one that can degrade must degrade silently. Neither says which a server that *could* use elicitation but has a fallback must pick. 9. **Elicitation page vs mrtr on where elicitation may occur.** "Servers **MAY** request information from a user during the -- **Disposition:** Undisposed — open question: which client requests may carry an `InputRequiredResult` from mcpx's server — any (elicitation page) or only `prompts/get`, `resources/read`, `tools/call` (mrtr)? Check the ask path in internal/mcpserver/ask.go. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section E): the mrtr list. The ask path is entered only from the `tools/call`, `prompts/get` and `resources/read` handlers (the `canAsk` call sites in internal/mcpserver/server.go, and the task-augmented variants of the same three), and the `Asker` contract itself documents kind as exactly those three methods (internal/mcpserver/ask.go). No other client request can be answered with an `InputRequiredResult`. processing of a client request" (any request) vs mrtr "Servers **MUST NOT** send `InputRequiredResult` responses on any other client requests" than `prompts/get`, `resources/read`, `tools/call` (https://modelcontextprotocol.io/specification/2026-07-28/basic/patterns/mrtr#supported-requests). 10. **`_meta` preservation addressed to the wrong side.** Schema `ToolUseContent._meta` / `ToolResultContent._meta`: -- **Disposition:** Undisposed — open question: mcpx's server constructs subsequent sampling requests; does it preserve `ToolUseContent._meta` / `ToolResultContent._meta` when doing so, as the mis-addressed SHOULD intends? Not audited in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section E): preserved by non-interference. mcpx does not construct sampling content blocks; it relays the server's params, and its only edits are the era shapings recorded elsewhere in this section (undeclared-`tools` rejection, `includeContext` handling in `samplingShape`, internal/mcpclient/modern.go). The validator (internal/elicit/sampling.go) decodes only `type`/`id`/`toolUseId` and rewrites nothing, so a `_meta` a server put on a tool_use or tool_result block reaches the client byte-for-byte, and the client's blocks travel back the same way — the SHOULD's intent, met by a relay that does not strip what it does not own. "Clients SHOULD preserve this field when including tool uses in subsequent sampling requests" (https://modelcontextprotocol.io/specification/2026-07-28/schema#toolusecontent) — subsequent sampling requests are constructed by the *server*. @@ -598,7 +598,7 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it https://modelcontextprotocol.io/specification/2025-11-25/client/elicitation#requested-schema), a keyword the 2025-11-25 `StringSchema` type does not define. Removed from the 2026 example. 13. **Unconditional user binding** (2025-11-25, 2026-07-28): "Servers **MUST** bind elicitation requests to the -- **Disposition:** Undisposed — open question: how does mcpx bind an elicitation request to a user identity on stdio or without authorization, where no identity exists? Not audited in Phase 1. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section E): where no user identity exists, mcpx binds to what does exist and says so in its identity model (internal/mcpserver/identity.go, docs/spec/identity.md): on stdio the process is the client (`IdentityProcess` — one process serves exactly one client); a client may name itself (`IdentityClient`); where the transport names nothing (`IdentityNone`) "the only honest scope is the request itself", which is what the state binding uses — the signed token binds the elicitation round to the call and to a hash of the exact request (`requestBinding`), and minting an unbound token is refused. The MUST's "when possible" is read as governing exactly this: bind to user identity where the transport carries one, and never pretend one exists where it does not. client and user identity" while there is no user identity on stdio / without authorization; "when possible" appears only in the Statefulness bullet (https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#security-considerations). 14. **Sampling "Result Fields" vs tool-result constraint** (2026-07-28): result `content` may be "multiple tool uses or @@ -606,6 +606,6 @@ InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it mixed content" (assistant side) — not a contradiction with "user message ... **MUST** contain ONLY tool results", but a proxy must not apply the user-message rule to results. 15. **URL-mode requestState and "stateless" claim** (2026-07-28): Statefulness says elicitation does not require server -- **Disposition:** Undisposed — open question (same area as the cross-revision item 13 above): token custody makes the OAuth server stateful regardless of elicitation's statelessness; whether mcpx's URL-mode flow stores `requestState` server-side was not audited in Phase 1. +- **Disposition:** Peer-settled — it does not: the `requestState` is a self-contained HMAC-signed token the client carries and returns (cross-revision item 13); verification needs only the signing key and the retried request itself, so no per-elicitation state is stored server-side. mcpx holds no OAuth tokens in this flow (no OAuth flow is implemented — section B items C13–C15), so the statefulness the OAuth text describes does not arise here either. state, while the OAuth section still requires "The MCP server is responsible for tokens ... (in other words, the MCP server must be stateful)" (https://modelcontextprotocol.io/specification/2026-07-28/client/elicitation#understanding-the-distinction). From ce83436ea01f61ff527cdaca5d12ae94b419c44e Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 08:18:31 -0600 Subject: [PATCH 7/7] fix(mcpx): era-gate the required-task refusal to 2025-11-25 peers; correct five register dispositions on review (#1974) --- pkgs/mcpx/docs/spec/revision-conflicts.md | 16 ++++---- pkgs/mcpx/internal/mcpserver/tasks.go | 8 +++- .../mcpserver/tasks_required_legacy_test.go | 40 ++++++++++++++++++- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/pkgs/mcpx/docs/spec/revision-conflicts.md b/pkgs/mcpx/docs/spec/revision-conflicts.md index b8958a8f17..4e2ad687c2 100644 --- a/pkgs/mcpx/docs/spec/revision-conflicts.md +++ b/pkgs/mcpx/docs/spec/revision-conflicts.md @@ -39,11 +39,11 @@ instead of a silent choice. 6. **Peer-settled** — era-split codes in code: legacy `-32002` (internal/mcpserver/server.go, `codeResourceNotFoundLegacy`), 2026 `-32602`. 7. **Peer-settled (implemented)** — the conformance rows decided it (tools-structured-object-only: "downgrade must wrap/strip non-object values"; tools-structured-any-json: "must NOT send non-object structuredContent to 2025-06-18/2025-11-25 clients"), and `downgrade()` (internal/mcpserver/revisions.go) now does it in the established style of the pre-2025-06-18 case: a non-object `structuredContent` spelled for a 2025-06-18..2025-11-25 host is rendered into `content` as a text block and the field is removed — data preserved, forbidden shape never sent. Covered by `TestNonObjectStructuredContentIsRenderedForObjectOnlyHosts`. 8. **Peer-settled** — `nextPage` (internal/mcpclient/client.go): a missing cursor ends results in every revision; in 2026 an empty string is a valid cursor, not the end. -9. **Moot (relay direction)** — closed as the item itself proposed: no path relays upstream logs to a host that requested no level. `relayNotification` (internal/mcpclient/relay.go) delivers `notifications/message` only to relays with `LogLevel != ""` at or above the requested level, and the Relay contract records empty = "it asked for none, and OnMessage is never called"; upstream is not asked either — `beginRelay` stamps the `_meta` log level only when the host named one. See section C item C8. +9. **Moot (relay direction)** — closed as the item itself proposed: no path relays upstream logs to a host that requested no level. `relayNotification` (internal/mcpclient/relay.go) delivers `notifications/message` only to relays with `LogLevel != ""` at or above the requested level, and the Relay contract records empty = "it asked for none, and OnMessage is never called"; upstream is not asked either — `beginRelay` stamps the `_meta` log level only when the host named one. One caveat recorded at section B item C3: relays are per upstream client, so among hosts that DID request a level, delivery fans out across concurrent calls sharing that client. See section C item C8. 10. **Peer-settled** — legacy session-404 re-initialisation is era-keyed in internal/mcpclient's legacy session recovery (internal/mcpclient/client.go:1138-1145): a session-carrying 404 re-initialises on the legacy path, a modern-era 404 surfaces; on the server side an unknown method on the modern path is answered 404 with `-32601` (internal/mcpserver/server.go:879). See section B item C7. 11. **Peer-settled** — `batchRefused` (internal/mcpserver/transport.go): batches are refused outside 2025-03-26, the one revision that mandates receiving them. 12. **Recorded reading** — the schema and caching page govern over the changelog's list: `server/discover` results are `CacheableResult`s, and mcpx implements it that way — the discover result (internal/mcpserver/server.go) emits `supportedVersions`, and the modern envelope adds `ttlMs`/`cacheScope` to it as to every cacheable result (server.go:762-763; covered by `TestModernEnvelope`). -13. **Peer-settled** — both halves now era-split in code. Cancelled-task finality: the legacy path cancels sticky (`Store.CancelImmediate`, section C item C11) while the extension path cancels cooperatively (`CancelWithReason`). Missing-required-task: a non-augmented legacy call to a `taskSupport: "required"` tool is now refused `-32601` in `maybeTask` (internal/mcpserver/tasks.go) — the tool-level MUST over the error list's `-32600` (section C item C10). +13. **Peer-settled** — both halves now era-split in code. Cancelled-task finality: the legacy path cancels sticky (`Store.CancelImmediate`, section C item C11) while the extension path cancels cooperatively (`CancelWithReason`). Missing-required-task: a non-augmented call from a 2025-11-25 peer to a `taskSupport: "required"` tool is now refused `-32601` in `maybeTask` (internal/mcpserver/tasks.go) — the tool-level MUST over the error list's `-32600` (section C item C10). ## Headline items @@ -149,7 +149,7 @@ instead of a silent choice. - **Disposition:** Recorded reading — the literal reading is recorded: the sentence restricts requests, so notifications before `initialized` are not restricted by it, whatever the drafters intended by "logging". **C10. -32000..-32019: "legacy" (prose) vs "implementation-defined" (schema), 2026-07-28.** -- **Disposition:** Recorded reading — audited 2026-11-11 (#1974 sweep): mcpx's server emits no code in `-32000..-32019` on any era. The server's `-320xx` emissions are `-32002` (legacy resource-not-found, era-keyed — item C11), `-32020`/`-32021`/`-32022` (2026 spec-defined), and `-32042` (2025-11-25 era; see section E spec-internal item 2 for its server-side gap). The only `-32000` in the codebase is client-local and synthesized — `codeStreamLost` and the receive loop's "connection closed" (internal/mcpclient) — errors mcpx's client reports to its own host about a dead transport, never an answer sent to a peer, so the prose SHOULD NOT is satisfied where it binds and no grandfathering is needed. +- **Disposition:** Recorded reading — audited 2026-11-11 (#1974 sweep; qualified on PR #8652 review): mcpx's server *generates* no code in `-32000..-32019` on any era. The server's own `-320xx` emissions are `-32002` (legacy resource-not-found, era-keyed — item C11), `-32020`/`-32021`/`-32022` (2026 spec-defined), and `-32042` (2025-11-25 era; see section E spec-internal item 2 for its server-side gap). One relayed exception: the client's synthesized `-32000` (`codeStreamLost`, internal/mcpclient/http.go — a transport that closed before answering) is recognised as an upstream fault (`upstreamFault`, internal/daemon/callerr.go), converted to `mcpserver.UpstreamError` (`relayedFault`, internal/cli/serve.go) and relayed by the ask path to the downstream peer unfiltered — so a closed upstream connection can put -32000 in an answer a peer receives. The audit's conclusion is therefore split: directly generated server errors honour the prose SHOULD NOT with no grandfathering needed; relayed errors pass the upstream's (or the client's synthesized) code through by design, as everywhere else in the relay. - Prose: "**`-32000` to `-32019` — legacy.** … new implementations **SHOULD NOT** use codes from this sub-range at all." https://modelcontextprotocol.io/specification/2026-07-28/basic/index#error-codes - Schema comment: "`-32000` to `-32019`: implementation-defined. Existing SDKs and implementations use codes here for their own purposes; the specification will never define codes in this sub-range" — no SHOULD NOT. Changelog item 12: "`-32000` to `-32019` remains implementation-defined (existing SDK usage is grandfathered)". https://modelcontextprotocol.io/specification/2026-07-28/changelog#minor-changes - Also prose "Apart from `-32002` … receivers **MUST NOT** assume any specific meaning" — but -32002 is in the legacy sub-range, and the same page tells clients to accept it as resource-not-found: a single spec-assigned meaning inside a range the schema says "the specification will never define codes in". @@ -210,7 +210,7 @@ C2. **JSON-RPC batching: required-to-accept in 2025-03-26, removed 2025-06-18.** - 2024-11-05 transports page is silent on batching (JSON-RPC 2.0 allows it). C3. **Relatedness of messages on a POST's SSE stream: SHOULD → MUST.** -- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B): yes, by construction in both eras. Request handling is bound to that POST's own exchange sender (`withSender(ctx, ex.send)` in serveModern/serveLegacy, internal/mcpserver/server.go), so a notification emitted while handling a request can only go on that request's stream; there is no code path that writes an unrelated notification to a POST exchange. Session-level notifications take the other home: `streamPush` (internal/mcpserver/transport.go) writes only to the session's GET stream and drops the message when none is open — mcpx keeps no redelivery buffer and never reroutes one onto a POST stream. On modern connections the unrelated-message home is `subscriptions/listen`, as the 2026 text prescribes. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B; qualified on PR #8652 review): mcpx's own notifications are related by construction — request handling is bound to that POST's exchange sender (`withSender(ctx, ex.send)`, internal/mcpserver/server.go), and session-level notifications take the GET stream via `streamPush` (internal/mcpserver/transport.go), dropped when none is open, never rerouted onto a POST stream. One recorded gap, for *relayed upstream* log messages: relays are registered per upstream client, not per call, and `relayNotification` (internal/mcpclient/relay.go) fans a `notifications/message` out to every active relay on that client whose level matches — so when two concurrent downstream calls share an upstream instance and both requested logs, one call's log can be written to the other call's POST stream by its `CallRelay`. The sender binding therefore does not by itself establish relatedness for relayed logs; closing that needs per-call relay scoping in the client, not yet implemented. - 2025-11-25: "These messages **SHOULD** relate to the originating client _request_." (#sending-messages-to-the-server) - 2026-07-28: "These notifications **MUST** relate to the originating client request." (#receiving-messages). Unrelated server messages have no home except `subscriptions/listen`. @@ -287,7 +287,7 @@ C16. **Token acceptance subject.** - 2025-11-25+: "MCP servers **MUST** only accept tokens that are valid for use with their own resources." — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization#token-handling C17. **`WWW-Authenticate` on 401.** -- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B): the header only. When a bearer token is configured, the daemon's `requireBearer` middleware (internal/daemon/bearer.go) — which guards every /v1 and /mcp route — answers an unauthenticated request 401 with `WWW-Authenticate: Bearer`. mcpx publishes no Protected Resource Metadata: no well-known route for it exists on the daemon or the MCP server. That satisfies the 2025-06-18 MUST and the header branch of the 2025-11-25+ "one of the following" rule. +- **Disposition:** Recorded reading — verified 2026-11-11 (#1974 sweep, section B; corrected on PR #8652 review): a static-token challenge, with OAuth discovery unimplemented. When a bearer token is configured, the daemon's `requireBearer` middleware (internal/daemon/bearer.go) — which guards every /v1 and /mcp route — answers an unauthenticated request 401 with a bare `WWW-Authenticate: Bearer`. That meets the 2025-06-18 MUST (use the header on a 401). It does NOT implement either 2025-11-25+ discovery branch: the header branch requires the header to indicate the resource-metadata URL (`resource_metadata=…`), and there is no well-known metadata document either — mcpx publishes no Protected Resource Metadata anywhere. Recorded as the conformance registry does (`authz-401-www-authenticate`, internal/conformance/requirements.json): the challenge is a static-token 401, and authorization discovery is not implemented, consistent with items C13–C15. - 2025-06-18: "MCP servers **MUST** use the HTTP header `WWW-Authenticate` when returning a _401 Unauthorized_" — https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#authorization-server-location - 2025-11-25+: "MCP servers **MUST** implement one of the following discovery mechanisms" (header or well-known) — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/authorization-server-discovery#protected-resource-metadata-discovery-requirements . A 2025-06-18 client that only parses the header fails against a well-known-only 2025-11-25 server. @@ -351,7 +351,7 @@ C21. **Header name casing drift.** 2025-03-26..2025-06-18 `Mcp-Session-Id`; 2025 - Schema: "The progress thus far. This should increase every time progress is made, even if the total is unknown." https://modelcontextprotocol.io/specification/2026-07-28/schema#progressnotificationparams . Lowercase, not RFC — treat prose as governing. **C8 — log messages without a requested level: MAY ≤2025-11-25 → MUST NOT 2026-07-28.** -- **Disposition:** Moot in the relay direction — verified 2026-11-11 (#1974 sweep): no path relays upstream logs to a host that requested no level. In `relayNotification` (internal/mcpclient/relay.go) a `notifications/message` is delivered only to relays whose `LogLevel` is non-empty and whose requested level the message meets (`LogAtLeast`); the Relay contract states it outright — LogLevel empty "means it asked for none, and OnMessage is never called". Nor is upstream asked on such a host's behalf: `beginRelay` stamps the `_meta` log level (the more verbose of the host's and the client's own, `moreVerbose`) only when the host named a level. The server direction is per-request by construction in 2026: the level rides the request's `_meta` and is validated there (internal/mcpserver/server.go), and a modern server with no level named sends its host nothing through mcpx's relay. Headline 9 closed on this site. +- **Disposition:** Moot in the relay direction — verified 2026-11-11 (#1974 sweep): no path relays upstream logs to a host that requested no level. (Among hosts that did request one, delivery is per-client fan-out across concurrent calls — the relatedness gap recorded at section B item C3.) In `relayNotification` (internal/mcpclient/relay.go) a `notifications/message` is delivered only to relays whose `LogLevel` is non-empty and whose requested level the message meets (`LogAtLeast`); the Relay contract states it outright — LogLevel empty "means it asked for none, and OnMessage is never called". Nor is upstream asked on such a host's behalf: `beginRelay` stamps the `_meta` log level (the more verbose of the host's and the client's own, `moreVerbose`) only when the host named a level. The server direction is per-request by construction in 2026: the level rides the request's `_meta` and is validated there (internal/mcpserver/server.go), and a modern server with no level named sends its host nothing through mcpx's relay. Headline 9 closed on this site. - ≤2025-11-25 schema: "If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically." https://modelcontextprotocol.io/specification/2025-11-25/schema#loggingmessagenotification - 2026: "The server **MUST NOT** emit `notifications/message` for a request that does not include this field." https://modelcontextprotocol.io/specification/2026-07-28/server/utilities/logging#per-request-log-level . Also session-wide → per-request, and `logging/setLevel` removed (changelog 5). Invalid level: ≤2025-11-25 rejects the `setLevel` call; 2026 "SHOULD reject that request" — i.e. the `tools/call` (or whatever) carrying the bad `_meta`. - mcpx `docs/protocol.md` §2.2 says logging is "removed in 2026-07-28"; the spec *deprecates* it (still in schema `ServerCapabilities.logging`, still has a MUST-declare rule). Only `logging/setLevel` is removed. @@ -360,7 +360,7 @@ C21. **Header name casing drift.** 2025-03-26..2025-06-18 `Mcp-Session-Id`; 2025 - **Disposition:** Peer-settled — the client gates `completion/complete` on the declared `completions` capability, with the era exception implemented: a 2024-11-05 upstream (which had no capability to declare) is asked anyway, and its `-32601` is read as the same absence a later server signals by not declaring (internal/mcpclient/request.go:52-65, covered by request_test.go). The server side is not moot: mcpx serves from 2024-11-05 (`Oldest`, internal/mcpserver/revisions.go:14). **C10 — "task required but not used" error code (2025-11-25, spec-internal).** -- **Disposition:** Peer-settled (implemented) — verified 2026-11-11 (#1974 sweep): the tool-level MUST wins for `tools/call`, as the item text argues. `maybeTask()` (internal/mcpserver/tasks.go) now refuses a non-task-augmented legacy call to a tool whose `execution.taskSupport` is `"required"` with `-32601` (`codeMethodNotFound`, "this tool requires task-augmented execution"), before anything runs; the `-32600` of the protocol-errors list remains for request types with no tool-level rule. Previously the call executed ordinarily — `maybeTask` returned nil before any task-support check when no task was requested — which followed neither text. Covered by `TestLegacyNonAugmentedCallToRequiredToolIsRefused` (an "optional" tool called plainly still runs plainly). See headline 13. +- **Disposition:** Peer-settled (implemented) — verified 2026-11-11 (#1974 sweep): the tool-level MUST wins for `tools/call`, as the item text argues. `maybeTask()` (internal/mcpserver/tasks.go) now refuses a non-task-augmented call to a tool whose `execution.taskSupport` is `"required"` with `-32601` (`codeMethodNotFound`, "this tool requires task-augmented execution"), before anything runs; the `-32600` of the protocol-errors list remains for request types with no tool-level rule. Previously the call executed ordinarily — `maybeTask` returned nil before any task-support check when no task was requested — which followed neither text. The refusal binds only a peer whose revision defines tasks (2025-11-25): an earlier legacy peer never saw the requirement (`execution` is stripped from its listings) and its plain call still runs (PR #8652 review). Covered by `TestLegacyNonAugmentedCallToRequiredToolIsRefused` (an "optional" tool called plainly still runs plainly) and `TestPreTaskEraCallToRequiredToolStillRuns` (2025-06-18). See headline 13. - Tool-level: "If `execution.taskSupport` is `"required"` … Servers **MUST** return a `-32601` (Method not found) error if a client does not attempt to do so." https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks#tool-level-negotiation - Protocol errors: "receivers **MAY** return …: Non-task-augmented request when receiver requires task augmentation for that request type: `-32600` (Invalid request)" …#protocol-errors (and the "Task augmentation required" example there uses -32600). For `tools/call` the MUST (-32601) should win; for other request types -32600. @@ -443,7 +443,7 @@ Changelog: "Require `ttlMs` and `cacheScope` fields on results returned by `tool InitializeResult.serverInfo is a required top-level field in legacy; in 2026 it moves to `_meta['io.modelcontextprotocol/serverInfo']` and is optional SHOULD (https://modelcontextprotocol.io/specification/2026-07-28/server/discover#discoverresult). Same for `protocolVersion` (single) → `supportedVersions` (list). **C13 — tool name guidance vs aggregator reality.** -- **Disposition:** Moot — verified 2026-11-11 (#1974 sweep, section D): mcpx never prefixes. Pass-through tool names are served verbatim from the merged surface (`lookupPass`, internal/mcpserver/passthrough.go), and the collision the 2026 note's prefixing strategy exists to solve is handled the other way: two upstreams offering the same name are refused with an error naming both, and the operator chooses — drop one from `mcp.passthrough`, or reach it through `mcpx_call` under its namespace (where the name travels as an argument, not as a listed tool name). No listed name is ever lengthened by mcpx, so the 128-char/charset squeeze the prefixing strategy creates does not arise; an upstream name that itself violates the guidance arrives and leaves unchanged. +- **Disposition:** Peer-settled — verified 2026-11-11 (#1974 sweep, section D; corrected on PR #8652 review): the two surfaces differ. The pass-through surface never prefixes: names are served verbatim from the merged surface (`lookupPass`, internal/mcpserver/passthrough.go) and a collision is refused with an error naming both upstreams. The raw surface (`/mcp?codemode=false`) DOES prefix, exactly the 2026 note's strategy: `lookupRaw` (internal/mcpserver/codemode.go) exposes each tool as `_` (`TestCodemodeFalseListsRawToolsInsteadOfTheGatewaySurface` expects `db_greet`, `db_query`, `up_greet`), with collisions on the projected name refused the same way. On that surface the squeeze is real and currently unhandled: nothing truncates or re-checks the projected name, so an upstream name near the 128-char limit is served over it once prefixed. Recorded as the behaviour, with the missing length handling named rather than papered over. "Tool names **SHOULD** be unique within a server" + charset `[A-Za-z0-9_.-]` + ≤128 chars (2025-11-25+) vs the 2026 note that proxies "**SHOULD** implement a disambiguation strategy such as prefixing tool names with a server identifier" — prefixing makes the 128 limit and charset binding on the proxy's separator and on upstream names that are already long or non-conforming. Not contradictory; a squeeze. **C14 — isError vs "tool not found" (schema vs mcpx, not spec-internal).** Recorded here because it is easy to misread: the CallToolResult comment keeps "errors in _finding_ the tool … should be reported as an MCP error response" in every revision; only *argument* validation moved (C1). diff --git a/pkgs/mcpx/internal/mcpserver/tasks.go b/pkgs/mcpx/internal/mcpserver/tasks.go index 5d8b2ce753..36fac0b4b8 100644 --- a/pkgs/mcpx/internal/mcpserver/tasks.go +++ b/pkgs/mcpx/internal/mcpserver/tasks.go @@ -304,8 +304,12 @@ func (s *Server) maybeTask(ctx context.Context, c *Conn, req request, peer Peer) // protocol-errors list's -32600: that list is for // request types with no tool-level rule, and for // tools/call the MUST wins (#1974 headline 13, - // section C item C10). - if s.legacyTaskSupport(ctx, req.Params) == supportRequired { + // section C item C10). The refusal binds only a + // 2025-11-25 peer: an earlier legacy revision defines + // no tasks, never saw the requirement (downgradeItems + // strips `execution` from its listings), and its plain + // call runs as it always did (PR #8652 review). + if AtLeast(peer.Version, "2025-11-25") && s.legacyTaskSupport(ctx, req.Params) == supportRequired { return &response{JSONRPC: "2.0", ID: req.ID, Error: &rpcError{Code: codeMethodNotFound, Message: "this tool requires task-augmented execution (execution.taskSupport is required)"}} } diff --git a/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go b/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go index b50ea1b6fb..c2898086e6 100644 --- a/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go +++ b/pkgs/mcpx/internal/mcpserver/tasks_required_legacy_test.go @@ -1,9 +1,30 @@ package mcpserver_test import ( + "encoding/json" + + "github.com/developing-today/code/pkgs/mcpx/internal/mcpserver" + "net/http/httptest" + "strings" "testing" ) +// postSession posts one frame on an initialized legacy session at the +// given query string and decodes the single response frame. +func postSession(t *testing.T, s *mcpserver.Server, sid, query string, body []byte) map[string]any { + t.Helper() + r := httptest.NewRequest("POST", "/mcp?"+query, strings.NewReader(string(body))) + r.Header.Set("Content-Type", "application/json") + r.Header.Set("Mcp-Session-Id", sid) + w := httptest.NewRecorder() + s.ServeHTTP(w, r) + var m map[string]any + if err := json.Unmarshal(w.Body.Bytes(), &m); err != nil { + t.Fatalf("response does not parse: %s", w.Body.String()) + } + return m +} + // #1974 headline 13 / section C item C10: on the legacy (2025-11-25) path // a non-task-augmented call to a tool whose execution.taskSupport is // "required" is refused -32601 — the tool-level MUST ("Servers MUST @@ -13,7 +34,8 @@ import ( // page's tool-level negotiation rule. func TestLegacyNonAugmentedCallToRequiredToolIsRefused(t *testing.T) { s := rawTaskServer() - m := postQuery(s, "codemode=false", frame(1, "tools/call", + sid := legacySession(t, s, "2025-11-25") + m := postSession(t, s, sid, "codemode=false", frame(1, "tools/call", map[string]any{"name": "db_job", "arguments": map[string]any{}})) if errCode(m) != -32601 { t.Fatalf("non-augmented legacy call to a required tool: want -32601, got %v", m) @@ -21,7 +43,7 @@ func TestLegacyNonAugmentedCallToRequiredToolIsRefused(t *testing.T) { // An optional tool called the plain way still runs the plain way: // the refusal is only for "required". - m = postQuery(s, "codemode=false", frame(2, "tools/call", + m = postSession(t, s, sid, "codemode=false", frame(2, "tools/call", map[string]any{"name": "db_nap", "arguments": map[string]any{}})) if errCode(m) != 0 { t.Fatalf("non-augmented legacy call to an optional tool should run: got %v", m) @@ -30,3 +52,17 @@ func TestLegacyNonAugmentedCallToRequiredToolIsRefused(t *testing.T) { t.Fatalf("a plain call must not silently become a task: %v", m) } } + +// The refusal binds only a peer whose revision defines tasks. A +// 2025-06-18 client has no task augmentation and never saw the +// requirement (`execution` is stripped from its listings), so its +// plain call to the same tool runs as it always did (PR #8652 review). +func TestPreTaskEraCallToRequiredToolStillRuns(t *testing.T) { + s := rawTaskServer() + sid := legacySession(t, s, "2025-06-18") + m := postSession(t, s, sid, "codemode=false", frame(1, "tools/call", + map[string]any{"name": "db_job", "arguments": map[string]any{}})) + if errCode(m) != 0 { + t.Fatalf("pre-task-era call to a required tool should run: got %v", m) + } +}