@cyanheads/mcp-ts-core 0.12.6 → 0.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/AGENTS.md +2 -1
  2. package/CLAUDE.md +2 -1
  3. package/README.md +124 -76
  4. package/biome.json +1 -1
  5. package/changelog/0.12.x/0.12.6.md +2 -2
  6. package/changelog/0.12.x/0.12.7.md +39 -0
  7. package/dist/core/worker.d.ts +1 -1
  8. package/dist/core/worker.d.ts.map +1 -1
  9. package/dist/core/worker.js.map +1 -1
  10. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
  11. package/dist/mcp-server/tools/tool-registration.js +7 -1
  12. package/dist/mcp-server/tools/tool-registration.js.map +1 -1
  13. package/dist/mcp-server/tools/utils/deferredInputSchema.d.ts +39 -0
  14. package/dist/mcp-server/tools/utils/deferredInputSchema.d.ts.map +1 -0
  15. package/dist/mcp-server/tools/utils/deferredInputSchema.js +33 -0
  16. package/dist/mcp-server/tools/utils/deferredInputSchema.js.map +1 -0
  17. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +10 -2
  18. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  19. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +25 -3
  20. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  21. package/dist/services/speech/providers/whisper.provider.d.ts.map +1 -1
  22. package/dist/services/speech/providers/whisper.provider.js +4 -2
  23. package/dist/services/speech/providers/whisper.provider.js.map +1 -1
  24. package/package.json +21 -20
  25. package/scripts/check-framework-antipatterns.ts +4 -1
  26. package/scripts/devcheck.ts +303 -33
  27. package/scripts/lint-packaging.ts +28 -6
  28. package/skills/add-tool/SKILL.md +33 -1
  29. package/skills/api-errors/SKILL.md +2 -1
  30. package/skills/design-mcp-server/SKILL.md +6 -1
  31. package/skills/field-test/SKILL.md +70 -30
  32. package/skills/git-wrapup/SKILL.md +4 -3
  33. package/templates/package.json +6 -6
package/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Package:** `@cyanheads/mcp-ts-core`
4
- **Version:** 0.12.6
4
+ **Version:** 0.12.7
5
5
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
6
6
  **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
7
7
  **Zod:** ^4.5.4
@@ -546,6 +546,7 @@ Skills live in `skills/<name>/SKILL.md`; the full list is discoverable via the a
546
546
  | `bun run format` | Auto-fix Biome lint/format issues (safe fixes only) |
547
547
  | `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior, not just formatting |
548
548
  | `bun run tree` | Regenerate `docs/tree.md` after the directory structure changes |
549
+ | `bun run typecheck:worker` | The workerd type environment (`tsconfig.worker.json`). Cloudflare's ambient globals declare `Buffer` as `any` and cannot share a program with `@types/node`, so the worker lane is checked separately, against the built declarations — build first |
549
550
  | `bun run test` | Every root project — unit, leak-gate, compliance, smoke, fuzz, typecheck (Bun runtime) |
550
551
  | `bun run test:unit` / `:smoke` / `:fuzz` / `:compliance` / `:typecheck` | One root project via `--project`. `test:typecheck` runs the `.test-d.ts` contracts, whose `@ts-expect-error` cases are the negative assertions |
551
552
  | `bun run test:leak-gate` | The retention gate's own sentinel suite. Each case spawns a full Vitest run, so it is excluded from the `unit` project |
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Developer Protocol
2
2
 
3
3
  **Package:** `@cyanheads/mcp-ts-core`
4
- **Version:** 0.12.6
4
+ **Version:** 0.12.7
5
5
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
6
6
  **MCP SDK:** `@modelcontextprotocol/server` ^2.0.0 (protocol revisions 2026-07-28 and 2025-*)
7
7
  **Zod:** ^4.5.4
@@ -546,6 +546,7 @@ Skills live in `skills/<name>/SKILL.md`; the full list is discoverable via the a
546
546
  | `bun run format` | Auto-fix Biome lint/format issues (safe fixes only) |
547
547
  | `bun run format:unsafe` | Also apply Biome's unsafe autofixes — review the diff; they can change behavior, not just formatting |
548
548
  | `bun run tree` | Regenerate `docs/tree.md` after the directory structure changes |
549
+ | `bun run typecheck:worker` | The workerd type environment (`tsconfig.worker.json`). Cloudflare's ambient globals declare `Buffer` as `any` and cannot share a program with `@types/node`, so the worker lane is checked separately, against the built declarations — build first |
549
550
  | `bun run test` | Every root project — unit, leak-gate, compliance, smoke, fuzz, typecheck (Bun runtime) |
550
551
  | `bun run test:unit` / `:smoke` / `:fuzz` / `:compliance` / `:typecheck` | One root project via `--project`. `test:typecheck` runs the `.test-d.ts` contracts, whose `@ts-expect-error` cases are the negative assertions |
551
552
  | `bun run test:leak-gate` | The retention gate's own sentinel suite. Each case spawns a full Vitest run, so it is excluded from the `unit` project |
package/README.md CHANGED
@@ -1,25 +1,103 @@
1
1
  <div align="center">
2
2
  <h1>@cyanheads/mcp-ts-core</h1>
3
- <p><b>Agent-native TypeScript framework for building MCP servers. Build tools, not infrastructure. Declarative definitions with auth, multi-backend storage, OpenTelemetry, and first-class support for Bun/Node/Cloudflare Workers.</b></p>
3
+ <p><b>Agent-native TypeScript framework for MCP servers.</b></p>
4
+ <p>Give your agent the infrastructure, patterns, and skills to build and ship your server.</p>
4
5
  </div>
5
6
 
6
7
  <div align="center">
7
8
 
8
- [![Version](https://img.shields.io/badge/Version-0.12.6-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2026--07--28-8A2BE2.svg?style=flat-square)](https://modelcontextprotocol.io/specification/2026-07-28)
9
+ [![Version](https://img.shields.io/badge/Version-0.12.7-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![MCP Spec](https://img.shields.io/badge/MCP%20Spec-2026--07--28-8A2BE2.svg?style=flat-square)](https://modelcontextprotocol.io/specification/2026-07-28)
9
10
 
10
11
  [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0%2B-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
12
 
12
- [![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
13
+ [Quick start](#quick-start) · [Capabilities](#what-comes-with-it) · [API reference](#api-overview) · [Examples](#examples)
13
14
 
14
15
  </div>
15
16
 
16
17
  ---
17
18
 
18
- ## What is this?
19
+ ## Build AI tools for anything you can describe.
19
20
 
20
- `@cyanheads/mcp-ts-core` is the infrastructure layer for TypeScript MCP servers. Install it as a dependency don't fork it. Your agent collaborates with you to design and build the tools, resources, and prompts for your server.
21
+ Connect an API, a dataset, or a workflow to an AI agent through the Model Context Protocol (MCP). `@cyanheads/mcp-ts-core` gives you and your agent the foundation to build that server, with auth, storage, logging, and deployment support & skills already available.
21
22
 
22
- The framework handles the plumbing: transports, auth, config, logging, telemetry, & more.
23
+ **Agent-native means your agent knows what to do.** Every scaffold includes framework documentation and Agent Skills: reusable workflows for designing tools, writing tests, reviewing security, and publishing releases. You decide what the server should do; your agent has the patterns and checks to help implement it.
24
+
25
+ Your project holds the domain code. The framework stays a dependency, so infrastructure fixes arrive through package upgrades. Run the `maintenance` skill to have your agent update the framework, grab the latest skills, and integrate them into your project.
26
+
27
+ ## Quick start
28
+
29
+ Servers can run on Bun, Node.js 24 or later, or Cloudflare Workers.
30
+
31
+ ```bash
32
+ bunx @cyanheads/mcp-ts-core init my-mcp-server
33
+ cd my-mcp-server
34
+ bun install
35
+ ```
36
+
37
+ Open the project in Claude Code, Codex, or your preferred agent and give it a concrete starting point:
38
+
39
+ > Build an MCP server for my team's inventory API. We need to find products, check stock across warehouses, investigate stock movements, and record adjustments and transfers. Let's get started.
40
+
41
+ The scaffold includes a source tree, build and test configuration, `CLAUDE.md`/`AGENTS.md`, Agent Skills, and plugin metadata for Claude Code and Codex.
42
+
43
+ Already have a TypeScript project? Install the framework directly with `bun add @cyanheads/mcp-ts-core` and register your definitions with `createApp()`.
44
+
45
+ ## A tool is a schema and a function
46
+
47
+ Here's a complete server that searches a small catalog. To try it in the scaffolded project, replace `src/index.ts` with:
48
+
49
+ ```ts
50
+ import { createApp, tool, z } from '@cyanheads/mcp-ts-core';
51
+
52
+ const catalog = ['Notebook', 'Mechanical pencil', 'Desk lamp'];
53
+
54
+ const search = tool('catalog_search', {
55
+ description: 'Search catalog item names. An empty query lists all items.',
56
+ annotations: { readOnlyHint: true },
57
+ input: z.object({
58
+ query: z.string().describe('Text to find in an item name'),
59
+ }),
60
+ output: z.object({
61
+ items: z.array(z.string()).describe('Matching item names'),
62
+ }),
63
+ async handler({ query }) {
64
+ return {
65
+ items: catalog.filter((name) =>
66
+ name.toLowerCase().includes(query.toLowerCase()),
67
+ ),
68
+ };
69
+ },
70
+ });
71
+
72
+ await createApp({ name: 'catalog-mcp-server', title: 'catalog-mcp-server', tools: [search] });
73
+ ```
74
+
75
+ Build and run it over HTTP:
76
+
77
+ ```bash
78
+ bun run rebuild
79
+ bun run start:http
80
+ ```
81
+
82
+ Connect your MCP client to `http://127.0.0.1:3010/mcp` (Streamable HTTP), or configure stdio with `bun /absolute/path/to/dist/index.js`.
83
+
84
+ ## What comes with it
85
+
86
+ | You need to… | The framework provides |
87
+ |:------------|:-----------------------|
88
+ | Give an assistant useful capabilities | Typed builders for tools, resources, prompts, and interactive MCP Apps |
89
+ | Help an agent use those capabilities correctly | Server instructions, result enrichment, and declared errors with recovery guidance |
90
+ | Control access and keep state | JWT/OAuth, per-definition scopes, and tenant-scoped storage with swappable backends |
91
+ | Run locally or host a service | stdio and HTTP on Bun/Node.js; a separate entry point for Cloudflare Workers |
92
+ | Understand failures and catch mistakes | Structured logs, optional OpenTelemetry, definition linting, contract tests, and fuzz testing |
93
+
94
+ Optional integrations such as DuckDB, Supabase, and the OpenTelemetry SDK are peer dependencies, installed when you need them.
95
+
96
+ ## Give agents useful results
97
+
98
+ Use `enrichment` and `ctx.enrich()` for result context such as totals, applied filters, and empty-result notices. Declare failures and recovery guidance in `errors`, then throw with the typed `ctx.fail()`. Both contracts are visible to clients before a call.
99
+
100
+ Here, `runSearch(query, limit)` returns `{ items, total, parsed }` (matches, total before the limit, and parsed query), or `null` if the index is unavailable:
23
101
 
24
102
  ```ts
25
103
  import { createApp, tool, z } from '@cyanheads/mcp-ts-core';
@@ -30,7 +108,7 @@ const search = tool('search', {
30
108
  annotations: { readOnlyHint: true },
31
109
  input: z.object({
32
110
  query: z.string().describe('Search terms'),
33
- limit: z.number().default(10).describe('Max results'),
111
+ limit: z.number().int().min(1).default(10).describe('Max results'),
34
112
  }),
35
113
  output: z.object({
36
114
  items: z.array(z.string()).describe('Matching item names, best first'),
@@ -51,10 +129,12 @@ const search = tool('search', {
51
129
  ],
52
130
  handler: async (input, ctx) => {
53
131
  const res = await runSearch(input.query, input.limit);
54
- if (!res) throw ctx.fail('index_unavailable'); // genuine failure → typed error contract
132
+ if (!res) {
133
+ throw ctx.fail('index_unavailable', undefined, ctx.recoveryFor('index_unavailable'));
134
+ }
55
135
  ctx.enrich({ effectiveQuery: res.parsed, totalCount: res.total });
56
136
  if (res.items.length === 0) {
57
- ctx.enrich({ notice: `No matches for "${input.query}". Try broader terms.` }); // empty result → notice, not a throw
137
+ ctx.enrich({ notice: `No matches for "${input.query}". Try broader terms.` });
58
138
  }
59
139
  return { items: res.items }; // enrichment never rides in the domain return
60
140
  },
@@ -63,51 +143,26 @@ const search = tool('search', {
63
143
  await createApp({ tools: [search] });
64
144
  ```
65
145
 
66
- That's a complete MCP server, and it shows both of the framework's core contracts.
67
-
68
- **`enrichment`** carries the context an agent reasons with (the parsed query, the true total, an empty-result notice); the framework merges it into `structuredContent` *and* mirrors it into `content[]`, so `structuredContent`-only clients (Claude Code) and `content[]`-only clients (Claude Desktop) both see it, no `format()` needed. The typed **`errors[]`** contract handles genuine failures (an empty result is a `notice`, not a throw), and the linter cross-checks both against the handler body. Both publish in `tools/list`, so clients preview a tool's success *and* failure shapes.
69
-
70
- The rest is automatic: every tool call is logged with duration, payload sizes, and request correlation, and `createApp()` handles config parsing, logger init, transport startup, signal handlers, and graceful shutdown.
71
-
72
- ## Quick start
73
-
74
- ```bash
75
- bunx @cyanheads/mcp-ts-core init my-mcp-server
76
- cd my-mcp-server
77
- bun install
78
- ```
79
-
80
- You get a scaffolded project with `CLAUDE.md`/`AGENTS.md`, Agent Skills, plugin metadata (Codex + Claude Code), and a `src/` tree ready for your tools. Infrastructure (transports, auth, storage, telemetry, lifecycle, linting) lives in `node_modules`. What's left is domain: which APIs to wrap, which workflows to expose.
146
+ Enrichment and error contracts are advertised through `tools/list` and checked by the definition linter. `ctx.recoveryFor()` includes the declared recovery hint in the error response.
81
147
 
82
- Start your coding agent (e.g. Claude Code, Codex) and describe what you want. The agent knows what to do from there. The included Agent Skills cover the full cycle: `setup`, `design-mcp-server`, scaffolding, testing, `security-pass`, `release-and-publish`, `maintenance`, & more.
148
+ ### Same data across client surfaces
83
149
 
84
- ### What you get
150
+ MCP hosts differ in what they expose to the agent: some use `content[]`, some use `structuredContent`, and some use both. The framework keeps tool-result data in sync across both surfaces, so the agent receives the same information whichever one its host exposes. `structuredContent` carries structured JSON; `content[]` carries the same data as text.
85
151
 
86
- The headline tool returns structured output. Clients that read `structuredContent` (Claude Code) get it directly. To also render markdown for clients that read `content[]` (Claude Desktop), add a `format()`. The `format-parity` linter checks it renders every `output` field, so the two surfaces never drift:
152
+ `format()` controls the text representation, and the format-parity linter enforces that every output field is represented. Without a custom formatter, the framework uses JSON text. Declared enrichment is mirrored into both surfaces automatically. For example, this formatter presents the item names as a markdown list:
87
153
 
88
154
  ```ts
89
- import { tool, z } from '@cyanheads/mcp-ts-core';
90
-
91
- export const itemSearch = tool('item_search', {
92
- description: 'Search for items by query.',
93
- input: z.object({
94
- query: z.string().describe('Search query'),
95
- limit: z.number().default(10).describe('Max results'),
96
- }),
97
- output: z.object({
98
- items: z.array(z.string()).describe('Search results'),
99
- }),
100
- async handler(input) {
101
- const results = await doSearch(input.query, input.limit);
102
- return { items: results };
103
- },
104
- format: (result) => [
105
- { type: 'text', text: result.items.map((name) => `- ${name}`).join('\n') },
106
- ],
107
- });
155
+ format: (result) => [{
156
+ type: 'text',
157
+ text: result.items.length > 0
158
+ ? result.items.map((name) => `- ${name}`).join('\n')
159
+ : 'No matching items.',
160
+ }],
108
161
  ```
109
162
 
110
- And resources:
163
+ ### Resources
164
+
165
+ Resources expose data at a URI. This definition delegates the lookup to your own `getItem()` service:
111
166
 
112
167
  ```ts
113
168
  import { resource, z } from '@cyanheads/mcp-ts-core';
@@ -138,22 +193,16 @@ await createApp({
138
193
 
139
194
  It also works on Cloudflare Workers with `createWorkerHandler()` — same definitions, different entry point.
140
195
 
141
- ## Features
142
-
143
- - **Declarative definitions** `tool()`, `resource()`, `prompt()` builders with Zod schemas; `appTool()`/`appResource()` add interactive HTML UIs.
144
- - **Server-level orientation** `instructions` on `createApp`/`createWorkerHandler` rides every `initialize` for the model. Cross-tool composition hints, regional notes, scope guidance without leaking text into every tool description.
145
- - **Server identity** optional `title`, `websiteUrl`, `description`, `icons` (SEP-973) on `createApp`/`createWorkerHandler` flow to `initialize` serverInfo, the `/.well-known/mcp.json` server card, and the landing page.
146
- - **Unified Context** — one `ctx` for logging, tenant-scoped storage, multi-round-trip input collection, and cancellation. `Context extends RequestContext`, so a handler's `ctx` goes straight into any service or storage call.
147
- - **Auth** `auth: ['scope']` on definitions, checked before dispatch (no wrapper code). Modes: `none`, `jwt`, or `oauth` (local secret or JWKS).
148
- - **Two protocol revisions, one handler** HTTP serves both the 2026-07-28 revision (per-request `_meta` envelope, no session) and the `initialize`-negotiated 2025 era (sessionful, identity-bound). Handlers are written once; the SDK's legacy shim fulfils multi-round-trip input for 2025-era clients.
149
- - **Multi-round-trip input** — a handler `return`s `ctx.requestInput(...)` for a confirmation, a sampling call, or the client's roots, and is re-entered with the answers on `ctx.inputs`.
150
- - **Definition linter** validates names, schemas, auth scopes, annotations, format-parity, and cross-vendor JSON Schema portability at build time. Run via `lint:mcp` or `devcheck` not invoked at server startup.
151
- - **Typed error contracts** — declare `errors: [{ reason, code, when, recovery, retryable? }]` and handlers get a typed `ctx.fail(reason, …)`. Contracts publish in `tools/list` so clients preview failure modes; the linter cross-checks the handler. Factories (`notFound()`, `httpErrorFromResponse()`, …) cover ad-hoc throws; plain `Error` auto-classifies.
152
- - **Multi-backend storage** — `in-memory`, filesystem, Supabase, Cloudflare D1/KV/R2. Swap via env var; handlers don't change.
153
- - **DataCanvas (optional)** — Tier 3 SQL/analytical workspace backed by DuckDB. Register tabular data from upstream APIs, run SQL across registered tables, export CSV/Parquet/JSON. Token-sharing model (opaque `canvas_id`) for multi-agent collaboration; sliding TTL + per-tenant scoping. Opt-in via `CANVAS_PROVIDER_TYPE=duckdb`; fails closed on Workers.
154
- - **Observability** — Pino logging + optional OpenTelemetry traces/metrics. Request correlation and tool metrics automatic.
155
- - **Tiered dependencies** — parsers, OTEL SDK, Supabase, OpenAI as optional peers. Install what you use.
156
- - **Agent-first DX** — ships `CLAUDE.md` / `AGENTS.md` and Agent Skills that give your coding agent full framework knowledge — it can scaffold tools, write tests, run security audits, and ship releases without you writing the boilerplate.
196
+ ## Runtime and integration details
197
+
198
+ - **Auth and storage:** Declare `auth: ['scope']` on a definition to check access before dispatch. Choose JWT or OAuth authentication. Tenant-scoped `ctx.state` supports in-memory, filesystem, Supabase, and Cloudflare D1/KV/R2 storage; select the backend through configuration.
199
+ - **Client interaction:** Return `ctx.requestInput(...)` to request confirmation, model sampling, or the client's roots. The handler runs again with responses available on `ctx.inputs`.
200
+ - **Protocol compatibility:** HTTP supports the 2026-07-28 revision's per-request `_meta` envelope and session-based 2025-era clients. The SDK's compatibility layer handles input requests for older clients.
201
+ - **Server presentation:** `instructions` provides guidance during initialization without repeating it in every tool description. Identity fields such as `title`, `websiteUrl`, `description`, and `icons` populate client server information, the `/.well-known/mcp.json` server card, and the HTTP landing page.
202
+ - **Definition checks:** `lint:mcp` checks names, schemas, scopes, annotations, format parity, and JSON Schema portability at build time. These checks do not run at server startup.
203
+ - **DataCanvas:** An optional DuckDB workspace for SQL queries across API results and CSV/Parquet/JSON exports. Agents can share a workspace through an opaque canvas token. Enable it with `CANVAS_PROVIDER_TYPE=duckdb` and install `@duckdb/node-api`; it requires Bun or Node.js. See [brapi-mcp-server](https://github.com/cyanheads/brapi-mcp-server#working-with-dataframes) for a walkthrough of loading API results into a dataframe and querying them with SQL.
204
+
205
+ See the [framework reference](CLAUDE.md) for configuration and handler patterns, and the [observability guide](docs/telemetry/observability.md) for Pino logging and OpenTelemetry traces and metrics.
157
206
 
158
207
  ## Server structure
159
208
 
@@ -175,7 +224,7 @@ my-mcp-server/
175
224
  CLAUDE.md / AGENTS.md # Point to core's CLAUDE.md / AGENTS.md for framework docs
176
225
  ```
177
226
 
178
- No `src/utils/`, no `src/storage/`, no `src/types-global/`, no `src/mcp-server/transports/` infrastructure lives in `node_modules`.
227
+ Framework infrastructure lives in `node_modules`; your source tree contains the server's definitions, configuration, and domain services.
179
228
 
180
229
  ## Configuration
181
230
 
@@ -189,7 +238,7 @@ All core config is Zod-validated from environment variables. Server-specific con
189
238
  | `MCP_AUTH_MODE` | `none`, `jwt`, or `oauth` | `none` |
190
239
  | `MCP_AUTH_SECRET_KEY` | JWT signing secret (required for `jwt` mode) | — |
191
240
  | `STORAGE_PROVIDER_TYPE` | `in-memory`, `filesystem`, `supabase`, `cloudflare-d1`/`kv`/`r2` | `in-memory` |
192
- | `CANVAS_PROVIDER_TYPE` | `none` or `duckdb` (Tier 3, optional peer dep `@duckdb/node-api`) | `none` |
241
+ | `CANVAS_PROVIDER_TYPE` | `none` or `duckdb` (optional peer dependency `@duckdb/node-api`) | `none` |
193
242
  | `OTEL_ENABLED` | Enable OpenTelemetry | `false` |
194
243
  | `OPENROUTER_API_KEY` | OpenRouter LLM API key | — |
