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
-`connect()` under `versionNegotiation: 'auto'` / `{ pin }` now rejects with `UnauthorizedError` directly when the auth provider rejects the connect-time probe (previously wrapped in `SdkError(VersionNegotiationFailed).data.cause`). `UnauthorizedError` now sets `error.name`.
9
+
- New `ClientOptions.logLevel`: auto-attaches the `io.modelcontextprotocol/logLevel``_meta` envelope key on 2026-07-28 connections, and sends a single best-effort `logging/setLevel` after a 2025-era handshake when the server advertises `logging`.
10
+
- New `ListRequestOptions.allPages`: pass `{ allPages: false }` to `listTools()` / `listPrompts()` / `listResources()` / `listResourceTemplates()` to fetch only the first page (with its raw `nextCursor`) instead of auto-aggregating.
11
+
- New `SdkErrorCode.ResultProtocolMismatch`: a 2026-07-28 peer result that omits or malforms the REQUIRED `resultType` discriminator now rejects with this code (was `InvalidResult`), so tooling can classify a non-conformant peer separately from a malformed payload.
12
+
-**Breaking (alpha-only):**`SdkErrorCode.EraNegotiationFailed` is renamed to `SdkErrorCode.VersionNegotiationFailed` (string value `'VERSION_NEGOTIATION_FAILED'`).
{@linkcode@modelcontextprotocol/client!client/client.Client#getDiscoverResult | client.getDiscoverResult()} returns the value that the `'auto'`/pinned probe path, an explicit {@linkcode@modelcontextprotocol/client!client/client.Client#discover | client.discover()} call, or a
140
-
prior `connect({ prior })` recorded; it round-trips through `JSON.stringify`/`JSON.parse`. `connect({ prior })` is **2026-07-28+ only** — it rejects with `SdkError(EraNegotiationFailed)` when the supplied result and the client share no modern revision. Only reuse a persisted
140
+
prior `connect({ prior })` recorded; it round-trips through `JSON.stringify`/`JSON.parse`. `connect({ prior })` is **2026-07-28+ only** — it rejects with `SdkError(VersionNegotiationFailed)` when the supplied result and the client share no modern revision. Only reuse a persisted
141
141
`DiscoverResult` across clients that present the **same authorization context** as the one that obtained it. See the [`gateway/` example](../examples/gateway/README.md) for the full probe-once / connect-many pattern with a server-side proof.
142
142
143
143
### Disconnecting
@@ -298,7 +298,7 @@ try {
298
298
returnclient;
299
299
} catch (error) {
300
300
// With version negotiation, the connect-time 401 may surface wrapped as
301
-
// SdkError(EraNegotiationFailed) whose .data.cause is the UnauthorizedError.
301
+
// SdkError(VersionNegotiationFailed) whose .data.cause is the UnauthorizedError.
Copy file name to clipboardExpand all lines: docs/migration/upgrade-to-v2.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -493,11 +493,12 @@ if (error instanceof SdkHttpError) {
493
493
|`ConnectionClosed`| Connection was closed |
494
494
|`SendFailed`| Failed to send message |
495
495
|`InvalidResult`| Response result failed local schema validation |
496
+
|`ResultProtocolMismatch`| The peer returned a result whose shape does not match the negotiated protocol version's schema (e.g. a 2026-07-28 peer omitted the REQUIRED `resultType` discriminator) |
496
497
|`UnsupportedResultType`| A 2026-era response carried an unrecognized `resultType`|
497
498
|`InputRequiredRoundsExceeded`| Multi-round-trip auto-fulfilment hit `maxRounds`|
498
499
|`ListPaginationExceeded`| No-arg `list*()` aggregate walk hit `listMaxPages`|
499
500
|`MethodNotSupportedByProtocolVersion`| Outbound spec method does not exist on the negotiated protocol version |
500
-
|`EraNegotiationFailed`|`connect()` could not negotiate a protocol era (probe failed / no overlap) |
501
+
|`VersionNegotiationFailed`|`connect()` could not negotiate a protocol version (probe failed / no overlap). Auth-required connects throw `UnauthorizedError` directly in every negotiation mode — `VersionNegotiationFailed` is reserved for genuine negotiation failures|
501
502
|`ClientHttpNotImplemented`| HTTP POST request failed |
502
503
|`ClientHttpAuthentication`| Server returned 401 after re-authentication |
503
504
|`ClientHttpForbidden`| Server returned 403 `insufficient_scope` after step-up retry cap |
Copy file name to clipboardExpand all lines: examples/gateway/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,4 +47,4 @@ The server exposes a `request_count` tool returning how many MCP requests reache
47
47
Only reuse a persisted `DiscoverResult` across workers that present the **same authorization context** as the bootstrap client (key the blob on a credential hash). Adopting a wider `prior` does not grant access — the server authorizes every request — but it can mislead
48
48
client-side capability gating.
49
49
50
-
`connect({ prior })` is **modern-only**: no mutual 2026-07-28+ revision → `SdkError(EraNegotiationFailed)`. Use `versionNegotiation: { mode: 'auto' }` for legacy-era fallback.
50
+
`connect({ prior })` is **modern-only**: no mutual 2026-07-28+ revision → `SdkError(VersionNegotiationFailed)`. Use `versionNegotiation: { mode: 'auto' }` for legacy-era fallback.
0 commit comments