Skip to content

Commit 510832a

Browse files
authored
Re-vendor 2026-07-28 schema and absorb spec #2907 error-code renumber (#2912)
1 parent 9e6d003 commit 510832a

13 files changed

Lines changed: 469 additions & 356 deletions

File tree

.github/actions/conformance/expected-failures.2026-07-28.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ server:
132132
- input-required-result-capability-check
133133
# SEP-2549 (caching): no ttlMs/cacheScope support.
134134
- caching
135-
# SEP-2243 (HTTP header standardization): -32001 HeaderMismatch handling and
135+
# SEP-2243 (HTTP header standardization): -32020 HeaderMismatch handling and
136136
# case-insensitive/whitespace-trimmed header validation not implemented.
137137
- http-header-validation
138138
- http-custom-header-server-validation

.github/actions/conformance/expected-failures.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ server:
6868
# SEP-2549 (caching): no ttlMs/cacheScope support; scenario also hits the
6969
# stateful-mode "Missing session ID" error.
7070
- caching
71-
# SEP-2243 (HTTP header standardization): -32001 HeaderMismatch handling and
71+
# SEP-2243 (HTTP header standardization): -32020 HeaderMismatch handling and
7272
# case-insensitive/whitespace-trimmed header validation not implemented.
7373
- http-header-validation
7474
- http-custom-header-server-validation

schema/2026-07-28.json

Lines changed: 97 additions & 70 deletions
Large diffs are not rendered by default.

schema/PINNED.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{
99
"protocol_version": "2026-07-28",
1010
"source_path_in_spec_repo": "schema/draft/schema.json",
11-
"spec_commit": "6d441518de8a9d5adbab0b10a76a667a63f90665",
12-
"sha256": "bce2e7c9622bb0b449475ba6d8d80228c71190a09250e75dabd502b280ecf3cb"
11+
"spec_commit": "2852f30e26ca5fb779565741ec042094cb110abd",
12+
"sha256": "ed1ad4ba94aaeb2068b78969ef901b1150f7b2f06cf86472b3032abee1380b6a"
1313
}
1414
]

scripts/gen_surface_types.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
# reuses class names across versions for unrelated schemas (e.g. `Data`).
8585
OPEN_CLASSES: dict[str, frozenset[str]] = {
8686
"2025-11-25": frozenset({"Meta", "InputSchema", "OutputSchema", "Result", "GetTaskPayloadResult", "Data"}),
87-
"2026-07-28": frozenset({"MetaObject", "RequestMetaObject", "InputSchema", "OutputSchema", "Result"}),
87+
"2026-07-28": frozenset(
88+
{"MetaObject", "NotificationMetaObject", "RequestMetaObject", "InputSchema", "OutputSchema", "Result"}
89+
),
8890
}
8991

9092
# Hand-written union aliases the wire-method maps reference by value; the schema