195
244
 
@@ -201,7 +250,7 @@ See [CLAUDE.md/AGENTS.md](CLAUDE.md) for the full configuration reference.
201
250
 
202
251
  | Function | Purpose |
203
252
  |:---------|:--------|
204
- | `createApp(options)` | Node.js server — handles full lifecycle |
253
+ | `createApp(options)` | Bun or Node.js server — handles full lifecycle |
205
254
  | `createWorkerHandler(options)` | Cloudflare Workers — returns an `ExportedHandler` |
206
255
 
207
256
  ### Builders
@@ -216,7 +265,7 @@ See [CLAUDE.md/AGENTS.md](CLAUDE.md) for the full configuration reference.
216
265
 
217
266
  ### Context
218
267
 
219
- Handlers receive a unified `Context` object:
268
+ Handlers receive a shared `Context`, with typed helpers for declared enrichment and error contracts:
220
269
 
221
270
  | Property | Type | Description |
222
271
  |:---------|:-----|:------------|
@@ -224,7 +273,8 @@ Handlers receive a unified `Context` object:
224
273
  | `ctx.state` | `ContextState` | Tenant-scoped key-value storage |
225
274
  | `ctx.requestInput` | `(spec) => never` | Suspend and ask the caller for more input; the handler is re-entered with the answers |
226
275
  | `ctx.inputs` | `ContextInputs` | Reader over a retried request's responses — `.accepted()`, `.view()`, `.state()`, `.dropped` |
227
- | `ctx.fail` | `(reason, msg?, data?) => McpError` | Typed error throw reason checked against `errors[]` contract at compile time |
276
+ | `ctx.enrich` | `Enrich` / `TypedEnrich<E>` | Add declared result context to structured output and text content |
277
+ | `ctx.fail` | `(reason, msg?, data?) => McpError` | Creates an error for `throw ctx.fail(...)`; available with a declared `errors` contract |
228
278
  | `ctx.signal` | `AbortSignal` | Cancellation signal |
229
279
  | `ctx.notifyResourceUpdated` | `Function?` | Notify subscribed clients a resource changed |
230
280
  | `ctx.notifyResourceListChanged` | `Function?` | Notify clients the resource list changed |
@@ -252,7 +302,7 @@ See [CLAUDE.md/AGENTS.md](CLAUDE.md) for the complete exports reference.
252
302
 
253
303
  ## Examples
254
304
 
255
- The `examples/` directory contains a reference server consuming core through public exports, demonstrating all patterns:
305
+ The `examples/` directory contains a reference server consuming core through public exports, demonstrating core patterns:
256
306
 
257
307
  | Tool | Pattern |
258
308
  |:-----|:--------|
@@ -260,7 +310,7 @@ The `examples/` directory contains a reference server consuming core through pub
260
310
  | `template_cat_fact` | External API call, error factories |
261
311
  | `template_madlibs_elicitation` | `ctx.requestInput` / `ctx.inputs` for multi-round-trip input |
262
312
  | `template_image_test` | Image content blocks |
263
- | `template_data_explorer` | MCP Apps with linked UI resource via `appTool()`/`appResource()` builders |
313
+ | `template_data_explorer` | MCP Apps with a linked HTML UI resource |
264
314
 
265
315
  ## Testing
266
316
 
@@ -277,9 +327,7 @@ const result = await myTool.handler(input, ctx);
277
327
 
278
328
  `/testing` also exports `createMockSession()` for session-bound contexts, `createFetchMock()` for upstream HTTP boundaries, and `runToolContract()` to drive a definition through schema, handler, formatting, and error-envelope checks. `/testing/vitest` adds the `mcpTest` fixtures (`ctx`, `session`, `fetchMock`, `storage`) and `toolContractSuite()`.
279
329
 
280
- ### Fuzz testing
281
-
282
- Schema-aware fuzz testing via `fast-check`. Generates valid inputs from Zod schemas and adversarial payloads (prototype pollution, injection strings, type confusion) to verify handler invariants.
330
+ For fuzz testing, `/testing/fuzz` uses `fast-check` to generate valid inputs from Zod schemas and adversarial payloads that probe for crashes, data leaks, and prototype pollution:
283
331
 
284
332
  ```ts
285
333
  import { fuzzTool } from '@cyanheads/mcp-ts-core/testing/fuzz';
@@ -296,15 +344,15 @@ Also exports `fuzzResource`, `fuzzPrompt`, `zodToArbitrary`, and `ADVERSARIAL_ST
296
344
 
297
345
  - **[CLAUDE.md/AGENTS.md](CLAUDE.md)** — Framework reference: exports catalog, patterns, Context interface, error codes, auth, config, testing. Ships in the npm package and is auto-accessible in your project after `init`.
298
346
  - **[docs/telemetry/](docs/telemetry/)** — OpenTelemetry: full catalog of spans, metrics, and attributes the framework emits ([observability.md](docs/telemetry/observability.md)), plus an example Grafana dashboard and vendor-agnostic query recipes for Datadog, New Relic, Honeycomb ([dashboards.md](docs/telemetry/dashboards.md)).
299
- - **[CHANGELOG.md](CHANGELOG.md)** — Version history. Each entry includes a summary, migration notes, and links to commits/issues.
347
+ - **[CHANGELOG.md](CHANGELOG.md)** — Version history. Each entry includes a summary, migration notes, and links to commits/issues. Directory-based changelogs that work well for Agents. Entries include agent-specific notes per version as needed.
300
348
 
301
349
  ## Development
302
350
 
303
351
  ```bash
304
352
  bun run rebuild # clean + build (scripts/clean.ts + scripts/build.ts)
305
- bun run devcheck # full gate: lint/format, typecheck, MCP defs, framework antipatterns, docs/skills/changelog sync, tests, audit, outdated, secrets/TODO scan
353
+ bun run devcheck # full gate: lint/format, typecheck, MCP defs, framework antipatterns, docs/skills/changelog sync, audit, outdated, secrets/TODO scan
306
354
  bun run lint:mcp # validate MCP definitions against spec
307
- bun run test:all # vitest: unit + Workers pool + integration
355
+ bun run test:all # rebuild + coverage + Node.js + Workers + integration
308
356
  ```
