Implement tasks - #589
Open
0xKoller wants to merge 5 commits into
Open
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Rspack Bundle Analysis
Main CompilerSource:
Total emitted JS: 6.36 MB Runtime CompilerSource:
Total emitted JS: 5.38 MB Package Footprint (npm pack + npm install)
|
0xKoller
marked this pull request as ready for review
June 10, 2026 20:04
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.
Implements the MCP tasks utility (https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks) (long-running, pollable tool calls) in xmcp, kept fully stateless all task state lives in an external store you provide, never in server memory. This works on serverless and matches the SEP-2663 (modelcontextprotocol/modelcontextprotocol#2663) non-blocking direction.
How it works
src/task-store.ts(default export). Its presence advertises the tasks capability and wires the store into the SDK's nativetasks/get·tasks/result· tasks/list·tasks/cancelhandlers.taskSupport: "optional" | "required"in its metadata. xmcp auto-registers it as a task tool (no per-tool wrapping). The handler receives extra.task.taskId.createTaskStoreA
createTaskStore(adapter, options?)factory builds a complete TaskStore from four tiny persistence methods (get / set / delete / list). It owns all the generic protocol logic id generation, timestamps, the working→terminal status machine, TTL evict-on-read, the public-task projection, and cursor pagination. Any KV/DB (Redis, Upstash, Postgres…) drops in by pointing those methods at it. Power users can still implement the raw TaskStore interface directly.Key changes (packages/xmcp)
Example: examples/tasks-http/
A runnable stateless-HTTP server demonstrating the enqueue-here / execute-elsewhere model with two processes sharing only on-disk state: