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
[Schema][Client][Server] Add the Tasks extension (SEP-2663)
`io.modelcontextprotocol/tasks`: `Task` and `TaskStatus`, `ResultType::Task`,
the `CreateTaskResult` / `TaskResult` wire shapes, the `tasks/get` /
`tasks/update` / `tasks/cancel` handlers behind `TasksExtension`,
`TaskStoreInterface` with in-memory and PSR-16 stores,
`RequestContext::createTask()` / `supportsTasks()`, and the -32021 refusal for
a task handed to a client that did not declare the extension.
On the client, `enableExtension(new TasksExtension())` declares it, the call
methods return a `CreateTaskResult` when the server answered with a task, and
`getTask()` / `updateTask()` / `cancelTask()` drive it. Covered end to end by
an integration test against a stdio fixture server.
Extensions that add methods implement `MethodProvidingExtensionInterface`;
`Builder::enableExtension()` registers their messages and handlers. Extension
settings serialize as `{}` rather than `[]` when empty.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,8 @@ All notable changes to `mcp/sdk` will be documented in this file.
5
5
0.8.0
6
6
-----
7
7
8
+
* Add the Tasks extension (SEP-2663, `io.modelcontextprotocol/tasks`): a server can hand back a durable handle instead of holding a connection open. `Mcp\Schema\Task` and `TaskStatus`, `ResultType::Task`, the `CreateTaskResult` / `TaskResult` wire shapes (flat — the result *is* the task), the `tasks/get` / `tasks/update` / `tasks/cancel` surface, and `TaskStoreInterface` with `InMemoryTaskStore` and `Psr16TaskStore` implementations — the latter being what PHP-FPM needs, since the worker that creates a task is not the one polled for it. Enable with `Builder::enableExtension(new TasksExtension($store))`; handlers create a task through `RequestContext::createTask()` after checking `supportsTasks()`, and a task created for a client that did not declare the extension is refused with `-32021` rather than sent. Advancing a task is the application's job. On the client, `Client\Builder::enableExtension(new TasksExtension())` declares it, `Client::callTool()` / `getPrompt()` / `readResource()` now return a `CreateTaskResult` when the server answered with a task (a widening of their return types), and `Client::getTask()` / `updateTask()` / `cancelTask()` drive it. Extensions that add methods of their own implement the new `MethodProvidingExtensionInterface`, and `Builder::enableExtension()` registers their messages and handlers.
9
+
* Serialize an extension's settings as `{}` rather than `[]` when it has none, in both `ServerCapabilities` and `ClientCapabilities`; an extension declaring support with no settings was advertised as an empty JSON array, which the schema does not allow.
8
10
* Add `ClientGateway::supportsExtension()` to check whether the client negotiated a protocol extension (e.g. `McpApps::EXTENSION_ID`) before offering UI-linked tools, plus `Client\Builder::enableExtension()` and `ClientCapabilities::withExtensions()` so hosts advertise extensions the same way servers do. [BC Break]`ServerExtensionInterface` is replaced by the side-agnostic `Mcp\Schema\Extension\ExtensionInterface`.
9
11
* Deprecate the Roots, Sampling and Logging features per SEP-2577 (protocol revision `2026-07-28`, earliest removal `2027-07-28`): the schema, client and server classes that make them up are marked `@deprecated` with the suggested migration (tool arguments or resource URIs instead of roots; an LLM provider's API instead of sampling; stderr or OpenTelemetry instead of logging), and exercising them — `ClientGateway::log()` / `sample()` / `listRoots()`, or registering a client-side `SamplingRequestHandler`, `ListRootsRequestHandler` or `LoggingNotificationHandler` — triggers a silenced `E_USER_DEPRECATED` via `symfony/deprecation-contracts`. Everything remains fully functional until removal.
10
12
* Always emit `{}` for empty tool schemas: `Tool` recursively normalizes every empty sub-schema — `properties`, `items`, `additionalProperties`, `$defs`, combinators and the other draft-07 to 2020-12 schema keywords — in the constructor, for both `inputSchema` and `outputSchema`, so an object position is never serialized as `[]`.
Copy file name to clipboardExpand all lines: docs/index.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
@@ -5,7 +5,7 @@
5
5
-[Client](client.md) — Client SDK for connecting to and communicating with MCP servers.
6
6
-[Transports](transports.md) — STDIO and HTTP transport implementations with guidance on choosing between them.
7
7
-[Server-Client Communication](server-client-communication.md) — Methods for servers to communicate back to clients: sampling, logging, progress, and notifications.
8
-
-[Protocol Extensions](extensions.md) — Opt-in protocol extensions announced during capability negotiation, including MCP Apps (HTML UI resources).
8
+
-[Protocol Extensions](extensions.md) — Opt-in protocol extensions announced during capability negotiation, including Tasks (durable handles for long-running requests) and MCP Apps (HTML UI resources).
9
9
-[Authorization](authorization.md) — OAuth and authorization setup for the HTTP transport.
10
10
-[Events](events.md) — Hooking into the server lifecycle with PSR-14 events.
11
11
-[Examples](examples.md) — Example projects demonstrating attribute-based discovery, dependency injection, HTTP transport, and more.
0 commit comments