Skip to content

Remove Tasks (SEP-1686) from the SDK#2714

Draft
maxisbey wants to merge 1 commit into
mainfrom
remove-tasks
Draft

Remove Tasks (SEP-1686) from the SDK#2714
maxisbey wants to merge 1 commit into
mainfrom
remove-tasks

Conversation

@maxisbey
Copy link
Copy Markdown
Contributor

Tasks (SEP-1686) have been removed from the MCP specification (modelcontextprotocol/modelcontextprotocol#2663) and will return as a separate extension. This removes all task-related code, types, examples, tests, and documentation from the SDK.

Motivation and Context

The original Tasks SEP that landed in the 2025-11-25 spec has been pulled from the draft schema and is moving to an extension. Keeping the experimental implementation around would mean maintaining ~13k lines against a moving target that no longer matches the spec, so this strips it entirely. When the extension lands it can be re-added against the new shape.

How Has This Been Tested?

  • ./scripts/test — full suite, 100% coverage, strict-no-cover clean
  • pyright, ruff, pre-commit hooks all pass
  • uv lock regenerated to drop the four simple-task* workspace members

Breaking Changes

Yes (v2 only — main is already a breaking-change branch). Documented in docs/migration.md:

  • All Task* / *TasksCapability types, ToolExecution, and Tool.execution removed from mcp.types
  • RequestParams.task, ClientCapabilities.tasks, ServerCapabilities.tasks removed
  • mcp.{client,server,shared}.experimental and mcp.server.lowlevel.experimental packages removed
  • experimental properties removed from ClientSession / ServerSession / Server; experimental field removed from ServerRequestContext
  • BaseSession.add_response_router and mcp.shared.response_router removed

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

A few non-obvious decisions:

  • CancelledNotificationParams.request_id stays RequestId | None. The Tasks PR made it optional, but the draft schema kept it that way after removing tasks, so only the task-referencing docstring was changed.
  • BaseSession._handle_response is kept (with the router-dispatch loop stripped). The extraction from _receive_loop plus the null-ID error handling is a standalone improvement that doesn't depend on tasks.
  • server/validation.py is kept. It's a non-task refactor of sampling-tools validation that SEP-1686: Tasks #1645 happened to extract; only the "task-augmented" wording in the module docstring was dropped.
  • ResponseRouter, ServerSession.send_message, and the _build_*_request helpers are deleted rather than kept as "generic plumbing" — they had zero non-task callers, and keeping them would have required either pragmas or synthetic tests for the 100% coverage requirement.
  • Added tests/server/test_session.py::test_check_client_capability because the experimental task tests were the only thing exercising that public method.

AI Disclaimer

Tasks have been removed from the MCP specification and will return as a
separate extension in a future release. This removes all task-related
code, types, examples, tests, and documentation from the SDK.

Removed:
- All Task* types, capability fields, Tool.execution, and union members
  from mcp.types
- mcp.{client,server,shared}.experimental packages
- mcp.server.lowlevel.experimental and mcp.shared.response_router
- experimental properties on ClientSession, ServerSession, Server, and
  the experimental field on ServerRequestContext
- ServerSession._build_*_request helpers, send_message, and the tasks
  capability check (task-only consumers)
- BaseSession.add_response_router and the router-dispatch loop in
  _handle_response (the method extraction itself is kept)
- tests/experimental/ and the tasks:* entries in
  tests/interaction/_requirements.py
- examples/{clients,servers}/simple-task* and their uv.lock workspace
  members
- docs/experimental/ and the mkdocs nav section

Kept:
- CancelledNotificationParams.request_id stays optional to match the
  draft schema; only the docstring was updated
- server/validation.py (non-task sampling-validation refactor)
- _handle_response extraction in BaseSession

Added a test for ServerSession.check_client_capability since the
experimental task tests were its only coverage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant