You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move server identity to result _meta and stamp every 2026-era result (spec #3002)
The 2026-07-28 draft removed the serverInfo body field from DiscoverResult:
servers now report identity by stamping io.modelcontextprotocol/serverInfo
into every result's _meta (new ResultMetaObject type), and clients treat it
as optional, display-only metadata.
Server side:
- DiscoverResult loses server_info (monolith and generated surface); the
default discover handler no longer passes identity.
- Every 2026-era result is stamped at the runner's single exit point, after
the middleware chain, so custom methods, empty results, and middleware
short-circuits are covered by construction. Stamping builds a shallow copy
rather than mutating a dict the handler may retain, a handler-authored
value wins, and the dumped stamp is cached per server. Notifications,
error responses, and handshake-era results are never stamped.
- Opt-out per the spec's 'unless specifically configured not to do so':
Server(include_server_info=False), also exposed on MCPServer.
Client side:
- ClientSession.server_info reads the discover result's _meta stamp, parsed
once at adopt time; absent or malformed reads as None (the spec forbids
acting on the value, so a bad stamp must not fail the connection). The
wire surface keeps the field untyped for the same reason, via a
shape-driven transform in the generator that stays lenient for future
result-meta definitions.
- Client.server_info is now Implementation | None. This also fixes a live
interop break: servers that already shipped the new shape omit the body
field, which previously failed our discover validation and silently
downgraded auto mode to the legacy handshake.
Tests: the interaction matrix runs with stamping off (the stamp would bake
the commit-dependent package version into every snapshot); stamping has
dedicated unit and wire-level coverage in tests/server/, and the tests that
exercise identity assert the new _meta form.
0 commit comments