mcp-integration-harness 0.2.0 → 0.3.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/README.md CHANGED
@@ -75,6 +75,34 @@ It fails in three directions, not one:
75
75
  All three are reported together, so a fourteen-repository rollout is one
76
76
  afternoon rather than fourteen CI rounds.
77
77
 
78
+ ## `expectEveryToolDeclaresOutputSchema`
79
+
80
+ The same shape of check, one level up: not "was this tool called" but "does it
81
+ say what it returns".
82
+
83
+ ```ts
84
+ const { tools } = await harness.client.listTools();
85
+ expectEveryToolDeclaresOutputSchema(tools, {
86
+ call_tool: "forwards a child server's result; the shape is the child's",
87
+ });
88
+ ```
89
+
90
+ It checks **presence**, and deliberately not conformance. A server that declares
91
+ an `outputSchema` and then answers with something else never gets that answer
92
+ onto the wire — the SDK validates `structuredContent` against the advertised
93
+ schema server-side and turns a mismatch into a failed call. So every ordinary
94
+ assertion in your suite is already a schema-against-reality check, and a
95
+ validator in here would only re-examine data that could not have arrived if it
96
+ were wrong.
97
+
98
+ The one thing it does check about the schema itself is that its root is an
99
+ object. SEP-2106 lets an output schema describe an array or a scalar, but a
100
+ 2025-era client is served that same tool with the schema rewritten to
101
+ `{result: …}` — so a tool with a non-object root answers in two different shapes
102
+ depending on who asked. A list is `{ items: [...] }`.
103
+
104
+ Exemptions are a `Record<tool, reason>` and rot in the same three directions.
105
+
78
106
  ## `assertLoopback`
79
107
 
80
108
  The guard that matters more than the tests it protects.
@@ -104,19 +132,21 @@ would otherwise run your suite as you. Those names are blanked explicitly.
104
132
 
105
133
  ## API
106
134
 
107
- | Export | What it does |
108
- | -------------------------- | ------------------------------------------------------------------------------- |
109
- | `startServer(options)` | Spawns `dist/index.js` over real stdio and returns a `LiveHarness` |
110
- | `harness.call(name, args)` | Calls a tool, records it for coverage, returns the joined text parts |
111
- | `harness.raw(name, args)` | The same, returning the whole result — for a tool that answers with an image |
112
- | `harness.confirmed(…)` | Drives **both halves** of the two-call token, for the no-dialog fallback path |
113
- | `harness.prompts` | Every message the server put in front of the user, in order |
114
- | `harness.stderr()` | Everything the server wrote to stderr, including before the handshake completed |
115
- | `expectEveryToolExercised` | The three-way coverage assertion above |
116
- | `toolCoverage` | The same comparison without asserting, for printing the numbers |
117
- | `assertLoopback(url)` | Throws unless the URL is on this machine |
118
- | `waitForHttp(url, opts)` | Polls until an HTTP backend is ready, and says what the last attempt got |
119
- | `waitForTcp(host, port)` | The same for a backend that is not HTTP — IMAP, SMTP — optionally on a greeting |
135
+ | Export | What it does |
136
+ | ------------------------------------- | ------------------------------------------------------------------------------- |
137
+ | `startServer(options)` | Spawns `dist/index.js` over real stdio and returns a `LiveHarness` |
138
+ | `harness.call(name, args)` | Calls a tool, records it for coverage, returns the joined text parts |
139
+ | `harness.raw(name, args)` | The same, returning the whole result — for a tool that answers with an image |
140
+ | `harness.confirmed(…)` | Drives **both halves** of the two-call token, for the no-dialog fallback path |
141
+ | `harness.prompts` | Every message the server put in front of the user, in order |
142
+ | `harness.stderr()` | Everything the server wrote to stderr, including before the handshake completed |
143
+ | `expectEveryToolExercised` | The three-way coverage assertion above |
144
+ | `toolCoverage` | The same comparison without asserting, for printing the numbers |
145
+ | `expectEveryToolDeclaresOutputSchema` | Every advertised tool declares an output schema with an object root |
146
+ | `outputSchemaCoverage` | The same comparison without asserting |
147
+ | `assertLoopback(url)` | Throws unless the URL is on this machine |
148
+ | `waitForHttp(url, opts)` | Polls until an HTTP backend is ready, and says what the last attempt got |
149
+ | `waitForTcp(host, port)` | The same for a backend that is not HTTP — IMAP, SMTP — optionally on a greeting |
120
150
 
121
151
  `elicit: 'accept' | 'decline' | 'cancel'` makes the harness declare the
122
152
  elicitation capability and answer the dialog, which is the path a real client
