|
| 1 | +# @upstash/mcp-toolkit |
| 2 | + |
| 3 | +## 0.1.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 5644daa: Add `@upstash/mcp-toolkit`: durable building blocks for MCP servers on the official TypeScript SDK. |
| 8 | + |
| 9 | + `@upstash/mcp-toolkit/tasks` — long-running tools. A task tool answers immediately with a task id; |
| 10 | + the model polls the shared `task_status` tool for progress and the result, and can stop the task |
| 11 | + with `task_cancel`. They are ordinary MCP tools, so they work in every client today. The record |
| 12 | + lives in a `TaskStore` and the work runs behind a `TaskDispatcher`, and the dispatcher owns its |
| 13 | + delivery endpoint (`export const POST = tasks.createExecuteHandler()`) and always verifies QStash's |
| 14 | + signature against the URL it published to. Tasks are declared once at module scope with |
| 15 | + `tasks.define(...)` and attached to each request's server with `tasks.register(server)`. A required |
| 16 | + `principal` scopes tasks to their caller (and subscriptions to theirs); handlers get it as |
| 17 | + `task.principal`, and an optional `authorize` on `tasks.define` checks the arguments before a task |
| 18 | + is stored or queued. |
| 19 | + |
| 20 | + `@upstash/mcp-toolkit/events` — MCP Events with webhook delivery, as ChatGPT ships it. Typed |
| 21 | + `events.define(...)` handles with `emit(payload)`: the payload's values route the event and are what |
| 22 | + the required `authorize` is checked against, at subscribe and again before every delivery. |
| 23 | + `events/list`, `events/subscribe` and `events/unsubscribe` are registered on your server, with a |
| 24 | + signed verification challenge, deterministic subscription ids, expiry and refresh, a configurable |
| 25 | + limit of live subscriptions per subscriber (8 by default), SSRF checks on callback URLs, and signing |
| 26 | + secrets encrypted at rest. `QStashDelivery` signs each attempt with |
| 27 | + Standard Webhooks and lets QStash retry failures (`export const POST = events.createDeliveryHandler()`). |
| 28 | + |
| 29 | + A handler that returns a tool error (`isError: true`) fails its task without a retry, and |
| 30 | + `task_status` shows that error the way the synchronous tool would. The model only ever sees a |
| 31 | + failure's `code` and `message`: transport details stay in the store, and dispatch errors are logged. |
| 32 | + |
| 33 | + The package uses WebCrypto only, so it runs on Node and edge runtimes. |
| 34 | + |
| 35 | + `@upstash/mcp-toolkit/upstash` holds the Upstash backends for both: `RedisTaskStore`, |
| 36 | + `QStashDispatcher`, `WorkflowDispatcher`, `RedisSubscriptionStore` and `QStashDelivery`. |
| 37 | + `@upstash/redis`, `@upstash/qstash` and `@upstash/workflow` are regular dependencies. |
0 commit comments