Skip to content

Align MCP 2026 result identity metadata#312

Merged
leehack merged 3 commits into
mainfrom
fix/2026-result-identity-metadata-main
Jul 20, 2026
Merged

Align MCP 2026 result identity metadata#312
leehack merged 3 commits into
mainfrom
fix/2026-result-identity-metadata-main

Conversation

@leehack

@leehack leehack commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • align MCP 2026-07-28 stateless request identity with specification PR #3002: clientInfo is optional while protocol version and client capabilities remain required
  • move server identity to result _meta["io.modelcontextprotocol/serverInfo"], stamp configured identity by default, omit handler-authored null identity, and stop emitting discovery body serverInfo
  • preserve metadata from legacy/custom results when their serializer omits _meta, while keeping explicit serialized metadata authoritative and protocol-owned subscription metadata intact
  • reject present null or malformed canonical result identity for the 2026/stateless protocol while preserving MCP 2025-11-25 opaque metadata behavior and a read-only fallback for published pre-#3002 beta servers
  • make CLI inspection work when discovery is skipped, replace scenario-wide conformance allowances with exact fail-closed diagnostics, and bound cross-SDK probe response reads
  • update CI path filters, TypeScript/Python fixtures, changelogs, interoperability docs, spec coverage, migration guidance, and the immutable spec-audit pin

Compatibility and breaking changes

  • MCP 2025-11-25 initialization, metadata, and wire behavior remain unchanged.
  • DiscoverResult.serverInfo changes from Implementation to Implementation?. Callers that dereference it must null-check it; this is the intentional public source break required by optional 2026 server identity.
  • Making configured server identity and request clientInfo optional is source-compatible.
  • Published TypeScript 2.0.0-beta.4 and Python 2.0.0b2 server 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.
  • TypeScript SDK PR #2513 passes the full modern metadata-only flow.

Validation

  • root dart analyze — no issues
  • root dart test — 1,611 passed
  • packages/mcp_dart_cli: dart analyze — no issues; dart test — 118 passed, 14 optional external-fixture skips
  • official MCP 2025-11-25 server suite — 52 success checks plus 7 informational checks; client suite — 221 passed
  • published conformance alpha.9 MCP 2026-07-28: client — 32 passed; server — 39 passed plus only the exact three documented pre-#3002 diagnostics
  • merged conformance PR #403 focused stateless scenario — passed
  • Dart client → TypeScript beta.4 and Python 2.0.0b2 — passed
  • independent raw 2026 probes for TypeScript beta.4/Python 2.0.0b2 client → Dart — passed before their exact known beta negotiation gaps
  • TypeScript SDK #2513 preview client → Dart — full modern flow passed; published beta.4 fixture restored afterward
  • spec example audit — 128/128 parsed; document inventory — 31/31 current
  • root and CLI publish validation — 0 warnings
  • dart 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

Copilot AI review requested due to automatic review settings July 19, 2026 21:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 clientInfo is optional (but malformed present values are rejected), while protocol version + client capabilities remain required.
  • Updated server/discover and general result serialization to carry server identity in result _meta (and avoid emitting body serverInfo), 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

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.91837% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.79%. Comparing base (c961c33) to head (0ea9bec).

Files with missing lines Patch % Lines
...s/mcp_dart_cli/lib/src/inspect_client_command.dart 92.85% 3 Missing ⚠️
...kages/mcp_dart_cli/lib/src/conformance_runner.dart 92.00% 2 Missing ⚠️
lib/src/shared/protocol.dart 95.00% 1 Missing ⚠️
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     
Flag Coverage Δ
cli 77.80% <92.75%> (+0.33%) ⬆️
unittests 89.08% <98.71%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI review requested due to automatic review settings July 20, 2026 10:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.

Comment thread lib/src/server/server.dart
Copilot AI review requested due to automatic review settings July 20, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 38 changed files in this pull request and generated no new comments.

@leehack
leehack merged commit c1743c2 into main Jul 20, 2026
21 checks passed
@leehack
leehack deleted the fix/2026-result-identity-metadata-main branch July 20, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants