Publish multi-version documentation site (#1727)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bb4b44f0-f505-49c5-9878-76e2b40c7a15 Copilot-Session: 8eac1204-10ae-4319-9333-aee5dd43dcc8
This commit is contained in:
parent
a5179df39b
commit
ae36026695
1 changed files with 819 additions and 134 deletions
|
|
@ -10,9 +10,28 @@ Tasks let an MCP server run a request asynchronously and report its result to th
|
|||
primary use case today is long-running tool invocations: the tool is offloaded to a background task,
|
||||
and the client polls for status, optionally exchanging additional input along the way.
|
||||
|
||||
> **Status**: Experimental — diagnostic ID `MCPEXP001`. The implementation tracks
|
||||
> [SEP-2663 (Tasks Extension)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/seps/2663-tasks-extension.md).
|
||||
> See [Experimental APIs](xref:experimental) for how to opt in.
|
||||
Tasks are provided by the `ModelContextProtocol.Extensions.Tasks` package and require MCP protocol
|
||||
version `2026-07-28` or later. The implementation follows
|
||||
[SEP-2663 (Tasks Extension)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/seps/2663-tasks-extension.md).
|
||||
|
||||
### Compatibility with v1 experimental Tasks
|
||||
|
||||
The Tasks extension in v2.0.0 replaces the experimental Tasks implementation shipped in v1.3.0 and
|
||||
v1.4.x. The implementations are not compatible at either the API or protocol level. A v2 Tasks
|
||||
client or server must use a connection negotiated to `2026-07-28` or later; it cannot fall back to
|
||||
the down-level implementation.
|
||||
|
||||
On a connection negotiated to the down-level `2025-11-25` protocol:
|
||||
|
||||
- A v2 client calling a v1 server receives an ordinary tool result. The v2 client does not opt in
|
||||
to the down-level Tasks protocol, and `GetTaskAsync` rejects use before a `2026-07-28`
|
||||
connection is negotiated.
|
||||
- A v1 client calling a v2 server likewise receives an ordinary tool result. The v2 server does
|
||||
not create Tasks on a down-level connection, and its `tasks/get` endpoint rejects the legacy
|
||||
request with a method-not-found error.
|
||||
|
||||
Upgrade both peers to the v2 Tasks extension before using Tasks. The extension provides no
|
||||
compatibility bridge for the previous experimental API.
|
||||
|
||||
### Overview
|
||||
|
||||
|
|
@ -50,14 +69,12 @@ and `"complete"` for ordinary results.
|
|||
|
||||
#### Using the task store
|
||||
|
||||
Tasks support lives in the `ModelContextProtocol.Extensions.Tasks` package. The easiest way to
|
||||
enable tasks is to call <xref:ModelContextProtocol.Extensions.Tasks.McpTasksBuilderExtensions.WithTasks*>
|
||||
on the server builder, passing an <xref:ModelContextProtocol.Extensions.Tasks.IMcpTaskStore>.
|
||||
The easiest way to enable the package's task store integration is to call
|
||||
<xref:ModelContextProtocol.Extensions.Tasks.McpTasksBuilderExtensions.WithTasks*> on the server builder,
|
||||
passing an <xref:ModelContextProtocol.Extensions.Tasks.IMcpTaskStore>.
|
||||
The SDK ships <xref:ModelContextProtocol.Extensions.Tasks.InMemoryMcpTaskStore> for development and tests:
|
||||
|
||||
```csharp
|
||||
#pragma warning disable MCPEXP001
|
||||
|
||||
using ModelContextProtocol.Extensions.Tasks;
|
||||
|
||||
builder.Services.AddMcpServer()
|
||||
|
|
@ -79,16 +96,9 @@ When tasks are enabled with `WithTasks` the SDK automatically:
|
|||
- Plumbs a `CancellationToken` through to the tool that fires when the client invokes
|
||||
`tasks/cancel`, so cancellation propagates cooperatively.
|
||||
|
||||
Alternate-result `tools/call` filters run in registration order, with the Tasks filter creating a
|
||||
task at its position in that order. Filters before Tasks run before task creation. Filters after
|
||||
Tasks run in the background before the ordinary filter pipeline. ASP.NET Core tool authorization
|
||||
uses an alternate-result filter registered before Tasks, so an unauthorized call does not create
|
||||
a task.
|
||||
Alternate-result `tools/call` filters run in registration order, with the Tasks filter creating a task at its position in that order. Filters before Tasks run before task creation. Filters after Tasks run in the background before the ordinary filter pipeline. ASP.NET Core tool authorization uses an alternate-result filter registered before Tasks, so an unauthorized call does not create a task.
|
||||
|
||||
Ordinary `tools/call` filters still run exactly once for task-backed calls. They execute in the
|
||||
background after the task record is created and before the tool body, so validation and telemetry
|
||||
continue to apply. Each background invocation gets an independent DI scope that remains alive
|
||||
until the tool pipeline completes.
|
||||
Ordinary `tools/call` filters still run exactly once for task-backed calls. They execute in the background after the task record is created and before the tool body, so validation and telemetry continue to apply. Each background invocation gets an independent DI scope that remains alive until the tool pipeline completes.
|
||||
|
||||
For production scenarios that need durability, session isolation, multi-process routing, or
|
||||
TTL-based cleanup, implement <xref:ModelContextProtocol.Extensions.Tasks.IMcpTaskStore> yourself
|
||||
|
|
|
|||
Loading…
Reference in a new issue