Align MCP 2026 result identity metadata#312
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the MCP 2026-07-28 “stateless” identity wire shape with spec PR #3002 by making request clientInfo optional, moving server identity to result metadata (_meta["io.modelcontextprotocol/serverInfo"]), and updating fixtures/interop tooling so CI continues to validate both compatible paths and known published-beta gaps without reintroducing obsolete body fields.
Changes:
- Updated stateless request metadata construction/validation so
clientInfois optional (but malformed present values are rejected), while protocol version + client capabilities remain required. - Updated
server/discoverand general result serialization to carry server identity in result_meta(and avoid emitting bodyserverInfo), with temporary read-compat for older published peers. - Refreshed interop runners, conformance baselines, CLI inspection behavior, docs, and CI workflows to reflect the final wire shape and track expected published-beta gaps explicitly.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tool/testing/run_ts_2026_07_28_interop.dart | Adds direction selection + explicit “published TS beta gap” handling; probes discovery wire shape before running the TS client. |
| tool/testing/run_python_2026_07_28_interop.dart | Adds direction selection + explicit “published Python beta gap” handling while keeping the required Dart→Python path. |
| test/types_test.dart | Updates DiscoverResult parsing tests to use _meta.serverInfo and treat malformed identity as anonymous. |
| test/tool/run_ts_2026_07_28_interop_test.dart | Tests argument validation for the TS interop runner’s expected-gap flag. |
| test/tool/run_python_2026_07_28_interop_test.dart | Tests argument validation for the Python interop runner’s expected-gap flag and early exit behavior. |
| test/mcp_2026_07_28_test.dart | Adds/adjusts protocol tests around optional identities and result metadata merging/stamping. |
| test/interop/ts_2026_07_28/src/client.mjs | Updates the TS fixture to read server identity from discovery result metadata and assert body serverInfo absence. |
| test/interop/ts_2026_07_28/README.md | Documents the split-direction runs and the temporary published-beta expected-gap behavior. |
| test/interop/python_2026_07_28/README.md | Documents the required Dart→Python direction and the Python-beta reverse-direction expected-gap behavior. |
| test/conformance/README.md | Updates conformance documentation to reflect the known published referee gap for server-stateless. |
| test/conformance/2026_07_28_expected_failures.txt | Tracks server-stateless as an expected failure for the pinned published conformance package. |
| packages/mcp_dart_cli/test/src/inspect_server_command_test.dart | Verifies server inspector behavior for stamped identity and anonymous stateless server identity. |
| packages/mcp_dart_cli/test/src/inspect_client_command_test.dart | Verifies client inspector accepts anonymous clients and stamps server identity in result metadata. |
| packages/mcp_dart_cli/test/fixtures/stateless_inventory_server.dart | Updates CLI fixture to emit identity via result _meta (or omit for --anonymous). |
| packages/mcp_dart_cli/lib/src/inspect_server_command.dart | Treats missing stateless server identity as “info” (optional) instead of failing the inspection. |
| packages/mcp_dart_cli/lib/src/inspect_client_command.dart | Accepts stateless requests without clientInfo, rejects invalid present identity, and stamps server identity in results. |
| packages/mcp_dart_cli/lib/src/conformance_runner.dart | Updates 2026 conformance expectations and checks for server identity in result metadata (not body). |
| lib/src/types/json_rpc.dart | Adds McpMetaKey.serverInfo, makes buildProtocolRequestMeta clientInfo optional, and merges response/result metadata in JsonRpcResponse.toJson(). |
| lib/src/types/initialization.dart | Makes DiscoverResult.serverInfo nullable, reads identity from result _meta, and writes identity into _meta (not body). |
| lib/src/shared/protocol.dart | Ensures response metadata accounts for serialized result metadata when building JsonRpcResponse. |
| lib/src/server/server.dart | Validates optional clientInfo correctly and stamps configured server identity into result _meta by default. |
| lib/src/client/client.dart | Updates discovery logging to handle anonymous servers without null dereferences. |
| doc/spec-coverage-2026-07-28.md | Updates coverage claims and commands for split-direction interop and expected published gaps. |
| doc/mcp-2026-07-28.md | Documents stateless identity metadata semantics and the temporary legacy read fallback. |
| doc/mcp-2026-07-28-release-runbook.md | Updates release checklist commands for split-direction interop runs and expected-gap checks. |
| doc/interoperability.md | Updates interoperability matrix and local commands to reflect known published-beta gaps vs verified directions. |
| CHANGELOG.md | Adds unreleased changelog entry describing the 2026 stateless identity alignment and nullable discovery identity. |
| .github/workflows/interop_2026_07_28.yml | Splits TS/Python interop jobs into required direction + explicit expected-gap verification steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #312 +/- ##
==========================================
+ Coverage 85.68% 85.79% +0.11%
==========================================
Files 71 71
Lines 16530 16609 +79
==========================================
+ Hits 14163 14250 +87
+ Misses 2367 2359 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
2026-07-28stateless request identity with specification PR #3002:clientInfois optional while protocol version and client capabilities remain required_meta["io.modelcontextprotocol/serverInfo"], stamp configured identity by default, omit handler-authored null identity, and stop emitting discovery bodyserverInfo_meta, while keeping explicit serialized metadata authoritative and protocol-owned subscription metadata intact2025-11-25opaque metadata behavior and a read-only fallback for published pre-#3002 beta serversCompatibility and breaking changes
2025-11-25initialization, metadata, and wire behavior remain unchanged.DiscoverResult.serverInfochanges fromImplementationtoImplementation?. Callers that dereference it must null-check it; this is the intentional public source break required by optional 2026 server identity.clientInfooptional is source-compatible.2.0.0-beta.4and Python2.0.0b2server directions pass. Their pre-#3002 reverse-client behavior is isolated behind independent raw 2026 probes and exact self-expiring expected gaps rather than re-emitting the obsolete discovery body field.Validation
dart analyze— no issuesdart test— 1,611 passedpackages/mcp_dart_cli:dart analyze— no issues;dart test— 118 passed, 14 optional external-fixture skips2025-11-25server suite — 52 success checks plus 7 informational checks; client suite — 221 passed2026-07-28: client — 32 passed; server — 39 passed plus only the exact three documented pre-#3002 diagnosticsdart format,actionlint,git diff --check, docs tests, workflow tests, malformed-metadata regressions, custom-result metadata precedence/fallback tests, bounded-body tests, and exact conformance-baseline tests — passed