Skip to content

Commit e3f0632

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 cf110e3 commit e3f0632

15 files changed

Lines changed: 5494 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.
@@ -1168,7 +1172,7 @@ In practice, replace direct `ServerSession` use with `Server.run(read_stream, wr
11681172

11691173
### Experimental Tasks support removed
11701174

1171-
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`.
1175+
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.
11721176

11731177
Tasks are expected to return as a separate MCP extension in a future release.
11741178

@@ -1214,6 +1218,10 @@ If you relied on extra fields round-tripping through MCP types, move that data i
12141218

12151219
## New Features
12161220

1221+
### 2025-11-25 and 2026-07-28 protocol fields modeled
1222+
1223+
`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).
1224+
12171225
### `streamable_http_app()` available on lowlevel Server
12181226

12191227
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,10 +190,13 @@
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_CANCELLED,
156198
REQUEST_TIMEOUT,
199+
UNSUPPORTED_PROTOCOL_VERSION,
157200
URL_ELICITATION_REQUIRED,
158201
ErrorData,
159202
JSONRPCError,
@@ -169,28 +212,41 @@
169212
# Protocol version constants
170213
"LATEST_PROTOCOL_VERSION",
171214
"DEFAULT_NEGOTIATED_VERSION",
215+
# Reserved request _meta keys
216+
"PROTOCOL_VERSION_META_KEY",
217+
"CLIENT_INFO_META_KEY",
218+
"CLIENT_CAPABILITIES_META_KEY",
219+
"LOG_LEVEL_META_KEY",
172220
# Type aliases and variables
173221
"ContentBlock",
174222
"ElicitRequestedSchema",
175223
"ElicitRequestParams",
176224
"IncludeContext",
225+
"InputRequest",
226+
"InputRequests",
227+
"InputResponse",
228+
"InputResponses",
177229
"LoggingLevel",
178230
"ProgressToken",
231+
"ResultType",
179232
"Role",
180233
"SamplingContent",
181234
"SamplingMessageContentBlock",
182235
"StopReason",
236+
"TaskStatus",
183237
# Base classes
184238
"BaseMetadata",
185239
"Request",
186240
"Notification",
187241
"Result",
188242
"RequestParams",
189243
"RequestParamsMeta",
244+
"InputResponseRequestParams",
190245
"NotificationParams",
191246
"PaginatedRequest",
192247
"PaginatedRequestParams",
193248
"PaginatedResult",
249+
"CacheableResult",
194250
"EmptyResult",
195251
# Capabilities
196252
"ClientCapabilities",
@@ -237,27 +293,40 @@
237293
"ResourceTemplateReference",
238294
"Root",
239295
"SamplingMessage",
296+
"SubscriptionFilter",
297+
"Task",
298+
"TaskMetadata",
299+
"RelatedTaskMetadata",
240300
"Tool",
241301
"ToolAnnotations",
242302
"ToolChoice",
303+
"ToolExecution",
243304
# Requests
244305
"CallToolRequest",
245306
"CallToolRequestParams",
246307
"CompleteRequest",
247308
"CompleteRequestParams",
309+
"CancelTaskRequest",
310+
"CancelTaskRequestParams",
248311
"CreateMessageRequest",
249312
"CreateMessageRequestParams",
313+
"DiscoverRequest",
250314
"ElicitRequest",
251315
"ElicitRequestFormParams",
252316
"ElicitRequestURLParams",
253317
"GetPromptRequest",
254318
"GetPromptRequestParams",
319+
"GetTaskPayloadRequest",
320+
"GetTaskPayloadRequestParams",
321+
"GetTaskRequest",
322+
"GetTaskRequestParams",
255323
"InitializeRequest",
256324
"InitializeRequestParams",
257325
"ListPromptsRequest",
258326
"ListResourcesRequest",
259327
"ListResourceTemplatesRequest",
260328
"ListRootsRequest",
329+
"ListTasksRequest",
261330
"ListToolsRequest",
262331
"PingRequest",
263332
"ReadResourceRequest",
@@ -266,23 +335,35 @@
266335
"SetLevelRequestParams",
267336
"SubscribeRequest",
268337
"SubscribeRequestParams",
338+
"SubscriptionsListenRequest",
339+
"SubscriptionsListenRequestParams",
269340
"UnsubscribeRequest",
270341
"UnsubscribeRequestParams",
271342
# Results
272343
"CallToolResult",
344+
"CancelTaskResult",
273345
"CompleteResult",
274346
"CreateMessageResult",
275347
"CreateMessageResultWithTools",
348+
"CreateTaskResult",
349+
"DiscoverResult",
276350
"ElicitResult",
277351
"ElicitationRequiredErrorData",
278352
"GetPromptResult",
353+
"GetTaskPayloadResult",
354+
"GetTaskResult",
279355
"InitializeResult",
356+
"InputRequiredResult",
280357
"ListPromptsResult",
281358
"ListResourcesResult",
282359
"ListResourceTemplatesResult",
283360
"ListRootsResult",
361+
"ListTasksResult",
284362
"ListToolsResult",
285363
"ReadResourceResult",
364+
# Error data payloads
365+
"MissingRequiredClientCapabilityErrorData",
366+
"UnsupportedProtocolVersionErrorData",
286367
# Notifications
287368
"CancelledNotification",
288369
"CancelledNotificationParams",
@@ -298,6 +379,10 @@
298379
"ResourceUpdatedNotification",
299380
"ResourceUpdatedNotificationParams",
300381
"RootsListChangedNotification",
382+
"SubscriptionsAcknowledgedNotification",
383+
"SubscriptionsAcknowledgedNotificationParams",
384+
"TaskStatusNotification",
385+
"TaskStatusNotificationParams",
301386
"ToolListChangedNotification",
302387
# Union types for request/response routing
303388
"ClientNotification",
@@ -318,10 +403,13 @@
318403
"INTERNAL_ERROR",
319404
"INVALID_PARAMS",
320405
"INVALID_REQUEST",
406+
"JSONRPC_VERSION",
321407
"METHOD_NOT_FOUND",
408+
"MISSING_REQUIRED_CLIENT_CAPABILITY",
322409
"PARSE_ERROR",
323410
"REQUEST_CANCELLED",
324411
"REQUEST_TIMEOUT",
412+
"UNSUPPORTED_PROTOCOL_VERSION",
325413
"URL_ELICITATION_REQUIRED",
326414
"ErrorData",
327415
"JSONRPCError",

0 commit comments

Comments
 (0)