@cyanheads/mcp-ts-core 0.11.0 → 0.11.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EACL,gBAAgB,GAEjB,MAAM,kDAAkD,CAAC;AA4D1D;;;;;;;;;;;;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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,cAAc,CAAC,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Vitest fixture-based test helpers for MCP handler testing.
3
- * Exports `mcpTest` — a `test.extend`-based Vitest test with per-test `ctx`
4
- * and `storage` fixtures — so every test gets fresh, isolated instances.
3
+ * Exports `mcpTest` — a `test.extend`-based Vitest test with per-test `ctx`,
4
+ * `session`, `fetchMock`, and `storage` fixtures — plus `toolContractSuite`.
5
5
  *
6
6
  * Import from `@cyanheads/mcp-ts-core/testing/vitest`. Vitest is required as
7
7
  * a peer dependency when using this subpath.
@@ -23,28 +23,36 @@
23
23
  *
24
24
  * @module src/testing/vitest
25
25
  */
26
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
27
+ import type { z } from 'zod';
26
28
  import type { Context } from '../core/context.js';
29
+ import type { AnyToolDefinition } from '../mcp-server/tools/utils/toolDefinition.js';
27
30
  import type { StorageService } from '../storage/core/StorageService.js';
28
- import type { MockContextOptions } from './index.js';
29
- import { createInMemoryStorage, createMockContext } from './index.js';
31
+ import type { FetchMockHarness, MockContextOptions, MockSession } from './index.js';
32
+ import { createFetchMock, createInMemoryStorage, createMockContext, createMockSession, runToolContract } from './index.js';
30
33
  /**
31
34
  * Fixture shape provided to each `mcpTest` test body.
32
35
  *
33
36
  * - `ctx` — a fresh `Context` from `createMockContext()` for each test
37
+ * - `session` — a fresh session-bound context from `createMockSession()`
38
+ * - `fetchMock` — a strict global fetch fake restored after each requesting test
34
39
  * - `storage` — a fresh `StorageService` backed by `InMemoryProvider` for each test
35
40
  */
36
41
  export interface McpTestFixtures {
37
42
  /** Fresh mock context per test. Cast `ctx.log` to `MockContextLogger` to inspect log calls. */
38
43
  ctx: Context;
44
+ /** Strict fetch fake installed only for tests that request this fixture. */
45
+ fetchMock: FetchMockHarness;
46
+ /** Fresh HTTP-session-bound context per test. */
47
+ session: MockSession;
39
48
  /** Fresh in-memory `StorageService` per test, for services that accept a `StorageService` dep. */
40
49
  storage: StorageService;
41
50
  }
42
51
  /**
43
- * Vitest extended test with `ctx` and `storage` fixtures.
52
+ * Vitest extended test with handler, HTTP, session, and storage fixtures.
44
53
  *
45
- * Each test receives a fresh `createMockContext()` and `createInMemoryStorage()`,
46
- * ensuring log captures, enrichment stores, and in-memory state never bleed
47
- * between tests.
54
+ * Each fixture is created per test, ensuring log captures, enrichment stores,
55
+ * upstream routes, session identity, and in-memory state never bleed between tests.
48
56
  *
49
57
  * Override fixtures using the **function form** to preserve per-test freshness:
50
58
  * ```ts
@@ -65,12 +73,69 @@ export interface McpTestFixtures {
65
73
  */
66
74
  export declare const mcpTest: import("vitest").TestAPI<{
67
75
  ctx: Context;
76
+ fetchMock: FetchMockHarness;
77
+ session: MockSession;
68
78
  storage: StorageService;
69
79
  }>;