src/mcp/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
# Re-export JSONRPC types
200200
from mcp.types.jsonrpc import (
201201
CONNECTION_CLOSED,
202+
HEADER_MISMATCH,
202203
INTERNAL_ERROR,
203204
INVALID_PARAMS,
204205
INVALID_REQUEST,
@@ -423,6 +424,7 @@
423424
"server_result_adapter",
424425
# JSON-RPC types
425426
"CONNECTION_CLOSED",
427+
"HEADER_MISMATCH",
426428
"INTERNAL_ERROR",
427429
"INVALID_PARAMS",
428430
"INVALID_REQUEST",

src/mcp/types/_types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ class ClientCapabilities(MCPModel):
397397

398398

399399
class UnsupportedProtocolVersionErrorData(MCPModel):
400-
"""Error data for the -32004 unsupported-protocol-version error (2026-07-28)."""
400+
"""Error data for the -32022 unsupported-protocol-version error (2026-07-28)."""
401401

402402
supported: list[str]
403403
"""Protocol versions the server supports; the client should pick one and retry."""
@@ -406,7 +406,7 @@ class UnsupportedProtocolVersionErrorData(MCPModel):
406406

407407

408408
class MissingRequiredClientCapabilityErrorData(MCPModel):
409-
"""Error data for the -32003 missing-required-client-capability error (2026-07-28)."""
409+
"""Error data for the -32021 missing-required-client-capability error (2026-07-28)."""
410410

411411
required_capabilities: ClientCapabilities
412412
"""The capabilities the server requires from the client to process this request."""

src/mcp/types/jsonrpc.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,26 @@ class JSONRPCResponse(BaseModel):
4141
result: dict[str, Any]
4242

4343

44-
# MCP-specific error codes in the range [-32000, -32099]
45-
URL_ELICITATION_REQUIRED = -32042
46-
"""A URL-mode elicitation is required before the request can be processed (protocol 2025-11-25 only)."""
44+
# MCP error codes occupy the JSON-RPC server-error range -32000..-32099.
45+
# Per the 2026-07-28 spec's allocation policy:
46+
# -32000..-32019 implementation-defined
47+
# -32020..-32099 reserved for spec-defined codes, allocated sequentially from -32020
48+
# -32002, -32042 reserved-never-reused (retired by earlier protocol versions)
49+
50+
HEADER_MISMATCH = -32020
51+
"""HTTP headers do not match the request body, or required headers are missing/malformed (protocol 2026-07-28)."""
4752

48-
MISSING_REQUIRED_CLIENT_CAPABILITY = -32003
53+
MISSING_REQUIRED_CLIENT_CAPABILITY = -32021
4954
"""The server requires a client capability the request did not declare (protocol 2026-07-28)."""
5055

51-
UNSUPPORTED_PROTOCOL_VERSION = -32004
56+
UNSUPPORTED_PROTOCOL_VERSION = -32022
5257
"""The request's protocol version is not supported by the server (protocol 2026-07-28)."""
5358

54-
# SDK error codes: SDK-internal allocations in the JSON-RPC server-error range
55-
# [-32000, -32099]; not defined by the MCP schema. New values must avoid codes
56-
# the spec has allocated above.
59+
URL_ELICITATION_REQUIRED = -32042
60+
"""A URL-mode elicitation is required before the request can be processed (protocol 2025-11-25 only)."""
61+
62+
# SDK error codes: SDK-internal allocations in the implementation-defined band
63+
# -32000..-32019; not defined by the MCP schema.
5764
CONNECTION_CLOSED = -32000
5865
"""SDK-only: the connection closed before a response arrived; never emitted on the wire."""
5966

src/mcp/types/methods.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,8 @@
144144
("notifications/initialized", "2025-11-25"): v2025.InitializedNotification,
145145
("notifications/progress", "2025-11-25"): v2025.ProgressNotification,
146146
("notifications/roots/list_changed", "2025-11-25"): v2025.RootsListChangedNotification,
147-
# 2026-07-28 (initialized and roots/list_changed removed)
147+
# 2026-07-28 (initialized, progress and roots/list_changed removed)
148148
("notifications/cancelled", "2026-07-28"): v2026.CancelledNotification,
149-
("notifications/progress", "2026-07-28"): v2026.ProgressNotification,
150149
}
151150
)
152151

@@ -212,9 +211,8 @@
212211
("notifications/resources/list_changed", "2025-11-25"): v2025.ResourceListChangedNotification,
213212
("notifications/resources/updated", "2025-11-25"): v2025.ResourceUpdatedNotification,
214213
("notifications/tools/list_changed", "2025-11-25"): v2025.ToolListChangedNotification,
215-
# 2026-07-28 (adds subscriptions/acknowledged)
214+
# 2026-07-28 (adds subscriptions/acknowledged; elicitation/complete removed)
216215
("notifications/cancelled", "2026-07-28"): v2026.CancelledNotification,
217-
("notifications/elicitation/complete", "2026-07-28"): v2026.ElicitationCompleteNotification,
218216
("notifications/message", "2026-07-28"): v2026.LoggingMessageNotification,
219217
("notifications/progress", "2026-07-28"): v2026.ProgressNotification,
220218
("notifications/prompts/list_changed", "2026-07-28"): v2026.PromptListChangedNotification,

0 commit comments

Comments
 (0)