Draft: Prototype legacy MCP Tasks 2025-11-30 compatibility#28
Draft
jeffhandley wants to merge 4 commits into
Draft
Draft: Prototype legacy MCP Tasks 2025-11-30 compatibility#28jeffhandley wants to merge 4 commits into
jeffhandley wants to merge 4 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2b4e8e7-6c94-4b5c-81ff-c3de5ea600ed
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2b4e8e7-6c94-4b5c-81ff-c3de5ea600ed
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2b4e8e7-6c94-4b5c-81ff-c3de5ea600ed
Move legacy Tasks compatibility coverage into its package-owned test project and remove the core test project dependency. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c2b4e8e7-6c94-4b5c-81ff-c3de5ea600ed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This exploratory POC adds
ModelContextProtocol.Legacy.Tasks-2025-11-30, a separately named compatibility package for the experimental MCP Tasks draft used by SDK 1.x. It runs besideModelContextProtocol.Extensions.Tasks: after normal protocol negotiation,2025-11-30activates the legacy wire behavior and2026-07-28+activates modern extension-based Tasks.The package preserves legacy top-level
taskscapabilities,tools/calltask augmentation, lifecycle methods, status notifications, and tool descriptor metadata. In particular,execution: { "taskSupport": "optional" }remains available throughMcpClientTool.ProtocolTool.AdditionalProperties, so an upgraded client can retain separate direct and task-augmented execution pipelines.Protocol selection and execution
flowchart TD Options["McpClientOptions"] Options -->|"EnableLegacyTasks()"| Pinned["Pin 2025-11-30"] Options -->|"EnableTasksMigration()"| Auto["Do not pin a version"] Auto --> Discover["Prefer server/discover"] Auto -->|"initialize fallback"| Legacy["Negotiate 2025-11-30"] Pinned --> Legacy Discover --> Modern["Negotiate 2026-07-28+"] Legacy --> LegacyTasks["Legacy Tasks wire protocol"] Modern --> ModernTasks["Modern Tasks extension"] LegacyTasks --> Migration["McpTaskMigrationClient"] ModernTasks --> Migrationflowchart TD List["client.ListToolsAsync()"] --> Descriptor["McpClientTool.ProtocolTool"] Descriptor --> LegacyCheck{"Legacy execution.taskSupport?"} LegacyCheck -->|"optional / required"| LegacyTask["CallToolAsLegacyTaskAsync\npoll tasks/result"] LegacyCheck -->|"otherwise"| Direct["Existing CallAsync / ExecuteTool"] Descriptor --> ModernCheck{"Modern Tasks extension?"} ModernCheck -->|"yes"| ModernTask["CallToolWithPollingAsync"] ModernCheck -->|"no"| DirectPublic API
Legacy package
LegacyTasksProtocol,McpLegacyTask,McpLegacyTaskStatus,McpLegacyTaskMetadata, and legacy lifecycle/status DTOsEnableLegacyTasks,EnableTasksMigration,CallToolAsLegacyTaskAsync,GetLegacyTaskAsync,ListLegacyTasksAsync,GetLegacyTaskPayloadAsync,CancelLegacyTaskAsync,McpTaskMigrationClientWithLegacyTasks,ILegacyMcpTaskStore,InMemoryLegacyMcpTaskStore, source-compatibleInMemoryMcpTaskStore, tool task-support helpers, and status notificationsModelContextProtocol.Protocoltask models plus legacyMcpClientandMcpServerextension methods, marked[Obsolete]with diagnosticMCP9007There are no protected APIs in the package.
Required Core surface
Tool.AdditionalProperties, client/server capability additional propertiesMcpServerRequestHandler.IsApplicableMcpServerRequestHandler.HandlerWithServerMcpClientHandlers.RequestHandlers,McpClientRequestHandlerClient examples
A. Legacy only
B. Modern only
C. Both, with post-negotiation selection
CreateTaskMigrationClient(logger)logs legacy selection at Information level so customers can identify servers that still need compatibility support.Server examples
A. Legacy only
For Streamable HTTP legacy Tasks, use a stateful server:
B. Modern only
C. Both revisions
Leave
ProtocolVersionunset for the SDK's normal version negotiation. Legacy requests route to this package; modern requests route toModelContextProtocol.Extensions.Tasks.Challenges and risks
Stateless = false; the HTTP tests prove session isolation.TaskStoreoption properties are not restored.Validation
dotnet build ModelContextProtocol.slnx --no-restoresucceeds with zero warnings/errors.net10.0,net9.0, andnet8.0; onnet472, 180 pass and 22 reverse-task tests are skipped by the repository-wide Windows issue Running ModelContextProtocol.Tests in net472 is causing VS test platform to hang modelcontextprotocol/csharp-sdk#587 guard.net10.0,net9.0, andnet8.0.execution.taskSupportsurvivestools/listand ordinary tool calls remain direct rather than being forced into Tasks.Assessment
Feasible as a separately versioned migration bridge, but not ready to merge as a production feature without API and design review. It lets existing customers upgrade without consolidating direct and task-augmented pipelines immediately, while providing telemetry to retire legacy support. Production adoption should first settle response shaping by protocol version, durable/scoped store guidance, notification ergonomics, and the Core public API review.