Skip to content

feat: add MCP tasks support to example server#37

Draft
Guro wants to merge 2 commits intomainfrom
guro/mcp-tasks-server-support
Draft

feat: add MCP tasks support to example server#37
Guro wants to merge 2 commits intomainfrom
guro/mcp-tasks-server-support

Conversation

@Guro
Copy link
Collaborator

@Guro Guro commented Feb 16, 2026

Summary

Add task-based execution support for the longRunningOperation tool, demonstrating the MCP Tasks protocol.

Changes:

  • Add InMemoryTaskStore and InMemoryTaskMessageQueue from SDK 1.26.0
  • Declare tasks capability with list, cancel, and tool call support
  • Extract runLongOperation() helper for background task execution with status updates
  • Add task cancellation checking during long operations
  • Update @modelcontextprotocol/sdk to 1.26.0

How it works:

  • When a client with tasks capability calls longRunningOperation, the server creates a task and returns a CreateTaskResult immediately
  • The operation runs in the background, updating task status at each step
  • The client polls for task status and retrieves the final result when complete
  • Task cancellation is supported — the operation checks for cancellation between steps

Companion PR: anthropics/apps (client-side tasks support in claude-ai)

Testing

  1. Start the example server
  2. Connect from a client with tasks capability
  3. Call longRunningOperation — should return task ID immediately, then complete asynchronously
  4. Test cancellation during a long operation

Guro added 2 commits February 16, 2026 19:54
Without this, rate limiting uses the proxy's IP instead of actual client IPs,
causing all requests through Cloudflare to be rate limited together.
Add task-based execution support for the longRunningOperation tool,
demonstrating the MCP Tasks protocol. Changes include:

- Add InMemoryTaskStore and InMemoryTaskMessageQueue
- Declare tasks capability with list, cancel, and tool call support
- Extract runLongOperation helper for background task execution
- Add task status updates and cancellation checking during long operations
- Update SDK to 1.26.0 for tasks support
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