Skip to content

Commit 406d533

Browse files
committed
Protocol types for 2026-07-28: superset monolith, committed per-version packages, and wire-method maps
One public type set (mcp.types) covering every protocol revision through 2026-07-28, two committed per-version model packages that act as the schema-exact validating layer, and plain (method, version) maps with two-step parse functions. Version gating is data: key absence is the gate. Outbound serialization is the model dump, with the new 2026-07-28 result fields as ordinary serialized defaults.
1 parent 1012d60 commit 406d533

15 files changed

Lines changed: 5492 additions & 190 deletions

File tree

docs/migration.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ Common renames:
221221

222222
Because `populate_by_name=True` is set, the old camelCase names still work as constructor kwargs (e.g., `Tool(inputSchema={...})` is accepted), but attribute access must use snake_case (`tool.input_schema`).
223223

224+
### Results now serialize `resultType` and cache-directive defaults
225+
226+
Serialized results now include `resultType` by default (and `ttlMs`/`cacheScope` on cacheable results). Peers ignore unknown result fields, so this interoperates across protocol versions, but tests or recorded fixtures that compare exact serialized payloads need the new keys added.
227+
224228
### `args` parameter removed from `ClientSessionGroup.call_tool()`
225229

226230
The deprecated `args` parameter has been removed from `ClientSessionGroup.call_tool()`. Use `arguments` instead.
@@ -1181,7 +1185,7 @@ Behavior changes:
11811185

11821186
### Experimental Tasks support removed
11831187

1184-
Tasks (SEP-1686) have been removed from the MCP specification and are no longer part of this SDK. The `mcp.client.experimental`, `mcp.server.experimental`, `mcp.shared.experimental`, and `mcp.server.lowlevel.experimental` modules have been removed, along with all `Task*` types, the `tasks` capability fields, `Tool.execution`, and the `experimental` properties on `ClientSession`, `ServerSession`, `Server`, and `ServerRequestContext`.
1188+
Tasks (SEP-1686) have been removed from the MCP specification and are no longer part of this SDK. The `mcp.client.experimental`, `mcp.server.experimental`, `mcp.shared.experimental`, and `mcp.server.lowlevel.experimental` modules have been removed, along with the `experimental` properties on `ClientSession`, `ServerSession`, `Server`, and `ServerRequestContext`. The corresponding `Task*` types remain in `mcp.types` as types-only definitions.
11851189

11861190
Tasks are expected to return as a separate MCP extension in a future release.
11871191

@@ -1227,6 +1231,10 @@ If you relied on extra fields round-tripping through MCP types, move that data i
12271231

12281232
## New Features
12291233

1234+
### 2025-11-25 and 2026-07-28 protocol fields modeled
1235+
1236+
`mcp.types` models the 2025-11-25 and 2026-07-28 protocol fields (e.g. `resultType`, `ttlMs`/`cacheScope` on cacheable results, `inputResponses`/`requestState` on retried requests), so inbound payloads carrying these keys parse into typed fields and round-trip. Most are optional with `None` defaults; the result-directive fields carry serialized defaults - see [Results now serialize `resultType` and cache-directive defaults](#results-now-serialize-resulttype-and-cache-directive-defaults).
1237+
12301238
### `streamable_http_app()` available on lowlevel Server
12311239

12321240
The `streamable_http_app()` method is now available directly on the lowlevel `Server` class, not just `MCPServer`. This allows using the streamable HTTP transport without the MCPServer wrapper.

src/mcp/shared/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"2025-03-26",
1717
"2025-06-18",
1818
"2025-11-25",
19+
"2026-07-28",
1920
)
2021
"""Every released protocol revision, oldest to newest."""
2122

src/mcp/types/__init__.py

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
"""This module defines the types for the MCP protocol.
22
33
Check the latest schema at:
4-
https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-11-25/schema.json
4+
https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/draft/schema.json
55
"""
66

77
# Re-export everything from _types for backward compatibility
88
from mcp.types._types import (
9+
CLIENT_CAPABILITIES_META_KEY,
10+
CLIENT_INFO_META_KEY,
911
DEFAULT_NEGOTIATED_VERSION,
1012
LATEST_PROTOCOL_VERSION,
13+
LOG_LEVEL_META_KEY,
14+
PROTOCOL_VERSION_META_KEY,
1115
Annotations,
1216
AudioContent,
1317
BaseMetadata,
1418
BlobResourceContents,
19+
CacheableResult,
1520
CallToolRequest,
1621
CallToolRequestParams,
1722
CallToolResult,
1823
CancelledNotification,
1924
CancelledNotificationParams,
25+
CancelTaskRequest,
26+
CancelTaskRequestParams,
27+
CancelTaskResult,
2028
ClientCapabilities,
2129
ClientNotification,
2230
ClientRequest,
@@ -33,6 +41,9 @@
3341
CreateMessageRequestParams,
3442
CreateMessageResult,
3543
CreateMessageResultWithTools,
44+
CreateTaskResult,
45+
DiscoverRequest,
46+
DiscoverResult,
3647
ElicitationCapability,
3748
ElicitationRequiredErrorData,
3849
ElicitCompleteNotification,
@@ -49,6 +60,12 @@
4960
GetPromptRequest,
5061
GetPromptRequestParams,
5162
GetPromptResult,
63+
GetTaskPayloadRequest,
64+
GetTaskPayloadRequestParams,
65+
GetTaskPayloadResult,
66+
GetTaskRequest,
67+
GetTaskRequestParams,
68+
GetTaskResult,
5269
Icon,
5370
IconTheme,
5471
ImageContent,
@@ -58,6 +75,12 @@
5875
InitializeRequest,
5976
InitializeRequestParams,
6077
InitializeResult,
78+
InputRequest,
79+
InputRequests,
80+
InputRequiredResult,
81+
InputResponse,
82+
InputResponseRequestParams,
83+
InputResponses,
6184
ListPromptsRequest,
6285
ListPromptsResult,
6386
ListResourcesRequest,
@@ -66,12 +89,15 @@
6689
ListResourceTemplatesResult,
6790
ListRootsRequest,
6891
ListRootsResult,
92+
ListTasksRequest,
93+
ListTasksResult,
6994
ListToolsRequest,
7095
ListToolsResult,
7196
LoggingCapability,
7297
LoggingLevel,
7398
LoggingMessageNotification,
7499
LoggingMessageNotificationParams,
100+
MissingRequiredClientCapabilityErrorData,
75101
ModelHint,
76102
ModelPreferences,
77103
Notification,
@@ -92,6 +118,7 @@
92118
ReadResourceRequest,
93119
ReadResourceRequestParams,
94120
ReadResourceResult,
121+
RelatedTaskMetadata,
95122
Request,
96123
RequestParams,
97124
RequestParamsMeta,
@@ -105,6 +132,7 @@
105132
ResourceUpdatedNotification,
106133
ResourceUpdatedNotificationParams,
107134
Result,
135+
ResultType,
108136
Role,
109137
Root,
110138
RootsCapability,
@@ -124,17 +152,29 @@
124152
StopReason,
125153
SubscribeRequest,
126154
SubscribeRequestParams,
155+
SubscriptionFilter,
156+
SubscriptionsAcknowledgedNotification,
157+
SubscriptionsAcknowledgedNotificationParams,
158+
SubscriptionsListenRequest,
159+
SubscriptionsListenRequestParams,
160+
Task,
161+
TaskMetadata,
162+
TaskStatus,
163+
TaskStatusNotification,
164+
TaskStatusNotificationParams,
127165
TextContent,
128166
TextResourceContents,
129167
Tool,
130168
ToolAnnotations,
131169
ToolChoice,
170+
ToolExecution,
132171
ToolListChangedNotification,
133172
ToolResultContent,
134173
ToolsCapability,
135174
ToolUseContent,
136175
UnsubscribeRequest,
137176
UnsubscribeRequestParams,
177+
UnsupportedProtocolVersionErrorData,
138178
UrlElicitationCapability,
139179
client_notification_adapter,
140180
client_request_adapter,
@@ -150,9 +190,12 @@
150190
INTERNAL_ERROR,
151191
INVALID_PARAMS,
152192
INVALID_REQUEST,
193+
JSONRPC_VERSION,
153194
METHOD_NOT_FOUND,
195+
MISSING_REQUIRED_CLIENT_CAPABILITY,
154196
PARSE_ERROR,
155197
REQUEST_TIMEOUT,
198+
UNSUPPORTED_PROTOCOL_VERSION,
156199
URL_ELICITATION_REQUIRED,
157200
ErrorData,
158201
JSONRPCError,
@@ -168,28 +211,41 @@
168211
# Protocol version constants
169212
"LATEST_PROTOCOL_VERSION",
170213
"DEFAULT_NEGOTIATED_VERSION",
214+
# Reserved request _meta keys
215+
"PROTOCOL_VERSION_META_KEY",
216+
"CLIENT_INFO_META_KEY",
217+
"CLIENT_CAPABILITIES_META_KEY",
218+
"LOG_LEVEL_META_KEY",
171219
# Type aliases and variables
172220
"ContentBlock",
173221
"ElicitRequestedSchema",
174222
"ElicitRequestParams",
175223
"IncludeContext",
224+
"InputRequest",
225+
"InputRequests",
226+
"InputResponse",
227+
"InputResponses",
176228
"LoggingLevel",
177229
"ProgressToken",
230+
"ResultType",
178231
"Role",
179232
"SamplingContent",
180233
"SamplingMessageContentBlock",
181234
"StopReason",
235+
"TaskStatus",
182236
# Base classes
183237
"BaseMetadata",
184238
"Request",
185239
"Notification",
186240
"Result",
187241
"RequestParams",
188242
"RequestParamsMeta",
243+
"InputResponseRequestParams",
189244
"NotificationParams",
190245
"PaginatedRequest",
191246
"PaginatedRequestParams",
192247
"PaginatedResult",
248+
"CacheableResult",
193249
"EmptyResult",
194250
# Capabilities
195251
"ClientCapabilities",
@@ -236,27 +292,40 @@
236292
"ResourceTemplateReference",
237293
"Root",
238294
"SamplingMessage",
295+
"SubscriptionFilter",
296+
"Task",
297+
"TaskMetadata",
298+
"RelatedTaskMetadata",
239299
"Tool",
240300
"ToolAnnotations",
241301
"ToolChoice",
302+
"ToolExecution",
242303
# Requests
243304
"CallToolRequest",
244305
"CallToolRequestParams",
245306
"CompleteRequest",
246307
"CompleteRequestParams",
308+
"CancelTaskRequest",
309+
"CancelTaskRequestParams",
247310
"CreateMessageRequest",
248311
"CreateMessageRequestParams",
312+
"DiscoverRequest",
249313
"ElicitRequest",
250314
"ElicitRequestFormParams",
251315
"ElicitRequestURLParams",
252316
"GetPromptRequest",
253317
"GetPromptRequestParams",
318+
"GetTaskPayloadRequest",
319+
"GetTaskPayloadRequestParams",
320+
"GetTaskRequest",
321+
"GetTaskRequestParams",
254322
"InitializeRequest",
255323
"InitializeRequestParams",
256324
"ListPromptsRequest",
257325
"ListResourcesRequest",
258326
"ListResourceTemplatesRequest",
259327
"ListRootsRequest",
328+
"ListTasksRequest",
260329
"ListToolsRequest",
261330
"PingRequest",
262331
"ReadResourceRequest",
@@ -265,23 +334,35 @@
265334
"SetLevelRequestParams",
266335
"SubscribeRequest",
267336
"SubscribeRequestParams",
337+
"SubscriptionsListenRequest",
338+
"SubscriptionsListenRequestParams",
268339
"UnsubscribeRequest",
269340
"UnsubscribeRequestParams",
270341
# Results
271342
"CallToolResult",
343+
"CancelTaskResult",
272344
"CompleteResult",
273345
"CreateMessageResult",
274346
"CreateMessageResultWithTools",
347+
"CreateTaskResult",
348+
"DiscoverResult",
275349
"ElicitResult",
276350
"ElicitationRequiredErrorData",
277351
"GetPromptResult",
352+
"GetTaskPayloadResult",
353+
"GetTaskResult",
278354
"InitializeResult",
355+
"InputRequiredResult",
279356
"ListPromptsResult",
280357
"ListResourcesResult",
281358
"ListResourceTemplatesResult",
282359
"ListRootsResult",
360+
"ListTasksResult",
283361
"ListToolsResult",
284362
"ReadResourceResult",
363+
# Error data payloads
364+
"MissingRequiredClientCapabilityErrorData",
365+
"UnsupportedProtocolVersionErrorData",
285366
# Notifications
286367
"CancelledNotification",
287368
"CancelledNotificationParams",
@@ -297,6 +378,10 @@
297378
"ResourceUpdatedNotification",
298379
"ResourceUpdatedNotificationParams",
299380
"RootsListChangedNotification",
381+
"SubscriptionsAcknowledgedNotification",
382+
"SubscriptionsAcknowledgedNotificationParams",
383+
"TaskStatusNotification",
384+
"TaskStatusNotificationParams",
300385
"ToolListChangedNotification",
301386
# Union types for request/response routing
302387
"ClientNotification",
@@ -317,9 +402,12 @@
317402
"INTERNAL_ERROR",
318403
"INVALID_PARAMS",
319404
"INVALID_REQUEST",
405+
"JSONRPC_VERSION",
320406
"METHOD_NOT_FOUND",
407+
"MISSING_REQUIRED_CLIENT_CAPABILITY",
321408
"PARSE_ERROR",
322409
"REQUEST_TIMEOUT",
410+
"UNSUPPORTED_PROTOCOL_VERSION",
323411
"URL_ELICITATION_REQUIRED",
324412
"ErrorData",
325413
"JSONRPCError",

0 commit comments

Comments
 (0)