70
- export type { MockContextOptions };
80
+ /** One schema-valid success case for {@link toolContractSuite}. */
81
+ export interface ToolContractSuccessCase<TDefinition extends AnyToolDefinition> {
82
+ /** Optional behavior-specific assertions after contract checks pass. */
83
+ assert?: (result: CallToolResult) => Promise<void> | void;
84
+ /** Per-case context overrides. */
85
+ context?: MockContextOptions;
86
+ /** Schema-valid tool input. */
87
+ input: z.input<TDefinition['input']>;
88
+ /** Test name. */
89
+ name: string;
90
+ }
91
+ /** One expected failure case for {@link toolContractSuite}. */
92
+ export interface ToolContractErrorCase<TDefinition extends AnyToolDefinition> {
93
+ /** Expected JSON-RPC error code. */
94
+ code: number;
95
+ /** Per-case context overrides. */
96
+ context?: MockContextOptions;
97
+ /** Schema-valid input that makes the handler fail. */
98
+ input: z.input<TDefinition['input']>;
99
+ /** Test name. */
100
+ name: string;
101
+ /** Optional expected `structuredContent.error.data.reason`. */
102
+ reason?: string;
103
+ }
104
+ /** Cases and shared context for {@link toolContractSuite}. */
105
+ export interface ToolContractSuiteOptions<TDefinition extends AnyToolDefinition> {
106
+ /** Context defaults merged into every case. */
107
+ context?: MockContextOptions;
108
+ /** Expected handler failures and their public error envelopes. */
109
+ errors?: readonly ToolContractErrorCase<TDefinition>[];
110
+ /** Schema-valid successful invocations. At least one is recommended. */
111
+ success: readonly ToolContractSuccessCase<TDefinition>[];
112
+ }
113
+ /**
114
+ * Registers a reusable Vitest conformance suite for a tool definition.
115
+ *
116
+ * Successful cases must survive input parsing, handler invocation, output
117
+ * parsing, and content formatting. Error cases must return the framework's
118
+ * dual-surface error envelope (`content[]` plus `structuredContent.error`) with
119
+ * the expected code and optional contract reason.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * toolContractSuite(searchTool, {
124
+ * success: [{ name: 'returns matches', input: { query: 'mcp' } }],
125
+ * errors: [{
126
+ * name: 'reports an empty query',
127
+ * input: { query: '' },
128
+ * code: JsonRpcErrorCode.InvalidParams,
129
+ * reason: 'empty_query',
130
+ * }],
131
+ * });
132
+ * ```
133
+ */
134
+ export declare function toolContractSuite<TDefinition extends AnyToolDefinition>(definition: TDefinition, options: ToolContractSuiteOptions<TDefinition>): void;
135
+ export type { FetchMockHarness, MockContextOptions, MockSession };
71
136
  /**
72
- * Re-exported so consumers can import `createMockContext` alongside `mcpTest`
73
- * from a single subpath when writing fixture overrides.
137
+ * Re-exported so consumers can import fixture-building helpers alongside
138
+ * `mcpTest` from one subpath when writing overrides.
74
139
  */
75
- export { createInMemoryStorage, createMockContext };
140
+ export { createFetchMock, createInMemoryStorage, createMockContext, createMockSession, runToolContract, };
76
141
  //# sourceMappingURL=vitest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../src/testing/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAA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CA2CN;AAMD,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC;AAClE;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @fileoverview Vitest fixture-based test helpers for MCP handler testing.
3
- * Exports `mcpTest` — a `test.extend`-based Vitest test with per-test `ctx`
4
- * and `storage` fixtures — so every test gets fresh, isolated instances.
3
+ * Exports `mcpTest` — a `test.extend`-based Vitest test with per-test `ctx`,
4
+ * `session`, `fetchMock`, and `storage` fixtures — plus `toolContractSuite`.
5
5
  *
6
6
  * Import from `@cyanheads/mcp-ts-core/testing/vitest`. Vitest is required as
7
7
  * a peer dependency when using this subpath.
@@ -23,17 +23,16 @@
23
23
  *
24
24
  * @module src/testing/vitest
25
25
  */
26
- import { test } from 'vitest';
27
- import { createInMemoryStorage, createMockContext } from './index.js';
26
+ import { describe, expect, test } from 'vitest';
27
+ import { createFetchMock, createInMemoryStorage, createMockContext, createMockSession, runToolContract, } from './index.js';
28
28
  // ---------------------------------------------------------------------------
29
29
  // Extended test
30
30
  // ---------------------------------------------------------------------------