@@ -54,3 +54,59 @@ export declare function toolCoverage(harness: Pick<LiveHarness, 'called'>, allTo
54
54
  * Throws rather than returning, so it reads as one line in a test.
55
55
  */
56
56
  export declare function expectEveryToolExercised(harness: Pick<LiveHarness, 'called'>, allTools: readonly string[], skipped?: SkipReasons): void;
57
+ /**
58
+ * One entry of `tools/list`, as much of it as this check reads.
59
+ *
60
+ * Structural rather than the SDK's `Tool`, like {@link expectEveryToolExercised}
61
+ * takes a `Pick<LiveHarness, …>`: the result of `client.listTools()` satisfies it
62
+ * as it comes, and the library stays free of a type-only import from a package it
63
+ * only peer-depends on.
64
+ */
65
+ export interface AdvertisedTool {
66
+ name: string;
67
+ outputSchema?: unknown;
68
+ }
69
+ export interface OutputSchemaReport {
70
+ declared: readonly string[];
71
+ exempt: readonly string[];
72
+ /** Advertised without an `outputSchema`, and not exempt. */
73
+ missing: readonly string[];
74
+ /** Exempt, but declares one after all — the reason is stale. */
75
+ staleReasons: readonly string[];
76
+ /** Exempt, but no longer a tool — the reason outlived its tool. */
77
+ unknownReasons: readonly string[];
78
+ /** Declared with a root that is not `"object"`. */
79
+ nonObjectRoot: readonly string[];
80
+ }
81
+ /**
82
+ * Compares the advertised tools against the rule, without asserting.
83
+ *
84
+ * Separate from the assertion for the reason {@link toolCoverage} is: "62 of 62
85
+ * tools declare an output schema" belongs in a CI log on a green run too.
86
+ */
87
+ export declare function outputSchemaCoverage(tools: readonly AdvertisedTool[], exempt?: SkipReasons): OutputSchemaReport;
88
+ /**
89
+ * Fails unless every advertised tool declares an output schema with an object
90
+ * root.
91
+ *
92
+ * The presence half only. What the schema *says* needs no check here: a server
93
+ * that declares an `outputSchema` and then answers with something else never
94
+ * gets that answer past its own SDK, which validates `structuredContent`
95
+ * against the advertised schema before it goes on the wire and turns a mismatch
96
+ * into a failed call. So every ordinary assertion in the suite is already a
97
+ * schema-against-reality check, and a validator in here would only re-examine
98
+ * data that could not have arrived if it were wrong.
99
+ *
100
+ * The object root is checked, though, and is not pedantry. SEP-2106 lets an
101
+ * output schema describe an array or a scalar, but a 2025-era client is served
102
+ * that same tool with the schema rewritten to `{result: …}` — so a tool with a
103
+ * non-object root answers in two different shapes depending on who asked. A
104
+ * list is `{ items: [...] }`.
105
+ *
106
+ * Exemptions take a written reason and rot in the same three directions
107
+ * {@link expectEveryToolExercised} guards against. The one that has earned its
108
+ * place so far:
109
+ *
110
+ * call_tool: 'forwards a child server's result; the shape is the child's'
111
+ */
112
+ export declare function expectEveryToolDeclaresOutputSchema(tools: readonly AdvertisedTool[], exempt?: SkipReasons): void;
package/dist/coverage.js CHANGED
@@ -55,4 +55,89 @@ export function expectEveryToolExercised(harness, allTools, skipped = {}) {
55
55
  `${report.skipped.length} excused.\n\n${problems.join('\n\n')}`);
56
56
  }
57
57
  }
58
+ /** Whether a value is a JSON Schema whose instance root is an object. */
59
+ function hasObjectRoot(schema) {
60
+ if (typeof schema !== 'object' || schema === null)
61
+ return false;
62
+ return schema.type === 'object';
63
+ }
64
+ /**
65
+ * Compares the advertised tools against the rule, without asserting.
66
+ *
67
+ * Separate from the assertion for the reason {@link toolCoverage} is: "62 of 62
68
+ * tools declare an output schema" belongs in a CI log on a green run too.
69
+ */
70
+ export function outputSchemaCoverage(tools, exempt = {}) {
71
+ const names = new Set(tools.map((tool) => tool.name));
72
+ const reasons = Object.keys(exempt);
73
+ const withSchema = tools.filter((tool) => tool.outputSchema !== undefined);
74
+ return {
75
+ declared: withSchema.map((tool) => tool.name).sort(),
76
+ exempt: reasons.sort(),
77
+ missing: tools
78
+ .filter((tool) => tool.outputSchema === undefined && !(tool.name in exempt))
79
+ .map((tool) => tool.name)
80
+ .sort(),
81
+ staleReasons: withSchema
82
+ .filter((tool) => tool.name in exempt)
83
+ .map((tool) => tool.name)
84
+ .sort(),
85
+ unknownReasons: reasons.filter((name) => !names.has(name)).sort(),
86
+ nonObjectRoot: withSchema
87
+ .filter((tool) => !hasObjectRoot(tool.outputSchema))
88
+ .map((tool) => tool.name)
89
+ .sort(),
90
+ };
91
+ }
92
+ /**
93
+ * Fails unless every advertised tool declares an output schema with an object
94
+ * root.
95
+ *
96
+ * The presence half only. What the schema *says* needs no check here: a server
97
+ * that declares an `outputSchema` and then answers with something else never
98
+ * gets that answer past its own SDK, which validates `structuredContent`
99
+ * against the advertised schema before it goes on the wire and turns a mismatch
100
+ * into a failed call. So every ordinary assertion in the suite is already a
101
+ * schema-against-reality check, and a validator in here would only re-examine
102
+ * data that could not have arrived if it were wrong.
103
+ *
104
+ * The object root is checked, though, and is not pedantry. SEP-2106 lets an
105
+ * output schema describe an array or a scalar, but a 2025-era client is served
106
+ * that same tool with the schema rewritten to `{result: …}` — so a tool with a
107
+ * non-object root answers in two different shapes depending on who asked. A
108
+ * list is `{ items: [...] }`.
109
+ *
110
+ * Exemptions take a written reason and rot in the same three directions
111
+ * {@link expectEveryToolExercised} guards against. The one that has earned its
112
+ * place so far:
113
+ *
114
+ * call_tool: 'forwards a child server's result; the shape is the child's'
115
+ */
116
+ export function expectEveryToolDeclaresOutputSchema(tools, exempt = {}) {
117
+ const report = outputSchemaCoverage(tools, exempt);
118
+ const problems = [];
119
+ if (report.missing.length > 0) {
120
+ problems.push(`${report.missing.length} tool(s) declare no outputSchema: ` +
121
+ `${report.missing.join(', ')}. Declare one and return structuredContent, ` +
122
+ 'or give each a reason saying why the shape is not this server to state.');
123
+ }
124
+ if (report.staleReasons.length > 0) {
125
+ problems.push(`${report.staleReasons.length} exempt tool(s) declare one after all: ` +
126
+ `${report.staleReasons.join(', ')}. Remove the reason — it is no longer true.`);
127
+ }
128
+ if (report.unknownReasons.length > 0) {
129
+ problems.push(`${report.unknownReasons.length} reason(s) name a tool that no longer ` +
130
+ `exists: ${report.unknownReasons.join(', ')}.`);
131
+ }
132
+ if (report.nonObjectRoot.length > 0) {
133
+ problems.push(`${report.nonObjectRoot.length} tool(s) declare a non-object root: ` +
134
+ `${report.nonObjectRoot.join(', ')}. A 2025-era client is served that ` +
135
+ 'schema wrapped as {result: …}, so the answer has two shapes. Wrap the ' +
136
+ 'value in an object — a list is { items: [...] }.');
137
+ }
138
+ if (problems.length > 0) {
139
+ throw new Error(`${report.declared.length} of ${tools.length} tools declare an output ` +
140
+ `schema, ${report.exempt.length} exempt.\n\n${problems.join('\n\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,17 @@ export interface ToolResult {
63
63
  mimeType?: string;
64
64
  data?: string;
65
65
  }[];
66
+ /**
67
+ * The machine-readable half of an answer, for a tool that declares an
68
+ * `outputSchema`.
69
+ *
70
+ * `unknown` rather than a shape, because the shape is the server's to declare
71
+ * and the suite's to assert. Worth knowing: a value that reaches here has
72
+ * already been validated against the advertised schema — the SDK does that
73
+ * server-side and turns a mismatch into a failed call — so a test that reads
74
+ * this field is checking *which* data came back, not whether it conformed.
75
+ */
76
+ structuredContent?: unknown;
66
77
  isError?: boolean;
67
78
  }
68
79
  export interface LiveHarness {
@@ -91,6 +102,12 @@ export interface LiveHarness {
91
102
  * Only meaningful on a harness started **without** `elicit`: with a dialog
92
103
  * available the server refuses to offer a token at all, which is the whole
93
104
  * point of the dialog. Use it to prove the fallback path still works.
105
+ *
106
+ * The first half is expected to **fail** — `mcp-approval` marks the prompt
107
+ * `isError`, because the operation was asked for and did not happen, and
108
+ * because a tool that declares an `outputSchema` may not answer without
109
+ * `structuredContent` unless the result is an error. The second half is
110
+ * expected to succeed, and its text is what comes back.
94
111
  */
95
112
  confirmed(name: string, args?: Record<string, unknown>): Promise<string>;
96
113
  /** Every message the server put in front of the user, in order. */
package/dist/harness.js CHANGED
@@ -89,7 +89,16 @@ export async function startServer(options) {
89
89
  throw new Error(`mcp-integration-harness: ${process.execPath} ${entry} did not start.\n` +
90
90
  `${String(error)}\n\nIts stderr:\n${errors.join('') || '(nothing)'}`);
91
91
  }
92
- const raw = async (name, args = {}, callOptions = {}) => {
92
+ /**
93
+ * The call itself: coverage bookkeeping, the transport, the framing check.
94
+ *
95
+ * Separate from {@link raw} because one caller has no expectation to state.
96
+ * `confirmed()` drives a path whose first half is an error result on a
97
+ * current `mcp-approval` and was not on an older one, and neither branch of
98
+ * `expectError` describes "I am about to read a token out of this, and if it
99
+ * is not there I have a better sentence than either".
100
+ */
101
+ const invoke = async (name, args) => {
93
102
  called.add(name);
94
103
  let result;
95
104
  try {
@@ -111,6 +120,11 @@ export async function startServer(options) {
111
120
  'JSON-RPC message, and the reply is discarded inside the read buffer ' +
112
121
  'where no hook can see it. stdout belongs to the transport.');
113
122
  }
123
+ assertFramingIntact(`calling ${name}`);
124
+ return result;
125
+ };
126
+ const raw = async (name, args = {}, callOptions = {}) => {
127
+ const result = await invoke(name, args);
114
128
  const expectation = callOptions.expectError ?? false;
115
129
  const wantFailure = expectation !== false;
116
130
  const failed = result.isError === true;
@@ -133,7 +147,6 @@ export async function startServer(options) {
133
147
  `Expected the message to match: ${String(expectation)}\n` +
134
148
  `Got: ${text.slice(0, 500)}`);
135
149
  }
136
- assertFramingIntact(`calling ${name}`);
137
150
  return result;
138
151
  };
139
152
  const call = async (name, args = {}, callOptions = {}) => textOf(await raw(name, args, callOptions));
@@ -163,7 +176,11 @@ export async function startServer(options) {
163
176
  called,
164
177
  stderr: () => errors.join(''),
165
178
  confirmed: async (name, args = {}) => {
166
- const first = await call(name, args);
179
+ // `invoke`, not `call`: the first half is an error result — the prompt
180
+ // says the operation did not happen — and asserting on that here would
181
+ // replace `tokenOf`'s sentence, which names the real mistake (calling
182
+ // this on a harness started *with* `elicit`), with a generic one.
183
+ const first = textOf(await invoke(name, args));
167
184
  return call(name, { ...args, confirm_token: tokenOf(first) });
168
185
  },
169
186
  close: async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"harness.js","sourceRoot":"","sources":["../src/harness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAiH5C,iDAAiD;AACjD,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,MAAM,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OAAO;QACxC,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,qEAAqE,MAAM,KAAK;YAC9E,GAAG,QAAQ,MAAM;YACjB,oEAAoE;YACpE,uEAAuE;YACvE,gCAAgC;YAChC,gCAAgC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,WAAW,EAAE,CACnE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM;QACN,IAAI;QACJ,GAAG;QACH,OAAO;QACP,MAAM;QACN,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,EAAE;YACnC,uEAAuE;YACvE,uEAAuE;YACvE,sEAAsE;YACtE,kEAAkE;YAClE,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACrB,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC7C,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { startServer, tokenOf, type CallOptions, type ElicitBehaviour, type LiveHarness, type StartServerOptions, type ToolResult, } from './harness.js';
2
- export { expectEveryToolExercised, toolCoverage, type CoverageReport, type SkipReasons, } from './coverage.js';
2
+ export { expectEveryToolDeclaresOutputSchema, expectEveryToolExercised, outputSchemaCoverage, toolCoverage, type AdvertisedTool, type CoverageReport, type OutputSchemaReport, type SkipReasons, } from './coverage.js';
3
3
  export { assertLoopback, assertLoopbackHost } from './loopback.js';
4
4
  export { waitForHttp, waitForTcp, type TcpWaitOptions, type WaitOptions, } from './wait.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { startServer, tokenOf, } from './harness.js';
2
- export { expectEveryToolExercised, toolCoverage, } from './coverage.js';
2
+ export { expectEveryToolDeclaresOutputSchema, expectEveryToolExercised, outputSchemaCoverage, toolCoverage, } from './coverage.js';
3
3
  export { assertLoopback, assertLoopbackHost } from './loopback.js';
4
4
  export { waitForHttp, waitForTcp, } from './wait.js';
5
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,OAAO,GAMR,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,wBAAwB,EACxB,YAAY,GAGb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,WAAW,EACX,UAAU,GAGX,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,OAAO,GAMR,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACxB,oBAAoB,EACpB,YAAY,GAKb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,WAAW,EACX,UAAU,GAGX,MAAM,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-integration-harness",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Drive an MCP server over real stdio against a real backend, and prove every tool was exercised",
5
5
  "keywords": [
6
6
  "mcp",