Skip to content

Commit e15d722

Browse files
committed
Add multi-version protocol types: per-version delta packages
One superset type set in mcp.types plus per-version packages that define only what changed against the previous version and re-export the rest; serialization validates dumps through the negotiated version's models.
1 parent 7267818 commit e15d722

38 files changed

Lines changed: 30289 additions & 91 deletions

‎docs/migration.md‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,11 +1166,18 @@ In practice, replace direct `ServerSession` use with `Server.run(read_stream, wr
11661166

11671167
`BaseSession` is still used by `ClientSession`, which never relied on these members. `RequestResponder.respond()` is unchanged.
11681168

1169-
### Experimental Tasks support removed
1169+
### Experimental Tasks support removed (types restored, types-only)
11701170

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`.
1171+
Tasks (SEP-1686) runtime support has been removed from this SDK. The `mcp.client.experimental`, `mcp.server.experimental`, `mcp.shared.experimental`, and `mcp.server.lowlevel.experimental` modules are gone, along with the `experimental` properties on `ClientSession`, `ServerSession`, `Server`, and `ServerRequestContext`.
11721172

1173-
Tasks are expected to return as a separate MCP extension in a future release.
1173+
The 2025-11-25 protocol *types* are back in `mcp.types` so that 2025-11-25 task payloads can still be modeled: the `Task*` types, the `tasks` capability subtrees, `Tool.execution`, and the `task` field on the four task-augmentable params classes. They are types-only definitions:
1174+
1175+
- Attributes are snake_case (`task_id`, `created_at`), aliased to the camelCase wire names.
1176+
- Timestamps are plain `str` values, not `datetime`.
1177+
- `GetTaskPayloadResult` follows the default extra-field policy (`ignore`), so it retains only `_meta`; validate a tasks/result payload into the original request's result type instead.
1178+
- None of the task methods is a member of the request/notification unions, and `add_request_handler` does not dispatch them.
1179+
1180+
Tasks runtime support is expected to return as a separate MCP extension in a future release.
11741181

11751182
## Deprecations
11761183

@@ -1214,6 +1221,12 @@ If you relied on extra fields round-tripping through MCP types, move that data i
12141221

12151222
## New Features
12161223

1224+
### Newer protocol fields are modeled and retained
1225+
1226+
`mcp.types` now models the 2025-11-25 and 2026-07-28 protocol fields and types (for example `resultType`, `ttlMs`/`cacheScope` on the cacheable results, and `inputResponses`/`requestState` on retried requests). Inbound payloads carrying these keys used to lose them to the unknown-field policy on re-dump; they now parse into typed fields and survive a user-level round-trip. All of the new fields are optional with `None` defaults, so dumps of values that do not set them are unchanged.
1227+
1228+
`CallToolResult.structured_content` and `ToolResultContent.structured_content` now accept any JSON value, where previous releases required an object: 2026-07-28 allows scalar and array structured content. Parsing is strictly more lenient, and emitted bytes for object values are unchanged.
1229+
12171230
### `streamable_http_app()` available on lowlevel Server
12181231

12191232
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.

‎pyproject.toml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ venv = ".venv"
143143
# those private functions instead of testing the private functions directly. It makes it easier to maintain the code source
144144
# and refactor code that is not public.
145145
executionEnvironments = [
146+
# tests/spec_oracles: generated spec-oracle modules ported from the codegen
147+
# pipeline and committed unchanged; the generator's recursive JSON alias and
148+
# envelope field-override patterns trip three strict checks.
149+
{ root = "tests/spec_oracles", extraPaths = [
150+
".",
151+
], reportUnusedFunction = false, reportPrivateUsage = false, reportGeneralTypeIssues = false, reportUnknownVariableType = false, reportInvalidTypeForm = false },
146152
{ root = "tests", extraPaths = [
147153
".",
148154
], reportUnusedFunction = false, reportPrivateUsage = false },
@@ -177,6 +183,10 @@ max-complexity = 24 # Default is 10
177183

178184
[tool.ruff.lint.per-file-ignores]
179185
"__init__.py" = ["F401"]
186+
# Generated spec-oracle modules: docstrings come verbatim from the spec schema
187+
# and ruff format does not wrap long docstring lines.
188+
"tests/spec_oracles/v*.py" = ["E501"]
189+
"tests/spec_oracles/ext_tasks.py" = ["E501"]
180190
"tests/server/mcpserver/test_func_metadata.py" = ["E501"]
181191
"tests/shared/test_progress_notifications.py" = ["PLW0603"]
182192

0 commit comments

Comments
 (0)