31
31
  /**
32
- * Vitest extended test with `ctx` and `storage` fixtures.
32
+ * Vitest extended test with handler, HTTP, session, and storage fixtures.
33
33
  *
34
- * Each test receives a fresh `createMockContext()` and `createInMemoryStorage()`,
35
- * ensuring log captures, enrichment stores, and in-memory state never bleed
36
- * between tests.
34
+ * Each fixture is created per test, ensuring log captures, enrichment stores,
35
+ * upstream routes, session identity, and in-memory state never bleed between tests.
37
36
  *
38
37
  * Override fixtures using the **function form** to preserve per-test freshness:
39
38
  * ```ts
@@ -58,13 +57,91 @@ export const mcpTest = test.extend({
58
57
  await use(createMockContext());
59
58
  },
60
59
  // biome-ignore lint/correctness/noEmptyPattern: vitest's fixture API requires a destructuring pattern as the first parameter
60
+ fetchMock: async ({}, use) => {
61
+ const harness = createFetchMock();
62
+ harness.install();
63
+ try {
64
+ await use(harness);
65
+ }
66
+ finally {
67
+ harness.restore();
68
+ }
69
+ },
70
+ // biome-ignore lint/correctness/noEmptyPattern: vitest's fixture API requires a destructuring pattern as the first parameter
71
+ session: async ({}, use) => {
72
+ await use(createMockSession());
73
+ },
74
+ // biome-ignore lint/correctness/noEmptyPattern: vitest's fixture API requires a destructuring pattern as the first parameter
61
75
  storage: async ({}, use) => {
62
76
  await use(createInMemoryStorage());
63
77
  },
64
78
  });
79
+ function mergeContextOptions(shared, specific) {
80
+ if (!shared && !specific)
81
+ return;
82
+ return { ...shared, ...specific };
83
+ }
84
+ /**
85
+ * Registers a reusable Vitest conformance suite for a tool definition.
86
+ *
87
+ * Successful cases must survive input parsing, handler invocation, output
88
+ * parsing, and content formatting. Error cases must return the framework's
89
+ * dual-surface error envelope (`content[]` plus `structuredContent.error`) with
90
+ * the expected code and optional contract reason.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * toolContractSuite(searchTool, {
95
+ * success: [{ name: 'returns matches', input: { query: 'mcp' } }],
96
+ * errors: [{
97
+ * name: 'reports an empty query',
98
+ * input: { query: '' },
99
+ * code: JsonRpcErrorCode.InvalidParams,
100
+ * reason: 'empty_query',
101
+ * }],
102
+ * });
103
+ * ```
104
+ */
105
+ export function toolContractSuite(definition, options) {
106
+ describe(`${definition.name} tool contract`, () => {
107
+ for (const successCase of options.success) {
108
+ test(successCase.name, async () => {
109
+ const context = mergeContextOptions(options.context, successCase.context);
110
+ const result = await runToolContract(definition, successCase.input, {
111
+ ...(context && { context }),
112
+ });
113
+ expect(result.isError).not.toBe(true);
114
+ expect(result.structuredContent).toEqual(expect.schemaMatching(definition.output));
115
+ expect(result.content).toEqual(expect.arrayContaining([expect.objectContaining({})]));
116
+ await successCase.assert?.(result);
117
+ });
118
+ }
119
+ for (const errorCase of options.errors ?? []) {
120
+ test(errorCase.name, async () => {
121
+ const context = mergeContextOptions(options.context, errorCase.context);
122
+ const result = await runToolContract(definition, errorCase.input, {
123
+ ...(context && { context }),
124
+ });
125
+ const error = result.structuredContent.error;
126
+ expect(result.isError).toBe(true);
127
+ expect(result.content?.[0]).toMatchObject({
128
+ type: 'text',
129
+ text: expect.stringMatching(/^Error:/),
130
+ });
131
+ expect(error).toMatchObject({
132
+ code: errorCase.code,
133
+ message: expect.any(String),
134
+ });
135
+ if (errorCase.reason !== undefined) {
136
+ expect(error?.data?.reason).toBe(errorCase.reason);
137
+ }
138
+ });
139
+ }
140
+ });
141
+ }
65
142
  /**
66
- * Re-exported so consumers can import `createMockContext` alongside `mcpTest`
67
- * from a single subpath when writing fixture overrides.
143
+ * Re-exported so consumers can import fixture-building helpers alongside
144
+ * `mcpTest` from one subpath when writing overrides.
68
145
  */
69
- export { createInMemoryStorage, createMockContext };
146
+ export { createFetchMock, createInMemoryStorage, createMockContext, createMockSession, runToolContract, };
70
147
  //# sourceMappingURL=vitest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vitest.js","sourceRoot":"","sources":["../../src/testing/vitest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAmBtE,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAkB;IAClD,6HAA6H;IAC7H,GAAG,EAAE,KAAK,EAAE,EAAU,EAAE,GAAsC,EAAE,EAAE;QAChE,MAAM,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,6HAA6H;IAC7H,OAAO,EAAE,KAAK,EAAE,EAAU,EAAE,GAA6C,EAAE,EAAE;QAC3E,MAAM,GAAG,CAAC,qBAAqB,EAAE,CAA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  {
