@cyanheads/mcp-ts-core 0.10.2 → 0.10.4

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 (98) hide show
  1. package/AGENTS.md +20 -10
  2. package/CLAUDE.md +20 -10
  3. package/README.md +5 -6
  4. package/changelog/0.10.x/0.10.2.md +4 -4
  5. package/changelog/0.10.x/0.10.3.md +46 -0
  6. package/changelog/0.10.x/0.10.4.md +41 -0
  7. package/dist/core/app.d.ts +36 -0
  8. package/dist/core/app.d.ts.map +1 -1
  9. package/dist/core/app.js +9 -4
  10. package/dist/core/app.js.map +1 -1
  11. package/dist/core/context.d.ts +35 -15
  12. package/dist/core/context.d.ts.map +1 -1
  13. package/dist/core/context.js +0 -1
  14. package/dist/core/context.js.map +1 -1
  15. package/dist/core/index.d.ts +5 -2
  16. package/dist/core/index.d.ts.map +1 -1
  17. package/dist/core/index.js +1 -0
  18. package/dist/core/index.js.map +1 -1
  19. package/dist/core/serverManifest.d.ts +18 -0
  20. package/dist/core/serverManifest.d.ts.map +1 -1
  21. package/dist/core/serverManifest.js +10 -2
  22. package/dist/core/serverManifest.js.map +1 -1
  23. package/dist/mcp-server/notifications.d.ts +4 -4
  24. package/dist/mcp-server/prompts/prompt-registration.d.ts.map +1 -1
  25. package/dist/mcp-server/prompts/prompt-registration.js +1 -0
  26. package/dist/mcp-server/prompts/prompt-registration.js.map +1 -1
  27. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts +6 -0
  28. package/dist/mcp-server/prompts/utils/promptDefinition.d.ts.map +1 -1
  29. package/dist/mcp-server/prompts/utils/promptDefinition.js.map +1 -1
  30. package/dist/mcp-server/resources/resource-registration.d.ts.map +1 -1
  31. package/dist/mcp-server/resources/resource-registration.js +3 -0
  32. package/dist/mcp-server/resources/resource-registration.js.map +1 -1
  33. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts +9 -0
  34. package/dist/mcp-server/resources/utils/resourceDefinition.d.ts.map +1 -1
  35. package/dist/mcp-server/resources/utils/resourceDefinition.js.map +1 -1
  36. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts +13 -2
  37. package/dist/mcp-server/resources/utils/resourceHandlerFactory.d.ts.map +1 -1
  38. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js +23 -12
  39. package/dist/mcp-server/resources/utils/resourceHandlerFactory.js.map +1 -1
  40. package/dist/mcp-server/server.d.ts +20 -4
  41. package/dist/mcp-server/server.d.ts.map +1 -1
  42. package/dist/mcp-server/server.js +7 -4
  43. package/dist/mcp-server/server.js.map +1 -1
  44. package/dist/mcp-server/tools/tool-registration.d.ts.map +1 -1
  45. package/dist/mcp-server/tools/tool-registration.js +2 -0
  46. package/dist/mcp-server/tools/tool-registration.js.map +1 -1
  47. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts +14 -2
  48. package/dist/mcp-server/tools/utils/toolHandlerFactory.d.ts.map +1 -1
  49. package/dist/mcp-server/tools/utils/toolHandlerFactory.js +37 -13
  50. package/dist/mcp-server/tools/utils/toolHandlerFactory.js.map +1 -1
  51. package/dist/services/canvas/core/schemaSniffer.d.ts +6 -4
  52. package/dist/services/canvas/core/schemaSniffer.d.ts.map +1 -1
  53. package/dist/services/canvas/core/schemaSniffer.js +7 -10
  54. package/dist/services/canvas/core/schemaSniffer.js.map +1 -1
  55. package/dist/services/canvas/core/sqlGate.d.ts +15 -0
  56. package/dist/services/canvas/core/sqlGate.d.ts.map +1 -1
  57. package/dist/services/canvas/core/sqlGate.js +40 -0
  58. package/dist/services/canvas/core/sqlGate.js.map +1 -1
  59. package/dist/services/canvas/index.d.ts +1 -1
  60. package/dist/services/canvas/index.d.ts.map +1 -1
  61. package/dist/services/canvas/index.js +1 -1
  62. package/dist/services/canvas/index.js.map +1 -1
  63. package/dist/services/canvas/providers/duckdb/DuckdbProvider.d.ts.map +1 -1
  64. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js +76 -18
  65. package/dist/services/canvas/providers/duckdb/DuckdbProvider.js.map +1 -1
  66. package/dist/services/canvas/types.d.ts +30 -1
  67. package/dist/services/canvas/types.d.ts.map +1 -1
  68. package/dist/testing/index.d.ts +8 -14
  69. package/dist/testing/index.d.ts.map +1 -1
  70. package/dist/testing/index.js +10 -11
  71. package/dist/testing/index.js.map +1 -1
  72. package/package.json +45 -24
  73. package/skills/add-prompt/SKILL.md +33 -2
  74. package/skills/add-resource/SKILL.md +25 -1
  75. package/skills/add-service/SKILL.md +2 -2
  76. package/skills/add-test/SKILL.md +3 -3
  77. package/skills/api-canvas/SKILL.md +12 -6
  78. package/skills/api-config/SKILL.md +12 -3
  79. package/skills/api-context/SKILL.md +17 -31
  80. package/skills/api-testing/SKILL.md +18 -16
  81. package/skills/code-simplifier/SKILL.md +2 -2
  82. package/skills/polish-docs-meta/SKILL.md +1 -1
  83. package/skills/polish-docs-meta/references/agent-protocol.md +1 -1
  84. package/skills/report-issue-framework/SKILL.md +2 -2
  85. package/skills/security-pass/SKILL.md +6 -11
  86. package/templates/AGENTS.md +17 -5
  87. package/templates/CLAUDE.md +17 -5
  88. package/templates/Dockerfile +3 -0
  89. package/templates/package.json +5 -5
  90. package/templates/tests/tools/echo.tool.test.ts +7 -0
  91. package/tsconfig.base.json +0 -1
  92. package/dist/logs/combined.log +0 -4
  93. package/dist/logs/error.log +0 -2
  94. package/dist/logs/interactions.log +0 -0
  95. package/dist/mcp-server/roots/roots-registration.d.ts +0 -22
  96. package/dist/mcp-server/roots/roots-registration.d.ts.map +0 -1
  97. package/dist/mcp-server/roots/roots-registration.js +0 -25
  98. package/dist/mcp-server/roots/roots-registration.js.map +0 -1