309
357
 
310
358
  ## License
package/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.5.11/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.5.12/schema.json",
3
3
  "vcs": {
4
4
  "enabled": true,
5
5
  "clientKind": "git",
@@ -11,8 +11,8 @@ agent-notes: |
11
11
 
12
12
  ## Added
13
13
 
14
- - **`bun run test:leaks` is an async-resource retention gate** ([#404](https://github.com/cyanheads/mcp-ts-core/issues/404)) — it runs the root runtime projects on real Node, observes every allocation from file collection through worker teardown, and exits nonzero on retained operations, missing evidence, or forced termination. Its sentinel suite runs separately as `bun run test:leak-gate`. Scope and evidence: [tests/leaks/README.md](tests/leaks/README.md).
15
- - **Benchmark lanes** — `bun run bench` / `bench:node` for micro workloads over the tool pipeline, storage, and rate limiter, and `bench:io` / `bench:io:bun` for opt-in HTTP, Workerd, and native I/O measurements. Reports carry runtime and machine provenance; no timing threshold enters `test:all`. See [tests/benchmarks/README.md](tests/benchmarks/README.md).
14
+ - **`bun run test:leaks` is an async-resource retention gate** ([#404](https://github.com/cyanheads/mcp-ts-core/issues/404)) — it runs the root runtime projects on real Node, observes every allocation from file collection through worker teardown, and exits nonzero on retained operations, missing evidence, or forced termination. Its sentinel suite runs separately as `bun run test:leak-gate`. Scope and evidence: [tests/leaks/README.md](https://github.com/cyanheads/mcp-ts-core/blob/v0.12.6/tests/leaks/README.md).
15
+ - **Benchmark lanes** — `bun run bench` / `bench:node` for micro workloads over the tool pipeline, storage, and rate limiter, and `bench:io` / `bench:io:bun` for opt-in HTTP, Workerd, and native I/O measurements. Reports carry runtime and machine provenance; no timing threshold enters `test:all`. See [tests/benchmarks/README.md](https://github.com/cyanheads/mcp-ts-core/blob/v0.12.6/tests/benchmarks/README.md).
16
16
  - **`bun run test:worker` also boots the built bundle standalone** ([#406](https://github.com/cyanheads/mcp-ts-core/issues/406)) — a Wrangler-hosted lane outside the Workerd test pool's module loader, which is where a startup-time failure is observable at all.
17
17
 
18
18
  ## Changed
@@ -0,0 +1,39 @@
1
+ ---
2
+ summary: "Argument rejections now carry the structured error envelope, classified as InvalidParams, on every transport. The Node and workerd type environments are checked as separate TypeScript programs, which lifts the @cloudflare/workers-types hold."
3
+ breaking: false
4
+ security: false
5
+ agent-notes: |
6
+ Two adoption points. A test asserting `JsonRpcErrorCode.ValidationError` for a
7
+ tool's argument rejection must now expect `InvalidParams`. A project whose
8
+ tsconfig loads `node` alongside `@cloudflare/workers-types` can split the two
9
+ programs the way `tsconfig.worker.json` does here, and drop any
10
+ `@cloudflare/workers-types` version hold it carried for the Buffer collision.
11
+ ---
12
+
13
+ # 0.12.7 — 2026-09-08
14
+
15
+ ## Added
16
+
17
+ - **`bun run typecheck:worker`** — the workerd lane checked in its own program (`tsconfig.worker.json`) against the built declarations, so run it after a build. `devcheck` runs it as the `TypeScript (Worker)` check when `dist/` exists.
18
+
19
+ ## Changed
20
+
21
+ - **README rewritten** around a quick start, one worked tool, and a capability table. The package description shortens to "Agent-native TypeScript framework for MCP servers. Includes runtime infrastructure and agent skills for building, testing, and shipping servers." in `package.json`, `CITATION.cff`, and the Docker OCI label; `server.json` carries the first sentence.
22
+ - **Gating a tool now carries a reference audit** ([#402](https://github.com/cyanheads/mcp-ts-core/issues/402)) — `disabledTool()` removes a tool from `tools/list` but rewrites nothing else, so `add-tool` and `design-mcp-server` require that prose, `errors[].recovery` text, and `nextToolSuggestions` entries naming a gated tool be resolved from the same config that decides registration.
23
+ - **Scaffold devDependency pins** — `@biomejs/biome` 2.5.5 → 2.5.12, `@types/node` 26.1.1 → 26.4.0, `vitest` and `@vitest/coverage-istanbul` 4.1.10 → 4.1.11, `ignore` ^7.0.6 → ^7.0.7, `tsc-alias` ^1.9.1 → ^1.9.2.
24
+ - Shipped skills: `add-tool` 2.22, `api-errors` 1.9, `design-mcp-server` 2.24, `field-test` 2.10, `git-wrapup` 1.12.
25
+
26
+ ## Fixed
27
+
28
+ - **An argument rejection carries `structuredContent.error`** ([#377](https://github.com/cyanheads/mcp-ts-core/issues/377)) — an unknown root key, wrong type, missing required field, or failed constraint returns `isError: true` with `error.code` `-32602` and the same readable `Invalid arguments for tool <name>: …` text as before, on the 2025-11-25 and 2026-07-28 revisions and under workerd. `registerTool` receives a schema that projects the source JSON Schema verbatim and defers validation to the handler, which never runs for a rejected call. Direct handler tests that expected `ValidationError` now see `InvalidParams`.
29
+ - **Node and workerd ambient types no longer share a program** ([#397](https://github.com/cyanheads/mcp-ts-core/issues/397)) — `@cloudflare/workers-types` declares `Buffer` as an ambient `const … : any`, which stripped the encoding-aware `toString()` overloads off every Node Buffer while `skipLibCheck` hid the redeclaration. The root and build configs load Node globals only; `tsconfig.worker.json` loads the workerd set for `tests/worker`. Worker types still reach `src/` through module imports.
30
+ - **`bun outdated` rows resolve to the dependency key that declared them** ([#398](https://github.com/cyanheads/mcp-ts-core/issues/398)) — an `npm:` alias is printed under its resolved target, so an allowlist entry keyed on the `package.json` key could never match. Rows are attributed through declared ranges and reprinted under the declared key; where a direct dependency and an alias share a target and attribution stays ambiguous, the row is called out rather than allowlisted.
31
+ - **Packaging validation compares each plugin manifest's `version` with `package.json`** ([#393](https://github.com/cyanheads/mcp-ts-core/issues/393)) — a missing or stale `version` in `.claude-plugin/plugin.json` or `.codex-plugin/plugin.json` fails with the path and expected version. `checkPluginManifests()` takes the package version as a fourth argument; absent manifests and the `packaging.pluginManifests` opt-out are unchanged. Both manifests are named in the `git-wrapup` version lists.
32
+ - **The field-test helper initializes against a stateless server** ([#391](https://github.com/cyanheads/mcp-ts-core/issues/391)) — `mcp_init` decides success on the initialize result rather than the `Mcp-Session-Id` header, and fails loudly on a transport error, a non-2xx status, a JSON-RPC error, or a result with no `protocolVersion`. `mcp_call` accepts an empty `sid`, omits the session header when there is none, and takes the negotiated protocol as a fifth argument.
33
+
34
+ ## Dependencies
35
+
36
+ - `@cloudflare/workers-types` 5.20260730.1 → 5.20260905.1 (the exact pin held for #397 is lifted, and its `devcheck.config.json` allowlist entry removed)
37
+ - `@opentelemetry/exporter-metrics-otlp-http`, `@opentelemetry/exporter-trace-otlp-http`, `@opentelemetry/instrumentation-http`, `@opentelemetry/sdk-node` ^0.221.0 → ^0.222.0; `@opentelemetry/instrumentation-pino` ^0.67.0 → ^0.68.0 (peer floor ^0.66.0 → ^0.68.0)
38
+ - `hono` ^4.13.5 → ^4.13.7, `jose` ^6.2.10 → ^6.2.12
39
+ - `@supabase/supabase-js` ^2.112.4 → ^2.115.0, `openai` ^7.8.0 → ^7.10.0, `@biomejs/biome` 2.5.11 → 2.5.12, `@types/bun` ^1.4.0 → ^1.4.1, `bun-types` ^1.4.0 → ^1.4.2
@@ -9,7 +9,7 @@
9
9
  * exporter is added in the future, `ctx.waitUntil()` should be wired for flush.
10
10
  * @module src/core/worker
11
11
  */
12
- import type { Ai, D1Database, KVNamespace, R2Bucket, ScheduledController } from '@cloudflare/workers-types';
12
+ import type { Ai, D1Database, ExecutionContext, KVNamespace, R2Bucket, ScheduledController } from '@cloudflare/workers-types';
13
13
  import { type CreateAppOptions } from './app.js';
14
14
  /**
15
15
  * Cloudflare Worker Bindings with proper type safety.
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/core/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,EAAE,EAEF,UAAU,EACV,WAAW,EACX,QAAQ,EACR,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AAKvE;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,EAAE,CAAC;IACR;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC,CAAC,EAAE,MAAM,CAAC;IAC7C,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAA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1
- {"version":3,"file":"tool-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAgB,MAAM,8BAA8B,CAAC;AAE5F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAGL,KAAK,sBAAsB,EAE5B,MAAM,gDAAgD,CAAC;AAMxD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE3C,qBAAa,YAAY;IAKrB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ,CAAC;IALnB,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAErD,YACU,QAAQ,EAAE,UAAU,EAAE,EACtB,QAAQ,CAAC,EAAE,sBAAsB,YAAA,EACvC;IAEJ,2EAA2E;IAC9D,WAAW,CACtB,MAAM,EAAE,SAAS,EACjB,aAAa,CAAC,EAAE,qBAAqB,EACrC,GAAG,CAAC,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CA8Cf;IAED,6EAA6E;IAC7E,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,mBAAmB;IAI3B;;;OAGG;YACW,YAAY;CAiD3B"}
1
+ {"version":3,"file":"tool-registration.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAgB,MAAM,8BAA8B,CAAC;AAE5F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAGL,KAAK,sBAAsB,EAE5B,MAAM,gDAAgD,CAAC;AAMxD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAE3C,qBAAa,YAAY;IAKrB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ,CAAC;IALnB,oEAAoE;IACpE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IAErD,YACU,QAAQ,EAAE,UAAU,EAAE,EACtB,QAAQ,CAAC,EAAE,sBAAsB,YAAA,EACvC;IAEJ,2EAA2E;IAC9D,WAAW,CACtB,MAAM,EAAE,SAAS,EACjB,aAAa,CAAC,EAAE,qBAAqB,EACrC,GAAG,CAAC,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CA8Cf;IAED,6EAA6E;IAC7E,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,mBAAmB;IAI3B;;;OAGG;YACW,YAAY;CAuD3B"}
@@ -1,3 +1,4 @@
1
+ import { deferInputValidation } from './utils/deferredInputSchema.js';
1
2
  import { getDisabledMetadata } from './utils/disabled-tool.js';
2
3
  import { advertisedOutputSchema, createToolHandler, } from './utils/toolHandlerFactory.js';
3
4
  import { JsonRpcErrorCode } from '../../types-global/errors.js';
@@ -80,11 +81,16 @@ export class ToolRegistry {
80
81
  }
81
82
  const handler = createToolHandler(tool, this.services, notifiers);
82
83
  const title = tool.title ?? tool.annotations?.title ?? this.deriveTitleFromName(tool.name);
84
+ // Advertised verbatim; the same schema rejects the same arguments one
85
+ // layer down, where a rejection can carry the framework's structured
86
+ // error envelope (#377). The SDK reads it through `~standard` like any
87
+ // other Standard Schema, but types the parameter as Zod.
88
+ const inputSchema = deferInputValidation(tool.input);
83
89
  // Type assertion required: SDK's conditional types don't resolve with erased generics
84
90
  server.registerTool(tool.name, {
85
91
  title,
86
92
  description: tool.description,
87
- inputSchema: tool.input,
93
+ inputSchema,
88
94
  outputSchema: advertisedOutputSchema(tool),
89
95
  ...(tool.annotations && { annotations: tool.annotations }),
90
96
  ...(tool._meta && { _meta: tool._meta }),
@@ -1 +1 @@
1
- {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAGlB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAU3E,MAAM,OAAO,YAAY;IAKb,QAAQ;IACR,QAAQ;IALlB,oEAAoE;IACnD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,QAAsB,EACtB,QAAiC;wBADjC,QAAQ;wBACR,QAAQ;IACf,CAAC;IAEJ,2EAA2E;IACpE,KAAK,CAAC,WAAW,CACtB,MAAiB,EACjB,aAAqC,EACrC,GAAoB;QAEpB,sEAAsE;QACtE,sDAAsD;QACtD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,4EAA4E;QAC5E,0EAA0E;QAC1E,yEAAyE;QACzE,mEAAmE;QACnE,MAAM,SAAS,GAAqB;YAClC,uBAAuB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,EAAE;YAC7D,yBAAyB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE;YACjE,qBAAqB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE;YACzD,GAAG,CAAC,aAAa,IAAI,EAAE,aAAa,EAAE,CAAC;YACvC,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC;SACpB,CAAC;QAEF,MAAM,OAAO,GAAG,qBAAqB,CAAC,oBAAoB,CAAC;YACz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AC;gBAC1D,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;aACzC,EACD,OAA0C,CAC3C,CAAC;YAEF,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QACpF,CAAC,EACD;YACE,SAAS,EAAE,mBAAmB,IAAI,CAAC,IAAI,EAAE;YACzC,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/tool-registration.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAGlB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAU3E,MAAM,OAAO,YAAY;IAKb,QAAQ;IACR,QAAQ;IALlB,oEAAoE;IACnD,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAErD,YACU,QAAsB,EACtB,QAAiC;wBADjC,QAAQ;wBACR,QAAQ;IACf,CAAC;IAEJ,2EAA2E;IACpE,KAAK,CAAC,WAAW,CACtB,MAAiB,EACjB,aAAqC,EACrC,GAAoB;QAEpB,sEAAsE;QACtE,sDAAsD;QACtD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAE7B,4EAA4E;QA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AAC,CAAC;YAClE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE3F,sEAAsE;YACtE,qEAAqE;YACrE,uEAAuE;YACvE,yDAAyD;YACzD,MAAM,WAAW,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAiC,CAAC;YAErF,sFAAsF;YACtF,MAAM,CAAC,YAAY,CACjB,IAAI,CAAC,IAAI,EACT;gBACE,KAAK;gBACL,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,WAAW;gBACX,YAAY,EAAE,sBAAsB,CAAC,IAAI,CAAC;gBAC1C,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC1D,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;aACzC,EACD,OAA0C,CAC3C,CAAC;YAEF,MAAM,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QACpF,CAAC,EACD;YACE,SAAS,EAAE,mBAAmB,IAAI,CAAC,IAAI,EAAE;YACzC,OAAO,EAAE,mBAAmB;YAC5B,SAAS,EAAE,gBAAgB,CAAC,oBAAoB;YAChD,QAAQ,EAAE,IAAI;SACf,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @fileoverview Advertise a tool's input schema to the SDK while keeping
3
+ * argument rejection inside the framework (issue #377).
4
+ *
5
+ * SDK 2.0.0 rejects invalid `tools/call` arguments before the handler runs,
6
+ * returning `{ content: [text], isError: true }` without `structuredContent.error`.
7
+ * It exposes no per-tool validation hook, but uses `~standard` for both schema
8
+ * advertising and validation.
9
+ *
10
+ * Preserve Zod's JSON Schema converters verbatim, including strict root keys
11
+ * and `x-mcp-header` designations. Pass validation through to the framework
12
+ * handler, which parses against the same schema and emits the structured error
13
+ * envelope. The advertised schema and accepted arguments remain unchanged.
14
+ *
15
+ * @module src/mcp-server/tools/utils/deferredInputSchema
16
+ */
17
+ import type { ToolInputSchema } from './toolDefinition.js';
18
+ /**
19
+ * The `~standard` surface the SDK consumes from a registered input schema:
20
+ * `jsonSchema[io]()` for advertising, `validate()` for `tools/call`.
21
+ */
22
+ export interface DeferredInputSchema {
23
+ '~standard': {
24
+ jsonSchema: ToolInputSchema['~standard']['jsonSchema'];
25
+ validate: (value: unknown) => {
26
+ value: unknown;
27
+ };
28
+ vendor: string;
29
+ version: 1;
30
+ };
31
+ }
32
+ /**
33
+ * Wraps a tool's input schema for `server.registerTool()`. The JSON Schema
34
+ * projection delegates to the source schema, so what `tools/list` advertises is
35
+ * unchanged; `validate` passes arguments through untouched, leaving rejection
36
+ * to the framework handler that parses them against the same schema.
37
+ */
38
+ export declare function deferInputValidation(input: ToolInputSchema): DeferredInputSchema;
39
+ //# sourceMappingURL=deferredInputSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deferredInputSchema.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/deferredInputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE;QACX,UAAU,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;QACvD,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK;YAAE,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QACjD,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC;KACZ,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,eAAe,GAAG,mBAAmB,CAShF"}