2
2
  "name": "@cyanheads/mcp-ts-core",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "mcpName": "io.github.cyanheads/mcp-ts-core",
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.",
5
+ "description": "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.",
6
6
  "files": [
7
7
  "changelog/",
8
8
  "dist/",
@@ -193,33 +193,33 @@
193
193
  "publish-mcp": "mcp-publisher login github -token \"$(security find-generic-password -a \"$USER\" -s mcp-publisher-github-pat -w)\" && mcp-publisher publish"
194
194
  },
195
195
  "devDependencies": {
196
- "@biomejs/biome": "2.5.5",
197
- "@cloudflare/vitest-pool-workers": "^0.18.6",
198
- "@cloudflare/workers-types": "5.20260706.1",
199
- "@duckdb/node-api": "^1.5.5-r.1",
196
+ "@biomejs/biome": "2.5.6",
197
+ "@cloudflare/vitest-pool-workers": "^0.19.1",
198
+ "@cloudflare/workers-types": "5.20260730.1",
199
+ "@duckdb/node-api": "^1.5.5-r.2",
200
200
  "@hono/otel": "^1.1.2",
201
201
  "@opentelemetry/exporter-metrics-otlp-http": "^0.221.0",
202
202
  "@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
203
203
  "@opentelemetry/instrumentation-http": "^0.221.0",
204
- "@opentelemetry/instrumentation-pino": "^0.66.0",
204
+ "@opentelemetry/instrumentation-pino": "^0.67.0",
205
205
  "@opentelemetry/resources": "^2.10.0",
206
206
  "@opentelemetry/sdk-metrics": "^2.10.0",
207
207
  "@opentelemetry/sdk-node": "^0.221.0",
208
208
  "@opentelemetry/sdk-trace-node": "^2.10.0",
209
209
  "@opentelemetry/semantic-conventions": "^1.43.0",
210
210
  "@socketsecurity/bun-security-scanner": "^1.1.2",
211
- "@supabase/supabase-js": "^2.110.8",
211
+ "@supabase/supabase-js": "^2.111.0",
212
212
  "@types/bun": "^1.3.14",
213
- "@types/node": "26.1.1",
213
+ "@types/node": "26.1.2",
214
214
  "@types/papaparse": "^5.5.2",
215
215
  "@types/sanitize-html": "^2.16.1",
216
216
  "@types/validator": "^13.15.10",
217
217
  "@vitest/coverage-istanbul": "4.1.10",
218
218
  "@vitest/ui": "4.1.10",
219
- "better-sqlite3": "^13.0.1",
219
+ "better-sqlite3": "^13.0.2",
220
220
  "bun-types": "^1.3.14",
221
221
  "chrono-node": "^2.10.1",
222
- "clipboardy": "^5.3.1",
222
+ "clipboardy": "^5.3.2",
223
223
  "defuddle": "^0.19.2",
224
224
  "depcheck": "^1.4.7",
225
225
  "diff": "^9.0.0",
@@ -227,10 +227,10 @@
227
227
  "fast-check": "^4.9.0",
228
228
  "fast-xml-parser": "^5.10.1",
229
229
  "ignore": "^7.0.6",
230
- "js-yaml": "^5.2.1",
230
+ "js-yaml": "^5.2.2",
231
231
  "linkedom": "^0.18.13",
232
232
  "node-cron": "^4.6.0",
233
- "openai": "^6.48.0",
233
+ "openai": "^6.49.0",
234
234
  "papaparse": "^5.5.4",
235
235
  "partial-json": "^0.1.7",
236
236
  "pdf-lib": "^1.17.1",
@@ -241,9 +241,9 @@
241
241
  "typedoc": "^0.28.20",
242
242
  "typescript": "^7.0.2",
243
243
  "typescript-v6": "npm:typescript@^6.0.3",
244
- "unpdf": "^1.6.2",
244
+ "unpdf": "^1.8.0",
245
245
  "validator": "^13.15.35",
246
- "vite": "8.1.5",
246
+ "vite": "8.2.0",
247
247
  "vitest": "^4.1.10"
248
248
  },
249
249
  "keywords": [
@@ -297,13 +297,13 @@
297
297
  },
298
298
  "dependencies": {
299
299
  "@hono/mcp": "^0.3.1",
300
- "@hono/node-server": "^2.0.11",
301
- "@modelcontextprotocol/ext-apps": "^1.7.4",
302
- "@modelcontextprotocol/sdk": "^1.29.0",
300
+ "@hono/node-server": "^2.0.12",
301
+ "@modelcontextprotocol/ext-apps": "^1.7.5",
302
+ "@modelcontextprotocol/sdk": "^1.30.0",
303
303
  "@opentelemetry/api": "^1.9.1",
304
304
  "dotenv": "^17.4.2",
305
- "hono": "^4.12.31",
306
- "jose": "^6.2.4",
305
+ "hono": "^4.12.32",
306
+ "jose": "^6.2.5",
307
307
  "pino": "^10.3.1",
308
308
  "zod": "^4.4.3"
309
309
  },
@@ -429,7 +429,7 @@
429
429
  }
430
430
  },
431
431
  "overrides": {
432
- "brace-expansion": "^2.1.2",
432
+ "brace-expansion": "^2.1.3",
433
433
  "postcss": "^8.5.22",
434
434
  "protobufjs": "^7.6.5",
435
435
  "sharp": "^0.35.3",
@@ -4,7 +4,7 @@ description: >
4
4
  Testing patterns for MCP tool/resource handlers using `createMockContext` and Vitest. Covers mock context options, handler testing, McpError assertions, format testing, Vitest config setup, and test isolation conventions.
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
  ---
@@ -13,7 +13,7 @@ metadata:
13
13
 
14
14
  Tests target handler behavior directly — call `handler(input, ctx)`, assert on the return value or thrown error. The framework's handler factory (try/catch, formatting, telemetry) is not involved. Use `createMockContext` from `@cyanheads/mcp-ts-core/testing` to construct the `ctx` argument.
15
15
 
16
- **Additional exports from `/testing`:** `createMockLogger()` returns a standalone `MockContextLogger` for unit-testing code that accepts a `ContextLogger` directly (services, utilities). `createInMemoryStorage(options?)` provides a real `StorageService` backed by `InMemoryProvider` for testing services that take a `StorageService` dependency.
16
+ **Additional exports from `/testing`:** `createMockSession()` binds a mock handler context to an HTTP session; `createFetchMock()` provides a strict upstream HTTP fake; `runToolContract()` executes a definition through schema, handler, formatting, enrichment/content, and production-shaped error-envelope checks. `createMockLogger()` returns a standalone `MockContextLogger`, and `createInMemoryStorage(options?)` provides a real `StorageService` backed by `InMemoryProvider`.
17
17
 
18
18
  **Philosophy:** Test behavior, not implementation. Refactors should not break tests. Match the repo's existing test layout: fresh scaffolds use `tests/`, while colocated `src/**/*.test.ts` files are also supported. Integration tests at I/O boundaries over unit tests of internals.
19
19
 
@@ -21,7 +21,7 @@ Tests target handler behavior directly — call `handler(input, ctx)`, assert on
21
21
 
22
22
  ## `mcpTest` — fixture-based Vitest test
23
23
 
24
- `mcpTest` is a `test.extend`-based Vitest test that provides `ctx` and `storage` as **per-test fixtures** — fresh instances for every test, eliminating the `createMockContext()` boilerplate and enforcing the fresh-context-per-test convention automatically.
24
+ `mcpTest` is a `test.extend`-based Vitest test that provides `ctx`, `session`, `fetchMock`, and `storage` as **per-test fixtures** — fresh instances for every test, eliminating boilerplate and enforcing isolation automatically. `fetchMock` is installed as `globalThis.fetch` only when requested by a test and restored afterward.
25
25
 
26
26
  ```ts
27
27
  import { mcpTest } from '@cyanheads/mcp-ts-core/testing/vitest';
@@ -36,6 +36,14 @@ mcpTest('uses storage fixture', async ({ ctx, storage }) => {
36
36
  const result = await svc.doWork(ctx);
37
37
  expect(result).toBeDefined();
38
38
  });
39
+
40
+ mcpTest('stubs an upstream HTTP boundary', async ({ fetchMock }) => {
41
+ fetchMock.route({
42
+ match: 'https://api.example.test/items/42',
43
+ respond: Response.json({ id: '42' }),
44
+ });
45
+ await expect(loadItem('42')).resolves.toMatchObject({ id: '42' });
46
+ });
39
47
  ```
40
48
 
41
49
  ### Fixtures
@@ -43,6 +51,8 @@ mcpTest('uses storage fixture', async ({ ctx, storage }) => {
43
51
  | Fixture | Type | Per-test? | Notes |
44
52
  |:--------|:-----|:----------|:------|
45
53
  | `ctx` | `Context` | Yes | Fresh `createMockContext()` each test |
54
+ | `session` | `MockSession` | Yes | Fresh `{ sessionId, tenantId?, ctx }` from `createMockSession()` |
55
+ | `fetchMock` | `FetchMockHarness` | Yes | Strict fetch fake installed/restored around the requesting test |
46
56
  | `storage` | `StorageService` | Yes | Fresh `createInMemoryStorage()` each test |
47
57
 
48
58
  ### Extending with the function form
@@ -61,7 +71,58 @@ const tenantTest = mcpTest.extend({
61
71
  // const tenantTest = mcpTest.extend({ ctx: createMockContext({ tenantId: 'test-tenant' }) });
62
72
  ```
63
73
 
64
- `createMockContext` and `createInMemoryStorage` are re-exported from `@cyanheads/mcp-ts-core/testing/vitest` so overrides don't need a second import.
74
+ The portable `/testing` helpers are re-exported from `@cyanheads/mcp-ts-core/testing/vitest` so fixture overrides don't need a second import.
75
+
76
+ ---
77
+
78
+ ## Upstream HTTP testing with `createFetchMock`
79
+
80
+ Use the fetch harness at real outbound I/O boundaries. Stub the external service, not server-owned services or handlers.
81
+
82
+ ```ts
83
+ import { createFetchMock } from '@cyanheads/mcp-ts-core/testing';
84
+
85
+ const http = createFetchMock([
86
+ {
87
+ method: 'GET',
88
+ match: 'https://api.example.test/items/42',
89
+ respond: Response.json({ id: '42', name: 'Example' }),
90
+ },
91
+ ]);
92
+
93
+ http.install();
94
+ try {
95
+ await expect(loadItem('42')).resolves.toEqual({ id: '42', name: 'Example' });
96
+ expect(http.calls[0]?.request.url).toBe('https://api.example.test/items/42');
97
+ } finally {
98
+ http.restore();
99
+ }
100
+ ```
101
+
102
+ Routes match in registration order. `match` accepts an exact URL, `RegExp`, or request predicate; `respond` accepts a clonable `Response` or response factory. Set `once: true` for one-shot behavior. Unmatched requests throw unless `onUnhandled` is provided.
103
+
104
+ ---
105
+
106
+ ## Tool conformance with `toolContractSuite`
107
+
108
+ Point the reusable suite at a definition plus representative success and failure inputs. It checks input/output schemas, invokes the real handler, applies formatting/enrichment/content, and validates both public error surfaces.
109
+
110
+ ```ts
111
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
112
+ import { toolContractSuite } from '@cyanheads/mcp-ts-core/testing/vitest';
113
+
114
+ toolContractSuite(searchTool, {
115
+ success: [{ name: 'returns matches', input: { query: 'mcp' } }],
116
+ errors: [{
117
+ name: 'reports an empty query',
118
+ input: { query: '' },
119
+ code: JsonRpcErrorCode.InvalidParams,
120
+ reason: 'empty_query',
121
+ }],
122
+ });
123
+ ```
124
+
125
+ Use `runToolContract(definition, input, { context })` from `/testing` when a custom test runner or an imperative assertion is a better fit. It intentionally skips transport auth and telemetry; those belong in transport/integration tests.
65
126
 
66
127
  ---
67
128
 
@@ -4,7 +4,7 @@ description: >
4
4
  Review an MCP server for common security gaps: LLM-facing surfaces as injection vector (tools, resources, prompts, descriptions), scope blast radius, destructive ops without consent, upstream auth shape, input sinks (URL / path / roots / shell / schema strictness / ReDoS), tenant isolation, leakage through errors and telemetry, unbounded resources, and HTTP-mode deployment surface. Use before a release, after a batch of handler changes, or when the user asks for a security review, audit, or hardening pass. Produces grouped findings and a numbered options list.
5
5
  metadata:
6
6
  author: cyanheads
7
- version: "1.5"
7
+ version: "1.6"
8
8
  audience: external
9
9
  type: audit
10
10
  ---
@@ -122,7 +122,7 @@ grep -rn "ctx.elicit" src/mcp-server/tools/definitions/
122
122
  **Check:**
123
123
 
124
124
  - Each destructive handler calls `ctx.elicit` before the side effect?
125
- - Fallback when client doesn't support elicit — refuses, not silently proceeds?
125
+ - Fallback when elicit is unavailable — **proceeds on the tool annotations, and says so in the tool description?** Do NOT require a refusal here: `ctx.elicit` is `undefined` on *every* Streamable HTTP request (the transport builds a fresh `McpServer` per request, so the SDK never records the client's capabilities — mcp-ts-core#312), so a refusing fallback makes the gated tools permanently unusable on the hosted transport. That is an outage, not a hardening. What IS in scope: a **declined or unparseable** elicit response must never proceed, and any doc claiming the gate protects "clients that support elicitation" must name the HTTP limitation or it overstates the control.
126
126
  - Elicit **response** validated against a Zod schema before use? The returned payload is LLM-mediated, not user-direct — "user confirmed" does not mean "user authored these exact fields."
127
127
  - Consent is scoped to the specific target (e.g., record ID rendered in the prompt), not a generic "proceed?"
128
128
 
@@ -12,7 +12,7 @@
12
12
  "ignorePatterns": []
13
13
  },
14
14
  "outdated": {
15
- "allowlist": ["typescript"]
15
+ "allowlist": []
16
16
  },
17
17
  "packaging": {
18
18
  "pluginManifests": true
@@ -36,6 +36,7 @@
36
36
  "changelog:check": "bun run scripts/build-changelog.ts --check",
37
37
  "release:github": "bun run scripts/release-github.ts",
38
38
  "test": "vitest run",
39
+ "test:coverage": "vitest run --coverage",
39
40
  "start": "node dist/index.js",
40
41
  "start:stdio": "MCP_TRANSPORT_TYPE=stdio node dist/index.js",
41
42
  "start:http": "MCP_TRANSPORT_TYPE=http node dist/index.js"
@@ -67,6 +68,7 @@
67
68
  "@biomejs/biome": "2.5.5",
68
69
  "@socketsecurity/bun-security-scanner": "^1.1.2",
69
70
  "@types/node": "26.1.1",
71
+ "@vitest/coverage-istanbul": "4.1.10",
70
72
  "depcheck": "^1.4.7",
71
73
  "ignore": "^7.0.6",
72
74
  "tsc-alias": "^1.9.1",
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview Property-based fuzz coverage for the scaffolded echo tool.
3
+ * @module tests/fuzz/echo-tool.fuzz.test
4
+ */
5
+
6
+ import { expect, it } from 'vitest';
7
+ import { fuzzTool } from '@cyanheads/mcp-ts-core/testing/fuzz';
8
+ import { echoTool } from '@/mcp-server/tools/definitions/echo.tool.js';
9
+
10
+ it('keeps the echo tool safe across generated and adversarial inputs', async () => {
11
+ const report = await fuzzTool(echoTool, {
12
+ numRuns: 50,
13
+ numAdversarial: 30,
14
+ seed: 20_260_802,
15
+ });
16
+
17
+ expect(report.crashes).toHaveLength(0);
18
+ expect(report.leaks).toHaveLength(0);
19
+ expect(report.prototypePollution).toBe(false);
20
+ });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Tool-contract integration coverage for the scaffolded echo tool.
3
+ * @module tests/integration/echo-contract.int.test
4
+ */
5
+
6
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
7
+ import { toolContractSuite } from '@cyanheads/mcp-ts-core/testing/vitest';
8
+ import { echoTool } from '@/mcp-server/tools/definitions/echo.tool.js';
9
+
10
+ toolContractSuite(echoTool, {
11
+ success: [
12
+ {
13
+ name: 'validates, invokes, and formats a successful call',
14
+ input: { message: 'integration' },
15
+ },
16
+ ],
17
+ errors: [
18
+ {
19
+ name: 'returns the declared dual-surface error envelope',
20
+ input: { message: ' ' },
21
+ code: JsonRpcErrorCode.InvalidParams,
22
+ reason: 'empty_message',
23
+ },
24
+ ],
25
+ });