Align 2026-07-28 wire with spec PR #3002: serverInfo in result _meta, clientInfo optional (#2513)

This commit is contained in:
Felix Weinberger 2026-07-20 16:09:55 +01:00 • committed by GitHub
commit f4137630c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 933 additions and 207 deletions

View file

@ -44,7 +44,7 @@ The recorded value is the server's whole advertisement — supported versions, c
cacheScope: 'private',
supportedVersions: [ '2026-07-28' ],
capabilities: { tools: { listChanged: true } },
serverInfo: { name: 'gateway-target', version: '1.0.0' },
_meta: { 'io.modelcontextprotocol/serverInfo': { name: 'gateway-target', version: '1.0.0' } },
resultType: 'complete'
}
```

View file

@ -26,6 +26,7 @@ below.
- [Auth on 2026-07-28](#auth-on-2026-07-28)
- [Per-era wire codecs](#per-era-wire-codecs)
- [Wire-only members hidden from public types](#wire-only-members-hidden-from-public-types)
- [Server identity in result `_meta`; `clientInfo` demoted to SHOULD](#server-identity-in-result-_meta-clientinfo-demoted-to-should)
- [Multi-round-trip requests](#multi-round-trip-requests)
- [Legacy shim for `input_required`](#legacy-shim-for-input_required)
- [`subscriptions/listen`](#subscriptionslisten)
@ -417,6 +418,35 @@ the instance's negotiated era.
---
## Server identity in result `_meta`; `clientInfo` demoted to SHOULD
The final 2026-07-28 revision (spec PR #3002) moved server identity out of the
`DiscoverResult` body: servers identify themselves via
`_meta['io.modelcontextprotocol/serverInfo']` (constant `SERVER_INFO_META_KEY`) on
every response, and the per-request envelope's `clientInfo` is a SHOULD instead of a
requirement.
What the SDK does:
- **Server.** Every 2026-era response gets the `_meta` serverInfo stamp (a
handler-authored value wins; 2025-era responses are untouched) — including the
entry-built `subscriptions/listen` graceful-close results, whose `_meta` carries
the identity next to the subscription id. Requests without `clientInfo` are
served; a present-but-malformed value is still rejected.
- **Client.** `clientInfo` is still sent on every request (the spec SHOULD).
`getServerVersion()` reads the discover result's `_meta`. A server that stamps no
identity is simply anonymous: the connection works, `getServerVersion()` is
`undefined`, and the response cache partitions under a per-connection surrogate.
- **Types.** `DiscoverResult` has no `serverInfo` member, and `RequestMetaEnvelope`'s
`clientInfo` is optional. Code that read `discover.serverInfo` moves to
`client.getServerVersion()` (or the `_meta` key directly).
`serverInfo`/`clientInfo` are self-reported and intended for display, logging, and
debugging — do not use them for behavior or security decisions. A malformed `_meta`
serverInfo value is treated as absent on receive, per the same clause.
---
## Multi-round-trip requests
The 2026-07-28 revision removes the server→client JSON-RPC request channel. Servers