@cyanheads/mcp-ts-core 0.8.20 → 0.9.0
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.
- package/CLAUDE.md +21 -13
- package/README.md +43 -9
- package/biome.json +1 -1
- package/changelog/0.9.x/0.9.0.md +80 -0
- package/changelog/template.md +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/core/app.d.ts +11 -2
- package/dist/core/app.d.ts.map +1 -1
- package/dist/core/app.js +3 -19
- package/dist/core/app.js.map +1 -1
- package/dist/core/worker.d.ts +17 -2
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/core/worker.js +6 -2
- package/dist/core/worker.js.map +1 -1
- package/dist/linter/rules/index.d.ts +1 -0
- package/dist/linter/rules/index.d.ts.map +1 -1
- package/dist/linter/rules/index.js +1 -0
- package/dist/linter/rules/index.js.map +1 -1
- package/dist/linter/rules/portability-rules.d.ts +49 -0
- package/dist/linter/rules/portability-rules.d.ts.map +1 -0
- package/dist/linter/rules/portability-rules.js +209 -0
- package/dist/linter/rules/portability-rules.js.map +1 -0
- package/dist/linter/rules/prompt-rules.d.ts +2 -1
- package/dist/linter/rules/prompt-rules.d.ts.map +1 -1
- package/dist/linter/rules/prompt-rules.js +7 -2
- package/dist/linter/rules/prompt-rules.js.map +1 -1
- package/dist/linter/rules/resource-rules.d.ts +2 -1
- package/dist/linter/rules/resource-rules.d.ts.map +1 -1
- package/dist/linter/rules/resource-rules.js +12 -3
- package/dist/linter/rules/resource-rules.js.map +1 -1
- package/dist/linter/rules/schema-rules.d.ts +2 -0
- package/dist/linter/rules/schema-rules.d.ts.map +1 -1
- package/dist/linter/rules/schema-rules.js +1 -1
- package/dist/linter/rules/schema-rules.js.map +1 -1
- package/dist/linter/rules/tool-rules.d.ts +2 -1
- package/dist/linter/rules/tool-rules.d.ts.map +1 -1
- package/dist/linter/rules/tool-rules.js +12 -3
- package/dist/linter/rules/tool-rules.js.map +1 -1
- package/dist/linter/types.d.ts +15 -0
- package/dist/linter/types.d.ts.map +1 -1
- package/dist/linter/validate.d.ts.map +1 -1
- package/dist/linter/validate.js +22 -3
- package/dist/linter/validate.js.map +1 -1
- package/dist/logs/combined.log +7 -7
- package/dist/logs/error.log +5 -5
- package/dist/mcp-server/server.d.ts +8 -0
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +1 -0
- package/dist/mcp-server/server.js.map +1 -1
- package/dist/mcp-server/transports/http/httpServer.d.ts +22 -0
- package/dist/mcp-server/transports/http/httpServer.d.ts.map +1 -0
- package/dist/mcp-server/transports/http/httpServer.js +121 -0
- package/dist/mcp-server/transports/http/httpServer.js.map +1 -0
- package/dist/mcp-server/transports/http/httpTransport.d.ts +5 -14
- package/dist/mcp-server/transports/http/httpTransport.d.ts.map +1 -1
- package/dist/mcp-server/transports/http/httpTransport.js +15 -114
- package/dist/mcp-server/transports/http/httpTransport.js.map +1 -1
- package/dist/mcp-server/transports/manager.js +1 -1
- package/dist/mcp-server/transports/manager.js.map +1 -1
- package/dist/storage/core/storageValidation.js +2 -2
- package/dist/storage/providers/fileSystem/fileSystemProvider.d.ts.map +1 -1
- package/dist/storage/providers/fileSystem/fileSystemProvider.js +15 -10
- package/dist/storage/providers/fileSystem/fileSystemProvider.js.map +1 -1
- package/dist/utils/internal/logger.d.ts.map +1 -1
- package/dist/utils/internal/logger.js +25 -10
- package/dist/utils/internal/logger.js.map +1 -1
- package/dist/utils/internal/runtime.d.ts +18 -2
- package/dist/utils/internal/runtime.d.ts.map +1 -1
- package/dist/utils/internal/runtime.js +18 -3
- package/dist/utils/internal/runtime.js.map +1 -1
- package/dist/utils/network/fetchWithTimeout.d.ts +19 -16
- package/dist/utils/network/fetchWithTimeout.d.ts.map +1 -1
- package/dist/utils/network/fetchWithTimeout.js +66 -32
- package/dist/utils/network/fetchWithTimeout.js.map +1 -1
- package/dist/utils/scheduling/scheduler.js +1 -1
- package/dist/utils/scheduling/scheduler.js.map +1 -1
- package/dist/utils/security/rateLimiter.d.ts.map +1 -1
- package/dist/utils/security/rateLimiter.js +4 -1
- package/dist/utils/security/rateLimiter.js.map +1 -1
- package/dist/utils/telemetry/instrumentation.d.ts.map +1 -1
- package/dist/utils/telemetry/instrumentation.js +5 -1
- package/dist/utils/telemetry/instrumentation.js.map +1 -1
- package/package.json +7 -7
- package/scripts/build-changelog.ts +3 -3
- package/skills/add-tool/SKILL.md +17 -1
- package/skills/api-errors/SKILL.md +7 -1
- package/skills/api-linter/SKILL.md +75 -1
- package/skills/design-mcp-server/SKILL.md +2 -1
- package/skills/field-test/SKILL.md +2 -1
- package/skills/polish-docs-meta/SKILL.md +2 -2
- package/skills/polish-docs-meta/references/readme.md +1 -1
- package/skills/tool-defs-analysis/SKILL.md +19 -3
- package/templates/AGENTS.md +9 -9
- package/templates/CLAUDE.md +9 -9
- package/templates/changelog/template.md +1 -1
- package/templates/src/index.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimiter.js","sourceRoot":"","sources":["../../../src/utils/security/rateLimiter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAuB,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,IAAI,gBAA8D,CAAC;AAEnE,SAAS,mBAAmB;IAC1B,gBAAgB,KAAK,aAAa,CAChC,0BAA0B,EAC1B,uBAAuB,EACvB,cAAc,CACf,CAAC;IACF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC9B,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,oBAAoB;IAClC,mBAAmB,EAAE,CAAC;AACxB,CAAC;AAkCD;;;;;;;;;;;;;;;;GA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C,GAAW;QAM1B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,KAAK;YACpB,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW;YACvC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;YACtE,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,OAAO;QACZ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../src/utils/telemetry/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKvD;;;;;GAKG;AACH,eAAO,IAAI,GAAG,EAAE,OAAO,GAAG,IAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../src/utils/telemetry/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKvD;;;;;GAKG;AACH,eAAO,IAAI,GAAG,EAAE,OAAO,GAAG,IAAW,CAAC;AAsEtC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAqH7D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,qBAAqB,CAAC,SAAS,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B3E"}
|
|
@@ -19,12 +19,16 @@ let isOtelInitialized = false;
|
|
|
19
19
|
let initializationPromise = null;
|
|
20
20
|
/**
|
|
21
21
|
* Determines if the NodeSDK can be used in the current runtime.
|
|
22
|
-
* Returns false in Worker/Edge environments
|
|
22
|
+
* Returns false in Worker/Edge environments — Cloudflare Workers with
|
|
23
|
+
* `nodejs_compat` populate `process.versions.node`, so we must explicitly
|
|
24
|
+
* check `isWorkerLike` to avoid the SDK loading `node:perf_hooks` and
|
|
25
|
+
* `node:worker_threads` that the polyfill does not provide.
|
|
23
26
|
* Bun is allowed — auto-instrumentations that rely on Node http hooks silently
|
|
24
27
|
* no-op, but manual spans, custom metrics, and OTLP export all work correctly.
|
|
25
28
|
*/
|
|
26
29
|
function canUseNodeSDK() {
|
|
27
30
|
return (runtimeCaps.isNode &&
|
|
31
|
+
!runtimeCaps.isWorkerLike &&
|
|
28
32
|
typeof process?.versions?.node === 'string' &&
|
|
29
33
|
typeof process.env === 'object');
|
|
30
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../../src/utils/telemetry/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,CAAC,IAAI,GAAG,GAAmB,IAAI,CAAC;AAEtC,kCAAkC;AAClC,IAAI,iBAAiB,GAAG,KAAK,CAAC;AAC9B,IAAI,qBAAqB,GAAyB,IAAI,CAAC;AAEvD
|
|
1
|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AAK,GAAG,UAAU,CACtB,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,EAC7D,SAAS,CACV,CAAC;QAEF,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;QACtD,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,KAAK,CAAC,CAAC,gCAAgC;IAC/C,CAAC;YAAS,CAAC;QACT,GAAG,GAAG,IAAI,CAAC;QACX,iBAAiB,GAAG,KAAK,CAAC;QAC1B,qBAAqB,GAAG,IAAI,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/mcp-ts-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"mcpName": "io.github.cyanheads/mcp-ts-core",
|
|
5
5
|
"description": "Agent-native TypeScript framework for building MCP servers. Declarative definitions with auth, multi-backend storage, OpenTelemetry, and first-class support for Bun/Node/Cloudflare Workers.",
|
|
6
6
|
"main": "dist/core/index.js",
|
|
@@ -164,9 +164,9 @@
|
|
|
164
164
|
"yaml": "1.10.3"
|
|
165
165
|
},
|
|
166
166
|
"devDependencies": {
|
|
167
|
-
"@biomejs/biome": "2.4.
|
|
167
|
+
"@biomejs/biome": "2.4.15",
|
|
168
168
|
"@cloudflare/vitest-pool-workers": "^0.16.3",
|
|
169
|
-
"@cloudflare/workers-types": "^4.
|
|
169
|
+
"@cloudflare/workers-types": "^4.20260511.1",
|
|
170
170
|
"@duckdb/node-api": "^1.5.2-r.1",
|
|
171
171
|
"@hono/otel": "^1.1.2",
|
|
172
172
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.217.0",
|
|
@@ -185,8 +185,8 @@
|
|
|
185
185
|
"@types/papaparse": "^5.5.2",
|
|
186
186
|
"@types/sanitize-html": "^2.16.1",
|
|
187
187
|
"@types/validator": "^13.15.10",
|
|
188
|
-
"@vitest/coverage-istanbul": "4.1.
|
|
189
|
-
"@vitest/ui": "4.1.
|
|
188
|
+
"@vitest/coverage-istanbul": "4.1.6",
|
|
189
|
+
"@vitest/ui": "4.1.6",
|
|
190
190
|
"bun-types": "^1.3.13",
|
|
191
191
|
"chrono-node": "^2.9.1",
|
|
192
192
|
"clipboardy": "^5.3.1",
|
|
@@ -212,8 +212,8 @@
|
|
|
212
212
|
"typescript": "^6.0.3",
|
|
213
213
|
"unpdf": "^1.6.2",
|
|
214
214
|
"validator": "^13.15.35",
|
|
215
|
-
"vite": "8.0.
|
|
216
|
-
"vitest": "^4.1.
|
|
215
|
+
"vite": "8.0.12",
|
|
216
|
+
"vitest": "^4.1.6"
|
|
217
217
|
},
|
|
218
218
|
"keywords": [
|
|
219
219
|
"agent",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Source of truth: `changelog/<major.minor>.x/<version>.md` — each file opens with
|
|
6
6
|
* YAML frontmatter declaring:
|
|
7
|
-
* • summary (required) — ≤
|
|
7
|
+
* • summary (required) — ≤350-char headline, no markdown, one line
|
|
8
8
|
* • breaking (optional) — `true` flags releases with breaking changes
|
|
9
9
|
* • security (optional) — `true` flags releases with security fixes
|
|
10
10
|
*
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* • --check → exit 1 if CHANGELOG.md differs from what would be generated
|
|
25
25
|
*
|
|
26
26
|
* Missing `summary`: warning (not failure) — the entry renders header-only.
|
|
27
|
-
* Summary >
|
|
27
|
+
* Summary > 350 chars, or malformed `breaking` / `security`: hard error.
|
|
28
28
|
*
|
|
29
29
|
* @module scripts/build-changelog
|
|
30
30
|
*/
|
|
@@ -37,7 +37,7 @@ const CHANGELOG_DIR = resolve('changelog');
|
|
|
37
37
|
const CHANGELOG_PATH = resolve('CHANGELOG.md');
|
|
38
38
|
const EXCLUDED_FILES = new Set(['template.md', 'README.md']);
|
|
39
39
|
const SERIES_PATTERN = /^\d+\.\d+\.x$/;
|
|
40
|
-
const SUMMARY_MAX_LENGTH =
|
|
40
|
+
const SUMMARY_MAX_LENGTH = 350;
|
|
41
41
|
|
|
42
42
|
const HEADER = `# Changelog
|
|
43
43
|
|
package/skills/add-tool/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
Scaffold a new MCP tool definition. Use when the user asks to add a tool, create a new tool, or implement a new capability for the server.
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "2.
|
|
7
|
+
version: "2.9"
|
|
8
8
|
audience: external
|
|
9
9
|
type: reference
|
|
10
10
|
---
|
|
@@ -293,6 +293,21 @@ format: (result) => {
|
|
|
293
293
|
},
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
+
### Mutator response design
|
|
297
|
+
|
|
298
|
+
Mutators (write/update/delete/append/patch verbs, or `destructiveHint: true`) surface raw pre- and post-mutation observable state — not a synthetic verdict. The server can detect anomalies but can't classify them as problems; only the agent knows whether `file shrunk` is intentional truncation or a bug.
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
output: z.object({
|
|
302
|
+
path: z.string().describe('Resolved target path.'),
|
|
303
|
+
created: z.boolean().describe('True when the operation created a new target.'),
|
|
304
|
+
previousSizeInBytes: z.number().describe('Byte size before the mutation. Zero when created is true.'),
|
|
305
|
+
currentSizeInBytes: z.number().describe('Byte size after the mutation. Equals previous when no-op.'),
|
|
306
|
+
}),
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
The agent reads `created: true, previousSizeInBytes: 0, currentSizeInBytes: 68` and knows: brand new target, the full file content is the body. If that matches intent, fine; if not (typo path, uninitialized periodic note), the agent self-corrects without re-fetching. Anti-pattern: server-side `>=` integrity throws on mutators — the server can't distinguish intentional shrink from bug, so it throws on every shrink, including the deliberate ones.
|
|
310
|
+
|
|
296
311
|
### Sparse upstream data must stay honest
|
|
297
312
|
|
|
298
313
|
When tool output comes from a third-party API, don't overstate certainty. Upstream systems often omit fields entirely; the tool schema and `format()` should preserve that uncertainty instead of collapsing it into fake `false`, `0`, or empty-string facts.
|
|
@@ -514,6 +529,7 @@ Large payloads burn the agent's context window. Default to curated summaries; of
|
|
|
514
529
|
|
|
515
530
|
- [ ] File created at `src/mcp-server/tools/definitions/{{tool-name}}.tool.ts`
|
|
516
531
|
- [ ] All Zod schema fields have `.describe()` annotations
|
|
532
|
+
- [ ] Numeric `output` fields carry units in the field name (`sizeInBytes`, `durationInMs`, `priceInCents`, `latencyInMs`) — `.describe()` may be summarized away or truncated, but the field name persists into the JSON the agent reads. Exempt: dimensionless counts (`totalCount`, `itemCount`), indices (`index`, `position`)
|
|
517
533
|
- [ ] Schemas use only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, `z.bigint()`, `z.symbol()`, `z.void()`, `z.map()`, `z.set()`)
|
|
518
534
|
- [ ] JSDoc `@fileoverview` and `@module` header present
|
|
519
535
|
- [ ] Optional nested objects guarded for empty inner values from form-based clients (check `?.field` truthiness, not just object presence)
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
McpError constructor, JsonRpcErrorCode reference, and error handling patterns for `@cyanheads/mcp-ts-core`. Use when looking up error codes, understanding where errors should be thrown vs. caught, or using ErrorHandler.tryCatch in services.
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.6"
|
|
8
8
|
audience: external
|
|
9
9
|
type: reference
|
|
10
10
|
---
|
|
@@ -161,6 +161,12 @@ throw validationError(message, {
|
|
|
161
161
|
|
|
162
162
|
---
|
|
163
163
|
|
|
164
|
+
## When not to throw
|
|
165
|
+
|
|
166
|
+
Throw when the server has authoritative classification — auth failure, rate limit, schema violation, upstream 5xx, missing required input. Don't throw when "this looks wrong" depends on intent the server can't see. For mutators, surface raw pre- and post-mutation observable state in the response and let the agent decide whether it matches intent — the server can detect that the file shrunk, but only the agent knows whether it was supposed to. Tell: defensive code justified as a free rider on other work — audit it standalone, and it usually doesn't earn its keep.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
164
170
|
## Error Factories (fallback)
|
|
165
171
|
|
|
166
172
|
Use when no contract entry fits — ad-hoc throws, tools without a contract, or service-layer code. Shorter than `new McpError(...)` and self-documenting. All return `McpError` instances and accept an optional `options` parameter for error chaining via `{ cause }`.
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
MCP definition linter rules reference. Use when `bun run lint:mcp`, `bun run devcheck`, or `createApp()` startup reports a lint error or warning (`format-parity`, `schema-is-object`, `name-format`, `server-json-*`, etc.) and you need to understand the rule, its severity, and how to fix it. Every rule ID the linter emits has an entry in this doc.
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.3"
|
|
8
8
|
audience: external
|
|
9
9
|
type: reference
|
|
10
10
|
---
|
|
@@ -45,6 +45,7 @@ Grouped by family. Jump to any rule ID via its anchor.
|
|
|
45
45
|
|:-------|:------|:--------|
|
|
46
46
|
| Format parity | `format-parity`, `format-parity-threw`, `format-parity-walk-failed` | [Format parity](#format-parity) |
|
|
47
47
|
| Schema | `schema-is-object`, `describe-on-fields`, `schema-serializable` | [Schema rules](#schema-rules) |
|
|
48
|
+
| Portability | `schema-format-portability`, `schema-anyof-needs-type`, `schema-no-discriminator-keyword`, `schema-no-defs`, `schema-dialect-tag` | [Portability rules](#portability-rules) |
|
|
48
49
|
| Names | `name-required`, `name-format`, `name-unique` | [Name rules](#name-rules) |
|
|
49
50
|
| Tools | `description-required`, `handler-required`, `auth-type`, `auth-scope-format`, `annotation-type`, `annotation-coherence`, `meta-ui-type`, `meta-ui-resource-uri-required`, `meta-ui-resource-uri-scheme`, `app-tool-resource-pairing` | [Tool rules](#tool-rules) |
|
|
50
51
|
| Resources | `uri-template-required`, `uri-template-valid`, `resource-name-not-uri`, `template-params-align` | [Resource rules](#resource-rules) |
|
|
@@ -188,6 +189,79 @@ Parse the string to a `Date` inside the handler if you need one.
|
|
|
188
189
|
|
|
189
190
|
---
|
|
190
191
|
|
|
192
|
+
## Portability rules
|
|
193
|
+
|
|
194
|
+
MCP pins JSON Schema 2020-12 as the default dialect (SEP-1613), but LLM vendors accept different *subsets*. A schema that passes `schema-serializable` can still hard-fail at OpenAI's tool validator or silently lose fields at Gemini's API surface. These rules walk the emitted JSON Schema for patterns that break cross-vendor.
|
|
195
|
+
|
|
196
|
+
Three default-on, two opt-in. Promote opt-ins via `MCP_LINT_PORTABILITY=strict` (env) or `validateDefinitions({ portability: 'strict' })` when targeting multi-vendor deployments.
|
|
197
|
+
|
|
198
|
+
| Rule | Severity | Default-on? |
|
|
199
|
+
|:-----|:---------|:------------|
|
|
200
|
+
| `schema-format-portability` | error | yes |
|
|
201
|
+
| `schema-anyof-needs-type` | warning | yes |
|
|
202
|
+
| `schema-no-discriminator-keyword` | warning | yes |
|
|
203
|
+
| `schema-no-defs` | warning | only when `portability: 'strict'` |
|
|
204
|
+
| `schema-dialect-tag` | warning | only when `portability: 'strict'` |
|
|
205
|
+
|
|
206
|
+
### schema-format-portability
|
|
207
|
+
|
|
208
|
+
**Severity:** error
|
|
209
|
+
|
|
210
|
+
Fires when the emitted schema contains a `format` value outside the allowlist. Default = OpenAI's nine: `date-time`, `time`, `date`, `duration`, `email`, `hostname`, `ipv4`, `ipv6`, `uuid` — the strictest commonly-used target. OpenAI's tool validator **hard-rejects** unknown formats: the tool never registers and the model never sees it. Field report: [cyanheads/git-mcp-server#47](https://github.com/cyanheads/git-mcp-server/issues/47) (`gpt-5-codex` rejecting `format: "uri"` from `z.url()`).
|
|
211
|
+
|
|
212
|
+
Zod methods vs. the default allowlist:
|
|
213
|
+
|
|
214
|
+
| Zod call | Emitted format | Allowed? |
|
|
215
|
+
|:---------|:---------------|:---------|
|
|
216
|
+
| `z.email()`, `z.uuid()`, `z.iso.datetime()`, `z.iso.date()` | `email` / `uuid` / `date-time` / `date` | yes |
|
|
217
|
+
| `z.url()` | `uri` | **no — fires** |
|
|
218
|
+
| `z.cuid()`, `z.cuid2()`, `z.ulid()`, `z.nanoid()`, `z.base64()`, `z.jwt()` | various | **no — fires** |
|
|
219
|
+
|
|
220
|
+
**Fix:** drop the format method, move the constraint into `.describe()` text where the model reads it:
|
|
221
|
+
|
|
222
|
+
```ts
|
|
223
|
+
// Wrong // Right
|
|
224
|
+
homepage: z.url().describe('Homepage') homepage: z.string().describe('Homepage (absolute URL)')
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Override:** widen the allowlist when targeting only vendors that accept the format:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
validateDefinitions({ formatAllowlist: ['email', 'uuid', 'date-time', 'uri'], tools, resources, prompts });
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### schema-anyof-needs-type
|
|
234
|
+
|
|
235
|
+
**Severity:** warning
|
|
236
|
+
|
|
237
|
+
Fires when an `anyOf`/`oneOf` branch lacks a top-level `type`. Gemini rejects with `400: reference to undefined schema`. Triggered by patterns like `z.union([z.object({...}).nullable(), z.object({...})])` — the inner nullable emits a typeless `anyOf`.
|
|
238
|
+
|
|
239
|
+
**Fix:** prefer optionality via required-omission, or use `z.discriminatedUnion` for tagged unions — both emit branches with explicit `type: "object"`.
|
|
240
|
+
|
|
241
|
+
### schema-no-discriminator-keyword
|
|
242
|
+
|
|
243
|
+
**Severity:** warning
|
|
244
|
+
|
|
245
|
+
Fires when a schema carries the OpenAPI `discriminator` keyword. OpenAI silently ignores it; Gemini doesn't recognize it. Zod 4's `z.discriminatedUnion` emits the portable shape (`oneOf` of typed branches with `const`-tagged literals), so this rule mainly catches hand-built schemas attached via `.meta({...})` or third-party-generated JSON Schema.
|
|
246
|
+
|
|
247
|
+
**Fix:** drop the `discriminator` meta — the `const` literals on each branch are how clients tell variants apart.
|
|
248
|
+
|
|
249
|
+
### schema-no-defs
|
|
250
|
+
|
|
251
|
+
**Severity:** warning (only when `portability: 'strict'`)
|
|
252
|
+
|
|
253
|
+
Fires when emitted output contains `$defs` or `$ref`. Gemini rejects these (`400: reference to undefined schema`). Typically caused by reused or recursive types built with `z.lazy(...)`. Opt-in because [SEP-1576](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1576) (token-bloat mitigation) is moving the community toward more `$defs`.
|
|
254
|
+
|
|
255
|
+
**Fix:** inline the recursive type with bounded depth, or accept the Gemini limitation if you target only Anthropic clients.
|
|
256
|
+
|
|
257
|
+
### schema-dialect-tag
|
|
258
|
+
|
|
259
|
+
**Severity:** warning (only when `portability: 'strict'`)
|
|
260
|
+
|
|
261
|
+
Fires when the top-level schema is missing `$schema`. SEP-1613 makes JSON Schema 2020-12 the default dialect, but explicit tagging (`"$schema": "https://json-schema.org/draft/2020-12/schema"`) is forward-compatible — older SDK clients default to draft-07. Zod 4's `toJSONSchema` always emits `$schema`, so this rule is a no-op for Zod-only servers; it exists as forward-compat for hand-built schemas (see SEP-834).
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
191
265
|
## Name rules
|
|
192
266
|
|
|
193
267
|
### name-required
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
Design the tool surface, resources, and service layer for a new MCP server. Use when starting a new server, planning a major feature expansion, or when the user describes a domain/API they want to expose via MCP. Produces a design doc at docs/design.md that drives implementation.
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "2.
|
|
7
|
+
version: "2.11"
|
|
8
8
|
audience: external
|
|
9
9
|
type: workflow
|
|
10
10
|
---
|
|
@@ -255,6 +255,7 @@ The output schema and `format` function control what the LLM reads back. Design
|
|
|
255
255
|
|
|
256
256
|
**Principles:**
|
|
257
257
|
|
|
258
|
+
- **Server reports what only the server can know; agent decides what only the agent can know.** Schema, scopes, rate limits, and raw observable state belong to the server. Semantic correctness, intent-vs-effect matching, and recovery choice belong to the agent. For mutators, this means surfacing pre/post observable state rather than throwing on synthetic deltas the server can't authoritatively classify — `file shrunk` could be deliberate truncation or a bug; only the agent knows. See `add-tool` skill's **Mutator response design**.
|
|
258
259
|
- **Include IDs and references for chaining.** If the agent might act on a result, return the identifiers it needs for follow-up tool calls.
|
|
259
260
|
- **Curate vs. pass-through depends on domain.** Medical/scientific data — don't trim fields that could alter correctness. CRUD responses — return what the agent needs, not the full API payload. Match fidelity to consequence.
|
|
260
261
|
- **Surface what was done, not just results.** After a write operation, include the post-state so the LLM can chain without an extra round trip.
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
Exercise tools, resources, and prompts against a live HTTP server via MCP JSON-RPC over curl. Starts the server, surfaces the catalog, runs real and adversarial inputs, and produces a tight report with concrete findings and numbered follow-up options. Use after adding or modifying definitions, or when the user asks to test, try out, or verify their MCP surface.
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "2.
|
|
7
|
+
version: "2.4"
|
|
8
8
|
audience: external
|
|
9
9
|
type: debug
|
|
10
10
|
---
|
|
@@ -244,6 +244,7 @@ Treat any hit as a `ux` finding in the report. The authoring rule lives under *T
|
|
|
244
244
|
| `cursor` / `offset` / `limit` params | Pagination: second page, end-of-list |
|
|
245
245
|
| Tool declared an `errors: [...]` contract | Error contract (tool): trigger ≥1 declared failure mode. Verify `result.structuredContent.error.code` matches the contract entry, `result.structuredContent.error.data.reason` is the declared reason (only present when the handler threw an `McpError` — `ctx.fail` always does, plain `throw new Error(...)` does not), and `content[0].text` is actionable. Reasons declared but unreachable from any input are dead contract entries. |
|
|
246
246
|
| Resource declared an `errors: [...]` contract | Error contract (resource): trigger ≥1 declared failure mode by reading a URI that exercises it. Resources re-throw errors at the JSON-RPC level — verify `error.code` matches the contract entry and `error.data.reason` is the declared reason. (Resources don't use the `result.isError` envelope — they fail the request itself.) |
|
|
247
|
+
| Mutator (write/update/delete/append/patch verbs, or `destructiveHint: true`) | Mutator response observability: run an intentionally-ambiguous input (typo path, wrong ID, already-deleted target). Confirm the response carries enough state (pre/post values, state-change discriminator) for the agent to detect intent-effect divergence without re-fetching. |
|
|
247
248
|
|
|
248
249
|
**Resources.** Happy path, not-found URI, `list` if defined, pagination if used.
|
|
249
250
|
**Prompts.** Happy path, defaults omitted, skim message quality.
|
|
@@ -4,7 +4,7 @@ description: >
|
|
|
4
4
|
Finalize documentation and project metadata for a ship-ready MCP server. Use after implementation is complete, tests pass, and devcheck is clean. Safe to run at any stage — each step checks current state and only acts on what still needs work.
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.8"
|
|
8
8
|
audience: external
|
|
9
9
|
type: workflow
|
|
10
10
|
---
|
|
@@ -144,7 +144,7 @@ Per-version file format:
|
|
|
144
144
|
|
|
145
145
|
```markdown
|
|
146
146
|
---
|
|
147
|
-
summary: One-line headline for the rollup index — ≤
|
|
147
|
+
summary: One-line headline for the rollup index — ≤350 chars, no markdown
|
|
148
148
|
breaking: false
|
|
149
149
|
---
|
|
150
150
|
|
|
@@ -347,7 +347,7 @@ Table of environment variables. Include framework vars only if the server uses n
|
|
|
347
347
|
| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |
|
|
348
348
|
| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |
|
|
349
349
|
| `STORAGE_PROVIDER_TYPE` | Storage backend. | `in-memory` |
|
|
350
|
-
| `OTEL_ENABLED` | Enable OpenTelemetry. | `false` |
|
|
350
|
+
| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry) (spans, metrics, completion logs). | `false` |
|
|
351
351
|
|
|
352
352
|
See [`.env.example`](./.env.example) for the full list of optional overrides.
|
|
353
353
|
```
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tool-defs-analysis
|
|
3
3
|
description: >
|
|
4
|
-
Read-only audit of MCP definition language across an existing surface — tools, resources, prompts. Walks every definition file and checks
|
|
4
|
+
Read-only audit of MCP definition language across an existing surface — tools, resources, prompts. Walks every definition file and checks 12 categories the LLM reads to decide whether and how to call: voice & tense, internal leaks, audience leaks, defaults, recovery hints, output descriptions, cross-references, sparsity, examples, structure, mutator observability, unit-bearing numeric names. Produces grouped findings with file:line citations and a numbered options list. Use during polish, after a refactor, or before a release. Complements `field-test` (behavior testing) and `security-pass` (security audit).
|
|
5
5
|
metadata:
|
|
6
6
|
author: cyanheads
|
|
7
|
-
version: "1.
|
|
7
|
+
version: "1.2"
|
|
8
8
|
audience: external
|
|
9
9
|
type: audit
|
|
10
10
|
---
|
|
@@ -57,7 +57,7 @@ The `*tool.ts` / `*resource.ts` patterns also catch `*.app-tool.ts` / `*.app-res
|
|
|
57
57
|
|
|
58
58
|
Use `TaskCreate` — one task per file. Mark each complete after its findings are captured.
|
|
59
59
|
|
|
60
|
-
### 2. Walk the
|
|
60
|
+
### 2. Walk the 12 categories per file
|
|
61
61
|
|
|
62
62
|
Read each definition file in full. Apply every category — most files trip more than one. Capture each hit with `file:line`, the offending excerpt, and a one-line fix.
|
|
63
63
|
|
|
@@ -159,6 +159,22 @@ Prior art: #74. Field-test catches this in its leak audit; this skill is the mor
|
|
|
159
159
|
|
|
160
160
|
Prior art: #33.
|
|
161
161
|
|
|
162
|
+
#### 11. Mutator observability
|
|
163
|
+
|
|
164
|
+
**Look in:** tool definitions without `annotations.readOnlyHint: true` (writes/updates/deletes/appends/patches).
|
|
165
|
+
|
|
166
|
+
**Check:** `output` carries a state-change discriminator (`created`, `updated`, `mutated`, `unchanged`) or before/after observable state the agent can use to confirm intent-effect match. The server reports what it observed; the agent decides whether it matches what it meant.
|
|
167
|
+
|
|
168
|
+
**Smell:** mutator output is `{ path, ok }` or `{ success: true }` — no pre/post state, no discriminator. Server-side defensive throws on synthetic deltas (`file shrunk`, `count decreased`) the server can't authoritatively classify as bugs.
|
|
169
|
+
|
|
170
|
+
#### 12. Unit-bearing numeric names
|
|
171
|
+
|
|
172
|
+
**Look in:** every `z.number()` field in `output` schemas.
|
|
173
|
+
|
|
174
|
+
**Check:** the field name carries a unit when not pinned by context — `sizeInBytes`, `durationInMs`, `priceInCents`, `latencyInMs`. The `.describe()` drops in summarization or gets truncated; the field name persists into the JSON the agent reads.
|
|
175
|
+
|
|
176
|
+
**Smell:** `size`, `duration`, `price`, `latency` — bare names that force the agent to guess units or rely on description text. Exempt: `index`, `position`, `totalCount`, `itemCount` (dimensionless).
|
|
177
|
+
|
|
162
178
|
### 3. Report
|
|
163
179
|
|
|
164
180
|
Three sections.
|
package/templates/AGENTS.md
CHANGED
|
@@ -17,7 +17,7 @@ This project was just scaffolded with `bunx @cyanheads/mcp-ts-core init`. The fr
|
|
|
17
17
|
|
|
18
18
|
> **Remove this section** from CLAUDE.md / AGENTS.md after completing these steps. The skills and conventions below remain — this block is one-time onboarding only.
|
|
19
19
|
|
|
20
|
-
1. **Get your bearings.** Take stock of
|
|
20
|
+
1. **Get your bearings.** Take stock of the project tree, the skills in `skills/`, and the tools/MCP servers available. Light tool use is fine for context-building — you're mapping the territory, not committing yet.
|
|
21
21
|
2. **Read the framework docs** — `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` (builders, Context, errors, exports, conventions)
|
|
22
22
|
3. **Run the `setup` skill** — read `skills/setup/SKILL.md` and follow its checklist (project orientation, agent protocol file selection, echo definition cleanup, skill sync)
|
|
23
23
|
4. **Design the server** — read `skills/design-mcp-server/SKILL.md` and work through it with the user to map the domain into tools, resources, and services before scaffolding
|
|
@@ -26,7 +26,7 @@ This project was just scaffolded with `bunx @cyanheads/mcp-ts-core init`. The fr
|
|
|
26
26
|
|
|
27
27
|
## What's Next?
|
|
28
28
|
|
|
29
|
-
When the user asks what
|
|
29
|
+
When the user asks what's next or needs direction, suggest options based on the current project state. Common next steps:
|
|
30
30
|
|
|
31
31
|
1. **Re-run the `setup` skill** — ensures CLAUDE.md, skills, structure, and metadata are populated and up to date with the current codebase
|
|
32
32
|
2. **Run the `design-mcp-server` skill** — if the tool/resource surface hasn't been mapped yet, work through domain design
|
|
@@ -149,7 +149,7 @@ export function getServerConfig() {
|
|
|
149
149
|
}
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
`parseEnvConfig` maps Zod schema paths → env var names so
|
|
152
|
+
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
@@ -174,7 +174,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
174
174
|
|
|
175
175
|
Handlers throw — the framework catches, classifies, and formats.
|
|
176
176
|
|
|
177
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive
|
|
177
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
178
178
|
|
|
179
179
|
```ts
|
|
180
180
|
errors: [
|
|
@@ -189,7 +189,7 @@ async handler(input, ctx) {
|
|
|
189
189
|
}
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
**Declare contracts inline on each tool
|
|
192
|
+
**Declare contracts inline on each tool.** The contract is part of the tool's public surface — one file should give the full picture. Don't extract a shared `errors[]` constant; per-tool repetition is the intended cost of locality.
|
|
193
193
|
|
|
194
194
|
**Fallback (no contract entry fits):** throw via factories or plain `Error`.
|
|
195
195
|
|
|
@@ -249,7 +249,7 @@ src/
|
|
|
249
249
|
|
|
250
250
|
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
251
251
|
|
|
252
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent).
|
|
252
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
253
253
|
|
|
254
254
|
Available skills:
|
|
255
255
|
|
|
@@ -287,7 +287,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
287
287
|
|
|
288
288
|
## Commands
|
|
289
289
|
|
|
290
|
-
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work.
|
|
290
|
+
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. `bun` is slightly faster for script invocation but not required.
|
|
291
291
|
|
|
292
292
|
| Command | Purpose |
|
|
293
293
|
|:--------|:--------|
|
|
@@ -307,13 +307,13 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
307
307
|
|
|
308
308
|
## Changelog
|
|
309
309
|
|
|
310
|
-
Directory-based, grouped by minor series
|
|
310
|
+
Directory-based, grouped by minor series via the `.x` semver-wildcard convention. Source of truth: `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.1.x/0.1.0.md`) — one file per release, shipped in the npm package. At release, author the per-version file with a concrete version and date, then run `npm run changelog:build` to regenerate the rollup. `changelog/template.md` is a **pristine format reference** — never edited or moved; read it for the frontmatter + section layout when scaffolding. `CHANGELOG.md` is a **navigation index** (header + link + summary per version), regenerated by `npm run changelog:build` — devcheck hard-fails on drift; never hand-edit it.
|
|
311
311
|
|
|
312
312
|
Each per-version file opens with YAML frontmatter:
|
|
313
313
|
|
|
314
314
|
```markdown
|
|
315
315
|
---
|
|
316
|
-
summary: "One-line headline, ≤
|
|
316
|
+
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
317
317
|
breaking: false # optional — true flags breaking changes
|
|
318
318
|
security: false # optional — true flags security fixes
|
|
319
319
|
---
|
package/templates/CLAUDE.md
CHANGED
|
@@ -17,7 +17,7 @@ This project was just scaffolded with `bunx @cyanheads/mcp-ts-core init`. The fr
|
|
|
17
17
|
|
|
18
18
|
> **Remove this section** from CLAUDE.md / AGENTS.md after completing these steps. The skills and conventions below remain — this block is one-time onboarding only.
|
|
19
19
|
|
|
20
|
-
1. **Get your bearings.** Take stock of
|
|
20
|
+
1. **Get your bearings.** Take stock of the project tree, the skills in `skills/`, and the tools/MCP servers available. Light tool use is fine for context-building — you're mapping the territory, not committing yet.
|
|
21
21
|
2. **Read the framework docs** — `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` (builders, Context, errors, exports, conventions)
|
|
22
22
|
3. **Run the `setup` skill** — read `skills/setup/SKILL.md` and follow its checklist (project orientation, agent protocol file selection, echo definition cleanup, skill sync)
|
|
23
23
|
4. **Design the server** — read `skills/design-mcp-server/SKILL.md` and work through it with the user to map the domain into tools, resources, and services before scaffolding
|
|
@@ -26,7 +26,7 @@ This project was just scaffolded with `bunx @cyanheads/mcp-ts-core init`. The fr
|
|
|
26
26
|
|
|
27
27
|
## What's Next?
|
|
28
28
|
|
|
29
|
-
When the user asks what
|
|
29
|
+
When the user asks what's next or needs direction, suggest options based on the current project state. Common next steps:
|
|
30
30
|
|
|
31
31
|
1. **Re-run the `setup` skill** — ensures CLAUDE.md, skills, structure, and metadata are populated and up to date with the current codebase
|
|
32
32
|
2. **Run the `design-mcp-server` skill** — if the tool/resource surface hasn't been mapped yet, work through domain design
|
|
@@ -149,7 +149,7 @@ export function getServerConfig() {
|
|
|
149
149
|
}
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
-
`parseEnvConfig` maps Zod schema paths → env var names so
|
|
152
|
+
`parseEnvConfig` maps Zod schema paths → env var names so errors name the variable (`MY_API_KEY`) not the path (`apiKey`). Throws `ConfigurationError`, which the framework prints as a clean startup banner.
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
@@ -174,7 +174,7 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
174
174
|
|
|
175
175
|
Handlers throw — the framework catches, classifies, and formats.
|
|
176
176
|
|
|
177
|
-
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive
|
|
177
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required descriptive metadata for the agent's next move (≥ 5 words, lint-validated); for the wire `data.recovery.hint` (mirrored into `content[]` text), pass explicitly at the throw site when dynamic context matters: `ctx.fail('reason', msg, { recovery: { hint: '...' } })`. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
178
178
|
|
|
179
179
|
```ts
|
|
180
180
|
errors: [
|
|
@@ -189,7 +189,7 @@ async handler(input, ctx) {
|
|
|
189
189
|
}
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
**Declare contracts inline on each tool
|
|
192
|
+
**Declare contracts inline on each tool.** The contract is part of the tool's public surface — one file should give the full picture. Don't extract a shared `errors[]` constant; per-tool repetition is the intended cost of locality.
|
|
193
193
|
|
|
194
194
|
**Fallback (no contract entry fits):** throw via factories or plain `Error`.
|
|
195
195
|
|
|
@@ -249,7 +249,7 @@ src/
|
|
|
249
249
|
|
|
250
250
|
Skills are modular instructions in `skills/` at the project root. Read them directly when a task matches — e.g., `skills/add-tool/SKILL.md` when adding a tool.
|
|
251
251
|
|
|
252
|
-
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent).
|
|
252
|
+
**Agent skill directory:** Copy skills into the directory your agent discovers (Claude Code: `.claude/skills/`, others: equivalent). Skills then load as context without referencing `skills/` paths. After framework updates, run the `maintenance` skill — Phase B re-syncs the agent directory.
|
|
253
253
|
|
|
254
254
|
Available skills:
|
|
255
255
|
|
|
@@ -287,7 +287,7 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
287
287
|
|
|
288
288
|
## Commands
|
|
289
289
|
|
|
290
|
-
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work.
|
|
290
|
+
**Runtime:** Scripts use `tsx` — both `npm run <cmd>` and `bun run <cmd>` work. `bun` is slightly faster for script invocation but not required.
|
|
291
291
|
|
|
292
292
|
| Command | Purpose |
|
|
293
293
|
|:--------|:--------|
|
|
@@ -307,13 +307,13 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
307
307
|
|
|
308
308
|
## Changelog
|
|
309
309
|
|
|
310
|
-
Directory-based, grouped by minor series
|
|
310
|
+
Directory-based, grouped by minor series via the `.x` semver-wildcard convention. Source of truth: `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.1.x/0.1.0.md`) — one file per release, shipped in the npm package. At release, author the per-version file with a concrete version and date, then run `npm run changelog:build` to regenerate the rollup. `changelog/template.md` is a **pristine format reference** — never edited or moved; read it for the frontmatter + section layout when scaffolding. `CHANGELOG.md` is a **navigation index** (header + link + summary per version), regenerated by `npm run changelog:build` — devcheck hard-fails on drift; never hand-edit it.
|
|
311
311
|
|
|
312
312
|
Each per-version file opens with YAML frontmatter:
|
|
313
313
|
|
|
314
314
|
```markdown
|
|
315
315
|
---
|
|
316
|
-
summary: "One-line headline, ≤
|
|
316
|
+
summary: "One-line headline, ≤350 chars" # required — powers the rollup index
|
|
317
317
|
breaking: false # optional — true flags breaking changes
|
|
318
318
|
security: false # optional — true flags security fixes
|
|
319
319
|
---
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
5
|
# with a concrete date.
|
|
6
6
|
|
|
7
|
-
# Required. One-line GitHub Release-style headline.
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
8
|
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
9
|
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
10
|
# inside the value as a key separator and fails GitHub's strict parser.
|
package/templates/src/index.ts
CHANGED
|
@@ -15,4 +15,7 @@ await createApp({
|
|
|
15
15
|
tools: [echoTool, echoAppTool],
|
|
16
16
|
resources: [echoResource, echoAppUiResource],
|
|
17
17
|
prompts: [echoPrompt],
|
|
18
|
+
// instructions: 'Server-level orientation forwarded to the model on every initialize.\n' +
|
|
19
|
+
// '- Use shortcut `X` for the most common case\n' +
|
|
20
|
+
// '- Tools require auth via the `inventory:read` scope',
|
|
18
21
|
});
|