@@ -5,16 +5,21 @@
5
5
  * `createInMemoryStorage()` for unit-testing services in isolation.
6
6
  * @module src/testing/index
7
7
  */
8
- import type { CreateMessageResult, ElicitResult, SamplingMessage } from '@modelcontextprotocol/sdk/types.js';
8
+ import type { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
9
9
  import type { z } from 'zod';
10
- import type { AuthContext, Context, ContextLogger, SamplingOpts } from '../core/context.js';
10
+ import type { AuthContext, Context, ContextLogger } from '../core/context.js';
11
11
  import { StorageService } from '../storage/core/StorageService.js';
12
12
  import { type InMemoryProviderOptions } from '../storage/providers/inMemory/inMemoryProvider.js';
13
13
  import type { ErrorContract } from '../types-global/errors.js';
14
14
  export interface MockContextOptions {
15
15
  /** Auth context. */
16
16
  auth?: AuthContext;
17
- /** Mock elicitation handler. */
17
+ /**
18
+ * Mock elicitation handler for form-mode elicitation. When provided, the
19
+ * mock context's `ctx.elicit` is set to this function with a default no-op
20
+ * `.url(...)` stub attached — tests that only exercise form-mode elicitation
21
+ * don't need to supply `.url` explicitly.
22
+ */
18
23
  elicit?: (message: string, schema: z.ZodObject<z.ZodRawShape>) => Promise<ElicitResult>;
19
24
  /**
20
25
  * Error contract to attach a typed `ctx.fail` against. Pass the definition's
@@ -35,8 +40,6 @@ export interface MockContextOptions {
35
40
  progress?: boolean;
36
41
  /** Request ID override. Defaults to 'test-request-id'. */
37
42
  requestId?: string;
38
- /** Mock sampling handler. */
39
- sample?: (messages: SamplingMessage[], opts?: SamplingOpts) => Promise<CreateMessageResult>;
40
43
  /**
41
44
  * HTTP session ID. Defaults to undefined. Set to exercise handlers that
42
45
  * branch on `ctx.sessionId` — mirrors what a stateful HTTP request would
@@ -84,15 +87,6 @@ export declare function createMockLogger(): MockContextLogger;
84
87
  * // With tenant (for tools that use ctx.state)
85
88
  * const ctx = createMockContext({ tenantId: 'test-tenant' });
86
89
  *
87
- * // With sampling capability
88
- * const ctx = createMockContext({
89
- * sample: vi.fn().mockResolvedValue({
90
- * role: 'assistant',
91
- * content: { type: 'text', text: 'Response' },
92
- * model: 'test',
93
- * }),
94
- * });
95
- *
96
90
  * // With task progress
97
91
  * const ctx = createMockContext({ progress: true });
98
92
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,O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;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAgD3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEnE;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,cAAc,CAEvF"}
@@ -140,15 +140,6 @@ function createMockProgress() {
140
140
  * // With tenant (for tools that use ctx.state)
141
141
  * const ctx = createMockContext({ tenantId: 'test-tenant' });
142
142
  *
143
- * // With sampling capability
144
- * const ctx = createMockContext({
145
- * sample: vi.fn().mockResolvedValue({
146
- * role: 'assistant',
147
- * content: { type: 'text', text: 'Response' },
148
- * model: 'test',
149
- * }),
150
- * });
151
- *
152
143
  * // With task progress
153
144
  * const ctx = createMockContext({ progress: true });
154
145
  * ```
@@ -158,6 +149,15 @@ export function createMockContext(options = {}) {
158
149
  const state = createMockState(options.tenantId);
159
150
  const progress = options.progress ? createMockProgress() : undefined;
160
151
  const enrichmentStore = createEnrichmentStore();
152
+ // Wrap the caller's elicit mock into an ElicitFn so that tests calling
153
+ // ctx.elicit.url(...) don't throw TypeError. The default url stub returns a
154
+ // cancelled result and can be overridden by casting the mock to ElicitFn.
155
+ let elicit;
156
+ if (options.elicit) {
157
+ const base = options.elicit;
158
+ base.url = async (_message, _url) => ({ action: 'cancel' });
159
+ elicit = base;
160
+ }
161
161
  const ctx = {
162
162
  requestId: options.requestId ?? 'test-request-id',
163
163
  timestamp: new Date().toISOString(),
@@ -167,8 +167,7 @@ export function createMockContext(options = {}) {
167
167
  tenantId: options.tenantId,
168
168
  sessionId: options.sessionId,
169
169
  auth: options.auth,
170
- elicit: options.elicit,
171
- sample: options.sample,
170
+ elicit,
172
171
  notifyPromptListChanged: options.notifyPromptListChanged,
173
172
  notifyResourceListChanged: options.notifyResourceListChanged,
174
173
  notifyResourceUpdated: options.notifyResourceUpdated,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,OAAO,EACL,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EACL,gBAAgB,GAEjB,MAAM,kDAAkD,CAAC;AAyD1D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,KAAK,GAA0D,EAAE,CAAC;IAExE,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,GAAW,EAAE,IAA8B,EAAE,EAAE;QAC/E,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,OAAO;QACL,KAAK;QACL,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACrB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACnB,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;QACvB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QACzB,KAAK,EAAE,CAAC,GAAW,EAAE,MAAc,EAAE,IAA8B,EAAE,EAAE;YACrE,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,QAAiB;IACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEzC,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5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E,OAAO,CAAC,uBAAuB;QACxD,yBAAyB,EAAE,OAAO,CAAC,yBAAyB;QAC5D,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;QACpD,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;QACpD,QAAQ;QACR,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,MAAM,EAAE,YAAY,CAAC,eAAe,CAAC;QACrC,6EAA6E;QAC7E,6EAA6E;QAC7E,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACxB,CAAC;IAEF,6EAA6E;IAC7E,4EAA4E;IAC5E,oBAAoB,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAE3C,6EAA6E;IAC7E,0EAA0E;IAC1E,+CAA+C;IAC/C,OAAO,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;AAChD,CAAC;AAED,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAiC;IACrE,OAAO,IAAI,cAAc,CAAC,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyanheads/mcp-ts-core",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
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",
@@ -35,75 +35,93 @@
35
35
  "exports": {
36
36
  ".": {
37
37
  "types": "./dist/core/index.d.ts",
38
- "import": "./dist/core/index.js"
38
+ "import": "./dist/core/index.js",
39
+ "default": "./dist/core/index.js"
39
40
  },
40
41
  "./worker": {
41
42
  "types": "./dist/core/worker.d.ts",
42
- "import": "./dist/core/worker.js"
43
+ "import": "./dist/core/worker.js",
44
+ "default": "./dist/core/worker.js"
43
45
  },
44
46
  "./tools": {
45
47
  "types": "./dist/mcp-server/tools/utils/toolDefinition.d.ts",
46
- "import": "./dist/mcp-server/tools/utils/toolDefinition.js"
48
+ "import": "./dist/mcp-server/tools/utils/toolDefinition.js",
49
+ "default": "./dist/mcp-server/tools/utils/toolDefinition.js"
47
50
  },
48
51
  "./resources": {
49
52
  "types": "./dist/mcp-server/resources/utils/resourceDefinition.d.ts",
50
- "import": "./dist/mcp-server/resources/utils/resourceDefinition.js"
53
+ "import": "./dist/mcp-server/resources/utils/resourceDefinition.js",
54
+ "default": "./dist/mcp-server/resources/utils/resourceDefinition.js"
51
55
  },
52
56
  "./prompts": {
53
57
  "types": "./dist/mcp-server/prompts/utils/promptDefinition.d.ts",
54
- "import": "./dist/mcp-server/prompts/utils/promptDefinition.js"
58
+ "import": "./dist/mcp-server/prompts/utils/promptDefinition.js",
59
+ "default": "./dist/mcp-server/prompts/utils/promptDefinition.js"
55
60
  },
56
61
  "./tasks": {
57
62
  "types": "./dist/mcp-server/tasks/utils/taskToolDefinition.d.ts",
58
- "import": "./dist/mcp-server/tasks/utils/taskToolDefinition.js"
63
+ "import": "./dist/mcp-server/tasks/utils/taskToolDefinition.js",
64
+ "default": "./dist/mcp-server/tasks/utils/taskToolDefinition.js"
59
65
  },
60
66
  "./errors": {
61
67
  "types": "./dist/types-global/errors.d.ts",
62
- "import": "./dist/types-global/errors.js"
68
+ "import": "./dist/types-global/errors.js",
69
+ "default": "./dist/types-global/errors.js"
63
70
  },
64
71
  "./config": {
65
72
  "types": "./dist/config/index.d.ts",
66
- "import": "./dist/config/index.js"
73
+ "import": "./dist/config/index.js",
74
+ "default": "./dist/config/index.js"
67
75
  },
68
76
  "./auth": {
69
77
  "types": "./dist/mcp-server/transports/auth/lib/checkScopes.d.ts",
70
- "import": "./dist/mcp-server/transports/auth/lib/checkScopes.js"
78
+ "import": "./dist/mcp-server/transports/auth/lib/checkScopes.js",
79
+ "default": "./dist/mcp-server/transports/auth/lib/checkScopes.js"
71
80
  },
72
81
  "./storage": {
73
82
  "types": "./dist/storage/core/StorageService.d.ts",
74
- "import": "./dist/storage/core/StorageService.js"
83
+ "import": "./dist/storage/core/StorageService.js",
84
+ "default": "./dist/storage/core/StorageService.js"
75
85
  },
76
86
  "./storage/types": {
77
87
  "types": "./dist/storage/core/IStorageProvider.d.ts",
78
- "import": "./dist/storage/core/IStorageProvider.js"
88
+ "import": "./dist/storage/core/IStorageProvider.js",
89
+ "default": "./dist/storage/core/IStorageProvider.js"
79
90
  },
80
91
  "./canvas": {
81
92
  "types": "./dist/services/canvas/index.d.ts",
82
- "import": "./dist/services/canvas/index.js"
93
+ "import": "./dist/services/canvas/index.js",
94
+ "default": "./dist/services/canvas/index.js"
83
95
  },
84
96
  "./mirror": {
85
97
  "types": "./dist/services/mirror/index.d.ts",
86
- "import": "./dist/services/mirror/index.js"
98
+ "import": "./dist/services/mirror/index.js",
99
+ "default": "./dist/services/mirror/index.js"
87
100
  },
88
101
  "./utils": {
89
102
  "types": "./dist/utils/index.d.ts",
90
- "import": "./dist/utils/index.js"
103
+ "import": "./dist/utils/index.js",
104
+ "default": "./dist/utils/index.js"
91
105
  },
92
106
  "./services": {
93
107
  "types": "./dist/services/index.d.ts",
94
- "import": "./dist/services/index.js"
108
+ "import": "./dist/services/index.js",
109
+ "default": "./dist/services/index.js"
95
110
  },
96
111
  "./linter": {
97
112
  "types": "./dist/linter/index.d.ts",
98
- "import": "./dist/linter/index.js"
113
+ "import": "./dist/linter/index.js",
114
+ "default": "./dist/linter/index.js"
99
115
  },
100
116
  "./testing": {
101
117
  "types": "./dist/testing/index.d.ts",
102
- "import": "./dist/testing/index.js"
118
+ "import": "./dist/testing/index.js",
119
+ "default": "./dist/testing/index.js"
103
120
  },
104
121
  "./testing/fuzz": {
105
122
  "types": "./dist/testing/fuzz.d.ts",
106
- "import": "./dist/testing/fuzz.js"
123
+ "import": "./dist/testing/fuzz.js",
124
+ "default": "./dist/testing/fuzz.js"
107
125
  },
108
126
  "./tsconfig.base.json": "./tsconfig.base.json",
109
127
  "./vitest.config": "./vitest.config.base.mjs",
@@ -148,8 +166,10 @@
148
166
  "tree": "bun run scripts/tree.ts",
149
167
  "fetch-spec": "bun run scripts/fetch-openapi-spec.ts",
150
168
  "test": "bunx vitest run",
151
- "test:all": "bun run test && bun run test:worker && bun run test:integration",
169
+ "test:all": "bun run test:coverage && bun run test:node && bun run test:worker && bun run test:integration",
152
170
  "test:integration": "bunx vitest run --config vitest.integration.ts",
171
+ "test:leaks": "bunx vitest run --detect-async-leaks",
172
+ "test:node": "sh -c 'NODE_BIN=$(which -a node | grep -v /bun-node- | head -n 1); \"$NODE_BIN\" ./node_modules/vitest/vitest.mjs run && \"$NODE_BIN\" ./node_modules/vitest/vitest.mjs run --config vitest.integration.ts'",
153
173
  "test:unit": "bunx vitest run --project unit",
154
174
  "test:smoke": "bunx vitest run --project smoke",
155
175
  "test:fuzz": "bunx vitest run --project fuzz",
@@ -193,7 +213,7 @@
193
213
  "@supabase/supabase-js": "^2.108.1",
194
214
  "@types/bun": "^1.3.14",
195
215
  "@types/js-yaml": "^4.0.9",
196
- "@types/node": "^25.9.2",
216
+ "@types/node": "25.9.3",
197
217
  "@types/papaparse": "^5.5.2",
198
218
  "@types/sanitize-html": "^2.16.1",
199
219
  "@types/validator": "^13.15.10",
@@ -207,6 +227,7 @@
207
227
  "depcheck": "^1.4.7",
208
228
  "diff": "^9.0.0",
209
229
  "execa": "^9.6.1",
230
+ "fast-check": "^4.8.0",
210
231
  "fast-xml-parser": "^5.8.0",
211
232
  "ignore": "^7.0.5",
212
233
  "js-yaml": "^4.2.0",
@@ -257,7 +278,7 @@
257
278
  "url": "https://www.buymeacoffee.com/cyanheads"
258
279
  }
259
280
  ],
260
- "packageManager": "bun@1.3.2",
281
+ "packageManager": "bun@1.3.11",
261
282
  "engines": {
262
283
  "bun": ">=1.3.0",
263
284
  "node": ">=24.0.0"
@@ -303,8 +324,8 @@
303
324
  "better-sqlite3": "^12.0.0",
304
325
  "chrono-node": "^2.9.0",
305
326
  "defuddle": "^0.18.1",
306
- "diff": "latest",
307
- "fast-check": "latest",
327
+ "diff": "^9.0.0",
328
+ "fast-check": "^4.0.0",
308
329
  "fast-xml-parser": "^5.8.0",
309
330
  "js-yaml": "^4.1.1",
310
331
  "linkedom": "^0.18.12",
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new MCP prompt template. Use when the user asks to add a prompt, create a reusable message template, or define a prompt for LLM interactions.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.2"
7
+ version: "1.3"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -30,14 +30,18 @@ Prompts are pure message templates — no `Context`, no auth, no side effects. `
30
30
  * @module mcp-server/prompts/definitions/{{PROMPT_NAME}}
31
31
  */
32
32
 
33
- import { prompt, z } from '@cyanheads/mcp-ts-core';
33
+ import { completable, prompt, z } from '@cyanheads/mcp-ts-core';
34
34
 
35
35
  export const {{PROMPT_EXPORT}} = prompt('{{prompt_name}}', {
36
36
  description: '{{PROMPT_DESCRIPTION}}',
37
+ // title is optional — human-readable display name surfaced in prompts/list.
38
+ // title: '{{PROMPT_DISPLAY_TITLE}}',
37
39
  // args is optional — omit entirely for prompts with no parameters.
38
40
  // When present, all fields need .describe(). Only JSON-Schema-serializable types allowed.
41
+ // Wrap any field with completable() to enable argument autocompletion.
39
42
  args: z.object({
40
43
  // All fields need .describe()
44
+ // language: completable(z.string().describe('Language'), async (partial) => matchingLanguages(partial)),
41
45
  }),
42
46
  generate: (args) => [
43
47
  {
@@ -92,13 +96,40 @@ If the repo already uses `src/mcp-server/prompts/definitions/index.ts`, add the
92
96
  export { {{PROMPT_EXPORT}} } from './{{prompt-name}}.prompt.js';
93
97
  ```
94
98
 
99
+ ## Argument autocompletion
100
+
101
+ Wrap any `args` field with `completable()` (re-exported from `@cyanheads/mcp-ts-core`) to enable argument autocompletion. The SDK auto-installs `completion/complete` handling and advertises the `completions` capability when any registered prompt has a completable argument — no other changes are needed.
102
+
103
+ ```typescript
104
+ import { completable, prompt, z } from '@cyanheads/mcp-ts-core';
105
+
106
+ export const codeReview = prompt('code_review', {
107
+ description: 'Review code for issues.',
108
+ title: 'Code Review',
109
+ args: z.object({
110
+ language: completable(
111
+ z.string().describe('Programming language'),
112
+ async (partial) => ['typescript', 'python', 'rust'].filter((l) => l.startsWith(partial)),
113
+ ),
114
+ code: z.string().describe('Code to review'),
115
+ }),
116
+ generate: (args) => [
117
+ { role: 'user', content: { type: 'text', text: `Review this ${args.language} code:\n${args.code}` } },
118
+ ],
119
+ });
120
+ ```
121
+
122
+ `completable()` is transparent to the linter — it does not affect `describe-on-fields` or `schema-serializable` rules. All completable-wrapped fields still require `.describe()` on the underlying schema.
123
+
95
124
  ## Checklist
96
125
 
97
126
  - [ ] File created at `src/mcp-server/prompts/definitions/{{prompt-name}}.prompt.ts`
98
127
  - [ ] Prompt name passed to `prompt()` uses snake_case
99
128
  - [ ] `description` field set (lint warns if absent, but `devcheck` won't hard-fail — verify it's present)
129
+ - [ ] `title` field set if a human-readable display name is needed in `prompts/list`
100
130
  - [ ] All Zod `args` fields have `.describe()` annotations — or `args` omitted entirely for no-parameter prompts
101
131
  - [ ] `args` fields use only JSON-Schema-serializable Zod types (no `z.date()`, `z.transform()`, `z.bigint()`, `z.symbol()`, `z.custom()`, etc.)
132
+ - [ ] If using `completable()`, the underlying schema still has `.describe()` on each wrapped field
102
133
  - [ ] JSDoc `@fileoverview` and `@module` header present
103
134
  - [ ] `generate` function present and returns at least one `{ role, content: { type: 'text', text } }` message
104
135
  - [ ] No side effects — prompts are pure templates
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new MCP resource definition. Use when the user asks to add a resource, expose data via URI, or create a readable endpoint.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.3"
7
+ version: "1.4"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -141,6 +141,29 @@ export const articleResource = resource('article://{pmid}', {
141
141
 
142
142
  Without `errors[]`, the handler receives plain `Context` (no `fail` method) and throws via error factories (`notFound`, `serviceUnavailable`, …) directly. The contract is opt-in. See `skills/api-errors/SKILL.md` for the full pattern, baseline codes, and conformance rules.
143
143
 
144
+ ### URI template variable completion
145
+
146
+ Add a `complete` map to enable autocompletion for URI template variables. The SDK auto-installs `completion/complete` handling and advertises the `completions` capability when a registered resource template has completion callbacks — no other changes needed.
147
+
148
+ ```typescript
149
+ import { resource, z } from '@cyanheads/mcp-ts-core';
150
+
151
+ const ITEM_IDS = ['item-001', 'item-002', 'item-abc'];
152
+
153
+ export const itemResource = resource('items://{itemId}', {
154
+ description: 'Retrieve an item by ID.',
155
+ params: z.object({ itemId: z.string().describe('Item identifier') }),
156
+ handler: (params) => ({ id: params.itemId }),
157
+ list: () => ({ resources: ITEM_IDS.map((id) => ({ uri: `items://${id}`, name: id })) }),
158
+ // Per-variable completion callbacks — keys must match URI template variable names.
159
+ complete: {
160
+ itemId: async (partial) => ITEM_IDS.filter((id) => id.startsWith(partial)),
161
+ },
162
+ });
163
+ ```
164
+
165
+ Only applies to templated resources (URI templates with `{variable}` syntax). Static URIs don't support completion.
166
+
144
167
  ### Other `resource()` options
145
168
 
146
169
  Beyond `description`, `params`, `handler`, and `list`, the builder also supports:
@@ -153,6 +176,7 @@ Beyond `description`, `params`, `handler`, and `list`, the builder also supports
153
176
  | `annotations` | Resource annotations (e.g., `audience`, `priority`) — see `ResourceAnnotations`. |
154
177
  | `title` | Human-readable display title (defaults to `name`). |
155
178
  | `examples` | Array of `{ name, uri }` example entries surfaced in `resources/list` for discoverability. |
179
+ | `complete` | Per-variable completion callbacks for URI template variables. Keys match template variable names. Enables `completion/complete` and the `completions` capability. |
156
180
 
157
181
  ## Checklist
158
182
 
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a new service integration. Use when the user asks to add a service, integrate an external API, or create a reusable domain module with its own initialization and state.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.7"
7
+ version: "1.8"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -13,7 +13,7 @@ metadata:
13
13
 
14
14
  Services use the init/accessor pattern: initialized once in `createApp`'s `setup()` callback, then accessed at request time via a lazy getter. Each service lives in `src/services/[domain]/` with an init function and accessor.
15
15
 
16
- Service methods receive `Context` for correlated logging (`ctx.log`) and tenant-scoped storage (`ctx.state`). Convention: `ctx.elicit` and `ctx.sample` should only be called from tool handlers, not from services.
16
+ Service methods receive `Context` for correlated logging (`ctx.log`) and tenant-scoped storage (`ctx.state`). Convention: `ctx.elicit` should only be called from tool handlers, not from services.
17
17
 
18
18
  For the full service pattern, `CoreServices`, and `Context` interface, read the framework's `CLAUDE.md`/`AGENTS.md` (loaded at session start).
19
19
 
@@ -4,7 +4,7 @@ description: >
4
4
  Scaffold a test file for an existing tool, resource, or service. Use when the user asks to add tests, improve coverage, or when a definition exists without a matching test file.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.3"
7
+ version: "1.4"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -36,7 +36,7 @@ Read the handler and identify:
36
36
  | **Input variations** | Optional fields omitted, defaults applied, boundary values |
37
37
  | **Error paths** | Invalid state, missing resources, service failures → correct error thrown |
38
38
  | **`ctx.state` usage** | Use `createMockContext({ tenantId: 'test' })` to enable storage |
39
- | **`ctx.elicit` / `ctx.sample`** | Mock with `vi.fn()`, also test the absent case (undefined) |
39
+ | **`ctx.elicit`** | Mock with `vi.fn()`, also test the absent case (undefined) |
40
40
  | **`ctx.progress`** | Use `createMockContext({ progress: true })` for task tools |
41
41
  | **`ctx.fail` (typed contract)** | Definitions with `errors[]` need `fail` attached to the mock ctx — `createMockContext({ errors: myTool.errors })` does it for you. Assert on `data.reason` (stable per-contract entry), not just `code`. |
42
42
  | **`format` function** | Test separately if defined — it's pure, no ctx needed. Verify it renders the IDs and fields the model needs, not just a count or title. For projection-style tools, test non-default field selections. |
@@ -286,7 +286,7 @@ When scaffolding tests for an existing handler, use the Zod schemas to generate
286
286
  - [ ] Happy path tested with valid input → expected output
287
287
  - [ ] Error paths tested (at least one `.rejects.toThrow()`)
288
288
  - [ ] `format` function tested if defined
289
- - [ ] `createMockContext` options match handler's ctx usage (`tenantId`, `progress`, `elicit`, `sample`)
289
+ - [ ] `createMockContext` options match handler's ctx usage (`tenantId`, `progress`, `elicit`)
290
290
  - [ ] Service re-initialized in `beforeEach` if handler depends on a service singleton
291
291
  - [ ] If handler has optional fields: tested with empty-string inner values (form-client simulation)
292
292
  - [ ] If wrapping external API: sparse-payload case tested — fixture omits at least one optional upstream field; output still validates and `format()` renders uncertainty honestly instead of inventing values
@@ -4,7 +4,7 @@ description: >
4
4
  DataCanvas primitive reference — a Tier 3 SQL/analytical workspace for tabular MCP servers, backed by DuckDB. Use when registering tables from upstream APIs, running ad-hoc SQL across them, and exporting results. Covers the acquire → register → query → export flow, per-table TTL, the token-sharing pattern for multi-agent collaboration, env config, and Cloudflare Workers fail-closed behavior.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.5"
7
+ version: "1.6"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -135,7 +135,7 @@ await instance.registerTable('big_dataset', asyncRows, {
135
135
  await instance.registerTable('recent_fetch', rows, { ttlMs: 30 * 60 * 1000 });
136
136
  ```
137
137
 
138
- **Schema inference** when `schema` is omitted: sniffer materializes the first 100 rows, unions JS-side types per column, and maps to DuckDB types. Fall-backs to `VARCHAR` for ambiguous unions (string mixed with numerics). Numeric widening: `INTEGER + DOUBLE → DOUBLE`, `INTEGER + BIGINT → BIGINT`. Column ordering follows first-appearance.
138
+ **Schema inference** when `schema` is omitted: sniffer materializes the first 100 rows, unions JS-side types per column, and maps to DuckDB types. All inferred columns are **always nullable** — a sample can prove a column is nullable, but can never prove NOT NULL (a null may appear past the sniff window). Pass an explicit `schema` when `NOT NULL` enforcement is required. Fall-backs to `VARCHAR` for ambiguous unions (string mixed with numerics). Numeric widening: `INTEGER + DOUBLE → DOUBLE`, `INTEGER + BIGINT → BIGINT`. Column ordering follows first-appearance.
139
139
 
140
140
  **Per-table TTL (`ttlMs`)** — optional sliding TTL for this table specifically. When set:
141
141
  - The sweep loop drops the table (and clears its bookkeeping) when its window expires.
@@ -146,7 +146,9 @@ await instance.registerTable('recent_fetch', rows, { ttlMs: 30 * 60 * 1000 });
146
146
 
147
147
  ### `instance.query(sql, options?)`
148
148
 
149
- Run SQL across registered tables. Returns at most `rowLimit` rows (default 10 000). For full result sets, pass `registerAs` — the result is materialized as a new canvas table; the response carries a `preview` slice plus the table reference.
149
+ Run SQL across registered tables. Returns at most `rowLimit` rows (default 10 000). When the result exceeds `rowLimit`, the response carries `truncated: true` and `rowCount` reflects the number of materialized rows (not the full result set). For full result sets and exact counts, pass `registerAs` — the result is materialized as a new canvas table; the response carries a `preview` slice and the exact `rowCount`.
150
+
151
+ Querying a table that does not exist throws `NotFound` (`data.reason: 'missing_table'`) with a recovery hint to re-stage the table or call `describe()`. This happens when a table has expired (per-table TTL), been dropped, or the name is mistyped. The error is `NotFound`, not `ValidationError` — agents should re-stage, not fix the SQL shape.
150
152
 
151
153
  ```ts
152
154
  const result = await instance.query(`
@@ -172,7 +174,9 @@ const chained = await instance.query(
172
174
 
173
175
  `ttlMs` on `query({ registerAs })` assigns a per-table TTL to the materialized table — the same sliding semantics as `registerTable({ ttlMs })`. The SQL text is also scanned for referenced table names; any tracked per-table TTL entry found is slid on each `query()` call.
174
176
 
175
- **Read-only enforcement** (four layers):
177
+ `denySystemCatalogs?: boolean` (default `false`) — when `true`, the gate rejects any reference to system catalog namespaces (`information_schema`, `pg_catalog`, `sqlite_master`, `duckdb_<name>()` calls) at the text-scan layer before the query executes. Use on shared canvases where handle possession is the access boundary — catalog namespaces let callers enumerate every staged handle. Rejection throws `ValidationError` with `data.reason: 'system_catalog_access'`. Canvas-token servers that explicitly expose `describe()` to agents do not need this; only servers that intentionally hide the full catalog should opt in.
178
+
179
+ **Read-only enforcement** (four layers + optional catalog layer):
176
180
  1. Text-level deny-list — pre-parse scan for file/HTTP-reading table functions (`read_csv*`, `read_json*`, `read_parquet*`, `read_text`, `read_blob`, `glob`, `iceberg_scan`, `delta_scan`, `postgres_scan`, `mysql_scan`, `sqlite_scan`, plus pre-staged spatial ones).
177
181
  2. Statement count (must be 1) via `extractStatements`.
178
182
  3. Statement type (must be `SELECT`) via `prepared.statementType`.
@@ -182,7 +186,7 @@ Any layer's rejection throws `ValidationError` with a structured `data.reason`.
182
186
 
183
187
  ### `instance.registerView(name, selectSql, options?)`
184
188
 
185
- Register a SQL view on the canvas. The `SELECT` runs through the same four-layer gate `query()` enforces, so a malicious definition fails at registration time, not later when the view is referenced.
189
+ Register a SQL view on the canvas. The `SELECT` runs through the same gate `query()` enforces (four layers), so a malicious definition fails at registration time, not later when the view is referenced. Pass `{ denySystemCatalogs: true }` to also block catalog namespace references in the view definition — same semantics as the `query()` flag.
186
190
 
187
191
  ```ts
188
192
  await instance.registerView(
@@ -224,7 +228,7 @@ await instance.export('g_with_obs', { format: 'csv', stream: writableStream });
224
228
 
225
229
  ```ts
226
230
  const tables = await instance.describe();
227
- // [{ name: 'germplasm', kind: 'table', rowCount: 200, columns: [...] }, ...]
231
+ // [{ name: 'germplasm', kind: 'table', rowCount: 200, approxSizeBytes: 8192, columns: [...] }, ...]
228
232
 
229
233
  // Filter by kind ('table' | 'view').
230
234
  const onlyViews = await instance.describe({ kind: 'view' });
@@ -235,6 +239,8 @@ await instance.clear(); // returns count dropped (drops views b
235
239
 
236
240
  `TableInfo.kind` discriminates `'table'` vs `'view'`. For views, `rowCount` is materialized at describe time via `COUNT(*)` — not free; treat as an approximation if the view is expensive.
237
241
 
242
+ `TableInfo.approxSizeBytes` is set for base tables (DuckDB's `estimated_size` from `duckdb_tables()`). It is `undefined` for views — views have no entry in `duckdb_tables()`. Use it to decide what to drop when a canvas approaches its memory limit.
243
+
238
244
  ### Cancellation
239
245
 
240
246
  `registerTable`, `query`, and `export` accept `options.signal: AbortSignal`. The provider opens a fresh DuckDB connection per query/export so `connection.interrupt()` cancels exactly the in-flight work without disturbing other ops on the same canvas.
@@ -4,7 +4,7 @@ description: >
4
4
  Reference for core and server configuration in `@cyanheads/mcp-ts-core`. Covers env var tables with defaults, priority order, server-specific Zod schema pattern, and Workers lazy-parsing requirement.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.6"
7
+ version: "1.7"
8
8
  audience: external
9
9
  type: reference
10
10
  ---
@@ -23,7 +23,7 @@ Managed by `@cyanheads/mcp-ts-core`. Validated via Zod from environment variable
23
23
 
24
24
  **Priority (highest to lowest):**
25
25
 
26
- 1. `name`/`version` overrides passed to `createApp()` or `createWorkerHandler()`
26
+ 1. `name`/`version`/`title`/`websiteUrl`/`description`/`icons` options passed to `createApp()` or `createWorkerHandler()`
27
27
  2. Environment variables
28
28
  3. `package.json` fields
29
29
 
@@ -35,9 +35,18 @@ Managed by `@cyanheads/mcp-ts-core`. Validated via Zod from environment variable
35
35
  |:--------|:-----------------|:--------|:------|
36
36
  | `MCP_SERVER_NAME` | `mcpServerName` | `package.json` `name` | Overrides package name |
37
37
  | `MCP_SERVER_VERSION` | `mcpServerVersion` | `package.json` `version` | Overrides package version |
38
- | `MCP_SERVER_DESCRIPTION` | `mcpServerDescription` | `package.json` `description` | Optional |
38
+ | `MCP_SERVER_DESCRIPTION` | `mcpServerDescription` | `package.json` `description` | Optional; `createApp({ description })` wins when set |
39
39
  | `PACKAGE_NAME` | `pkg.name` | `package.json` `name` | Rarely needed |
40
40
  | `PACKAGE_VERSION` | `pkg.version` | `package.json` `version` | Rarely needed |
41
+
42
+ **SDK identity fields** (API-only, no env var equivalent — passed to `createApp()` / `createWorkerHandler()`, forwarded to `initialize` and `/.well-known/mcp.json`):
43
+
44
+ | Option | Type | Notes |
45
+ |:-------|:-----|:------|
46
+ | `title` | `string?` | Human-readable display name shown in client listings |
47
+ | `websiteUrl` | `string?` | Canonical homepage / repository URL |
48
+ | `description` | `string?` | One-line description; wins over `MCP_SERVER_DESCRIPTION` when set |
49
+ | `icons` | `Implementation['icons']?` | Array of icon objects: `{ src, mimeType?, sizes?: string[], theme?: 'light'\|'dark' }` |
41
50
  | `NODE_ENV` | `environment` | `development` | Aliases: `dev`→`development`, `prod`→`production`, `test`→`testing` |
42
51
  | `MCP_LOG_LEVEL` | `logLevel` | `debug` | Aliases: `warn`→`warning`, `err`→`error`, `fatal`/`silent`→`emerg`, `trace`→`debug`, `information`→`info` |
43
52
  | `LOGS_DIR` | `logsPath` | `<project-root>/logs` | Node.js only; absolute or relative to project root |