@mcpfn/testing 0.0.3 → 0.0.5
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 +178 -2
- package/dist/auth.cjs +1 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.js +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/index.cjs +3016 -158
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +426 -89
- package/dist/index.d.ts +426 -89
- package/dist/index.js +2993 -155
- package/dist/index.js.map +1 -1
- package/dist/playwright.cjs +1 -1
- package/dist/playwright.cjs.map +1 -1
- package/dist/playwright.js +1 -1
- package/dist/playwright.js.map +1 -1
- package/package.json +6 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ClientCapabilities, Implementation, Tool, CallToolResult, CreateTaskResult, Task, ListTasksResult, Resource, ResourceTemplate, ReadResourceResult, Prompt, GetPromptResult, CompleteRequest, CompleteResult, ServerCapabilities } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import { McpFnServer, McpFnManifest } from '@mcpfn/core';
|
|
3
|
-
import {
|
|
2
|
+
import { McpFnServer, McpFnManifest, McpFnSchemaIssue } from '@mcpfn/core';
|
|
3
|
+
import { McpFnClientMediatedHandlers, McpFnClientEventSink, McpFnDiagnosticSink, McpFnClient, McpFnTarget, McpFnStreamableHttpTargetOptions, McpFnClientEventKind, McpFnTargetDescriptor, McpFnDiagnosticEvent, McpFnDiagnosticPhase } from '@mcpfn/client';
|
|
4
4
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
5
|
import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
6
6
|
export { MCPFN_NAMED_OAUTH_HOST_FIXTURES, MCPFN_OAUTH_EXTENSION_GRANTS, McpFnAuthAssertionError, McpFnAuthCredential, McpFnAuthCredentialKind, McpFnAuthCredentialRequest, McpFnAuthProbeScenario, McpFnAuthProviderAdapter, McpFnAuthProviderCapabilities, McpFnAuthRegressionOptions, McpFnAuthScenarioResult, McpFnAuthTarget, McpFnBearerChallenge, McpFnFetchAuthTargetOptions, McpFnMockOAuthAuthorizationServer, McpFnMockOAuthServerOptions, McpFnMockOAuthTokenSet, McpFnNamedOAuthHostFixture, McpFnOAuthCallback, McpFnOAuthClientMetadata, McpFnOAuthClientMetadataFixtureOptions, McpFnOAuthClientMetadataVariants, McpFnPkcePair, McpFnStartMockOAuthServerOptions, McpFnStartedMockOAuthServer, apiKeyCredential, assertAuthRegressionSuite, assertAuthorizationCodeClientMetadata, assertBearerResourceChallenge, bearerCredential, createFetchAuthTarget, createOAuthClientMetadataFixture, createOAuthClientMetadataVariants, createPkcePair, parseBearerChallenge, runAuthRegressionSuite, startMockOAuthAuthorizationServer } from './auth.cjs';
|
|
7
|
+
import { OAuthClientMetadata } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
8
|
+
import { McpFnClientRegistrationSource } from '@mcpfn/auth';
|
|
7
9
|
import '@modelcontextprotocol/sdk/server/auth/types.js';
|
|
8
10
|
|
|
9
11
|
interface McpFnTestClientOptions {
|
|
@@ -14,6 +16,11 @@ interface McpFnTestClientOptions {
|
|
|
14
16
|
configure?(client: Client): void | Promise<void>;
|
|
15
17
|
diagnostics?: McpFnDiagnosticSink;
|
|
16
18
|
}
|
|
19
|
+
/** Test-client cleanup failed and remains owned by this retryable error. */
|
|
20
|
+
declare class McpFnTestClientCleanupError extends Error {
|
|
21
|
+
constructor(close: () => Promise<void>, cause: unknown);
|
|
22
|
+
retryCleanup(): Promise<void>;
|
|
23
|
+
}
|
|
17
24
|
declare class McpFnTestClient<TContext = undefined> {
|
|
18
25
|
readonly session: McpFnClient;
|
|
19
26
|
private constructor();
|
|
@@ -22,6 +29,8 @@ declare class McpFnTestClient<TContext = undefined> {
|
|
|
22
29
|
name: string;
|
|
23
30
|
version: string;
|
|
24
31
|
}, options?: McpFnTestClientOptions): Promise<McpFnTestClient<TContext>>;
|
|
32
|
+
/** Create the session owner before connecting, so failed initialization remains closeable. */
|
|
33
|
+
static createTarget<TContext = undefined>(target: McpFnTarget, info?: Implementation, options?: McpFnTestClientOptions): McpFnTestClient<TContext>;
|
|
25
34
|
static connectTarget<TContext = undefined>(target: McpFnTarget, info?: Implementation, options?: McpFnTestClientOptions): Promise<McpFnTestClient<TContext>>;
|
|
26
35
|
listTools(options?: RequestOptions): Promise<Tool[]>;
|
|
27
36
|
callTool(name: string, args?: Record<string, unknown>, options?: RequestOptions): Promise<CallToolResult>;
|
|
@@ -57,104 +66,196 @@ declare function assertStructuredTextParity(result: {
|
|
|
57
66
|
structuredContent?: Record<string, unknown>;
|
|
58
67
|
}): void;
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
interface
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
specVersion?: string;
|
|
68
|
-
verbose?: boolean;
|
|
69
|
-
cwd?: string;
|
|
70
|
-
stdio?: "inherit" | "pipe";
|
|
71
|
-
}
|
|
72
|
-
interface OfficialConformanceResult {
|
|
73
|
-
exitCode: number;
|
|
74
|
-
stdout: string;
|
|
75
|
-
stderr: string;
|
|
69
|
+
type McpFnFixtureSideEffect = "read-only" | "idempotent" | "non-idempotent";
|
|
70
|
+
interface McpFnClientProfileFixtureExpectation {
|
|
71
|
+
isError?: boolean;
|
|
72
|
+
structuredContent?: Record<string, unknown>;
|
|
73
|
+
errorCode?: string;
|
|
74
|
+
lifecycleStage?: string;
|
|
75
|
+
validationIssue?: Partial<Pick<McpFnSchemaIssue, "instancePath" | "schemaPath" | "keyword" | "rejectedProperty" | "missingProperty">>;
|
|
76
76
|
}
|
|
77
|
-
interface
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
interface McpFnClientProfileFixture {
|
|
78
|
+
name: string;
|
|
79
|
+
tool: string;
|
|
80
|
+
/** Values are executed but never copied into compatibility reports. */
|
|
81
|
+
arguments?: Record<string, unknown>;
|
|
82
|
+
sideEffect: McpFnFixtureSideEffect;
|
|
83
|
+
source?: "minimal-valid" | "captured-failure";
|
|
84
|
+
expect?: McpFnClientProfileFixtureExpectation;
|
|
81
85
|
}
|
|
82
|
-
interface
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
|
|
86
|
+
interface McpFnSchemaPortabilityPolicy {
|
|
87
|
+
/** Treat otherwise-valid compatibility-reducing keywords as failures. */
|
|
88
|
+
warningsAsErrors?: boolean;
|
|
89
|
+
/** Suppress warnings for explicitly reviewed keywords. */
|
|
90
|
+
allowKeywords?: readonly string[];
|
|
87
91
|
}
|
|
88
|
-
interface
|
|
89
|
-
|
|
92
|
+
interface McpFnSchemaPortabilityIssue {
|
|
93
|
+
severity: "error" | "warning";
|
|
94
|
+
code: "schema-invalid" | "schema-dialect-unsupported" | "schema-portability-warning";
|
|
95
|
+
path: string;
|
|
96
|
+
keyword?: string;
|
|
97
|
+
message: string;
|
|
90
98
|
}
|
|
91
|
-
|
|
92
|
-
* Start a loopback-only streaming proxy for runners that cannot send auth
|
|
93
|
-
* headers. Authenticated requests use one fixed upstream authority and path.
|
|
94
|
-
* Host-manipulation probes are forwarded without injected credentials.
|
|
95
|
-
*/
|
|
96
|
-
declare function createAuthenticatedConformanceProxy(options: AuthenticatedConformanceProxyOptions): Promise<AuthenticatedConformanceProxy>;
|
|
97
|
-
declare function buildOfficialConformanceArgs(options: OfficialConformanceOptions): string[];
|
|
98
|
-
declare function runOfficialConformance(options: OfficialConformanceOptions): Promise<OfficialConformanceResult>;
|
|
99
|
-
/** Run the pinned official suite against an authenticated MCP endpoint. */
|
|
100
|
-
declare function runAuthenticatedOfficialConformance(options: AuthenticatedOfficialConformanceOptions): Promise<OfficialConformanceResult>;
|
|
101
|
-
|
|
102
|
-
type McpFnServerFeature = "tools" | "resources" | "prompts" | "completions" | "tasks" | "logging";
|
|
103
|
-
interface McpFnHostProfile {
|
|
104
|
-
id: string;
|
|
99
|
+
interface McpFnClientProfileSnapshotTool {
|
|
105
100
|
name: string;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
101
|
+
hash: string;
|
|
102
|
+
}
|
|
103
|
+
interface McpFnClientProfileSnapshot {
|
|
104
|
+
formatVersion: 1;
|
|
105
|
+
kind: "mcpfn.client-profile-snapshot";
|
|
106
|
+
profile: {
|
|
107
|
+
id: string;
|
|
108
|
+
version: string;
|
|
112
109
|
};
|
|
113
|
-
|
|
110
|
+
catalogHash: string;
|
|
111
|
+
tools: McpFnClientProfileSnapshotTool[];
|
|
114
112
|
}
|
|
115
|
-
interface
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
interface McpFnClientProfileSnapshotChange {
|
|
114
|
+
kind: "added" | "removed" | "modified";
|
|
115
|
+
tool: string;
|
|
116
|
+
beforeHash?: string;
|
|
117
|
+
afterHash?: string;
|
|
120
118
|
}
|
|
121
|
-
interface
|
|
122
|
-
status: "compatible" | "degraded" | "incompatible";
|
|
119
|
+
interface McpFnClientProfileSnapshotDiff {
|
|
123
120
|
compatible: boolean;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
readonly name: "Tools-only MCP host";
|
|
130
|
-
readonly protocolVersions: ["2025-03-26", "2025-06-18", "2025-11-25"];
|
|
131
|
-
readonly serverFeatures: ["tools"];
|
|
121
|
+
changes: McpFnClientProfileSnapshotChange[];
|
|
122
|
+
summary: {
|
|
123
|
+
added: number;
|
|
124
|
+
removed: number;
|
|
125
|
+
modified: number;
|
|
132
126
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
}
|
|
128
|
+
interface McpFnClientProfileContractCase {
|
|
129
|
+
id: string;
|
|
130
|
+
version: string;
|
|
131
|
+
target: McpFnTarget;
|
|
132
|
+
clientInfo?: Implementation;
|
|
133
|
+
capabilities?: ClientCapabilities;
|
|
134
|
+
client?: Omit<McpFnTestClientOptions, "capabilities">;
|
|
135
|
+
fixtures?: readonly McpFnClientProfileFixture[];
|
|
136
|
+
expectedSnapshot?: McpFnClientProfileSnapshot;
|
|
137
|
+
portability?: McpFnSchemaPortabilityPolicy;
|
|
138
|
+
}
|
|
139
|
+
interface RunMcpFnClientProfileContractsOptions {
|
|
140
|
+
profiles: readonly McpFnClientProfileContractCase[];
|
|
141
|
+
/** Explicit opt-in for fixtures that could mutate state. Defaults to false. */
|
|
142
|
+
allowSideEffects?: boolean;
|
|
143
|
+
/** Aggregate JSON size cap. Defaults to 1 MiB. */
|
|
144
|
+
maxReportBytes?: number;
|
|
145
|
+
}
|
|
146
|
+
interface McpFnClientProfileFixtureResult {
|
|
147
|
+
name: string;
|
|
148
|
+
tool: string;
|
|
149
|
+
source: "minimal-valid" | "captured-failure";
|
|
150
|
+
status: "passed" | "failed" | "incomplete";
|
|
151
|
+
code?: string;
|
|
152
|
+
error?: string;
|
|
153
|
+
}
|
|
154
|
+
interface McpFnClientProfileContractResult {
|
|
155
|
+
profile: {
|
|
156
|
+
id: string;
|
|
157
|
+
version: string;
|
|
143
158
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
159
|
+
status: "complete" | "incomplete";
|
|
160
|
+
ok: boolean;
|
|
161
|
+
phase?: "connect" | "catalog" | "fixtures" | "close";
|
|
162
|
+
snapshot?: McpFnClientProfileSnapshot;
|
|
163
|
+
snapshotMatches?: boolean;
|
|
164
|
+
portability: McpFnSchemaPortabilityIssue[];
|
|
165
|
+
fixtures: McpFnClientProfileFixtureResult[];
|
|
166
|
+
error?: string;
|
|
167
|
+
}
|
|
168
|
+
interface McpFnClientProfileContractReport {
|
|
169
|
+
formatVersion: 1;
|
|
170
|
+
kind: "mcpfn.client-profile-contract-report";
|
|
171
|
+
status: "complete" | "incomplete";
|
|
172
|
+
ok: boolean;
|
|
173
|
+
profiles: McpFnClientProfileContractResult[];
|
|
174
|
+
droppedProfiles: number;
|
|
175
|
+
incompleteReason?: string;
|
|
176
|
+
}
|
|
177
|
+
/** A complete bounded report with retry ownership for unfinished target cleanup. */
|
|
178
|
+
declare class McpFnClientProfileContractCleanupError extends Error {
|
|
179
|
+
readonly report: McpFnClientProfileContractReport;
|
|
180
|
+
private readonly owners;
|
|
181
|
+
constructor(report: McpFnClientProfileContractReport, owners: readonly McpFnTestClientCleanupError[]);
|
|
182
|
+
retryCleanup(): Promise<void>;
|
|
183
|
+
}
|
|
184
|
+
declare function createMcpFnClientProfileSnapshot(profile: {
|
|
185
|
+
id: string;
|
|
186
|
+
version: string;
|
|
187
|
+
}, tools: readonly Tool[]): McpFnClientProfileSnapshot;
|
|
188
|
+
declare function validateMcpFnClientProfileSnapshot(value: unknown): McpFnClientProfileSnapshot;
|
|
189
|
+
declare function diffMcpFnClientProfileSnapshots(beforeValue: unknown, afterValue: unknown): McpFnClientProfileSnapshotDiff;
|
|
190
|
+
declare function validateMcpFnSchemaPortability(schema: unknown, path: string, policy?: McpFnSchemaPortabilityPolicy): McpFnSchemaPortabilityIssue[];
|
|
191
|
+
/** Exercise every profile through the production target/client list-and-call lifecycle. */
|
|
192
|
+
declare function runMcpFnClientProfileContracts(options: RunMcpFnClientProfileContractsOptions): Promise<McpFnClientProfileContractReport>;
|
|
193
|
+
|
|
194
|
+
/** Retain released credentials only for the lifetime of a report operation. */
|
|
195
|
+
declare function beginTargetCredentialRedaction(target: McpFnTarget): () => void;
|
|
196
|
+
declare class McpFnRedactionLimitError extends Error {
|
|
197
|
+
constructor(message?: string);
|
|
198
|
+
}
|
|
199
|
+
/** No typed artifact can preserve this authored structure without exposing a credential. */
|
|
200
|
+
declare class McpFnStructuralCredentialCollisionError extends McpFnRedactionLimitError {
|
|
201
|
+
constructor();
|
|
202
|
+
}
|
|
203
|
+
/** Remove known opaque credential values as well as credential-shaped fields. */
|
|
204
|
+
declare function redactTargetCredentials<T>(target: McpFnTarget, value: T, options?: {
|
|
205
|
+
preserveKeys?: boolean;
|
|
206
|
+
redactionMarker?: string;
|
|
207
|
+
}): T;
|
|
208
|
+
/** Assert completed bounded output without applying payload traversal limits. */
|
|
209
|
+
declare function assertTargetArtifactSafe(target: McpFnTarget, value: string): void;
|
|
210
|
+
/** Redact authenticated conformance output using the acquired credential. */
|
|
211
|
+
declare function redactRemoteCredential<T>(credential: McpFnRemoteCredential, value: T, options?: {
|
|
212
|
+
preserveKeys?: boolean;
|
|
213
|
+
}): T;
|
|
214
|
+
type McpFnRemoteCredentialKind = "api-key" | "oauth" | "custom";
|
|
215
|
+
interface McpFnRemoteCredential {
|
|
216
|
+
/** Credential headers are applied only to the fixed target origin. */
|
|
217
|
+
headers: HeadersInit;
|
|
218
|
+
kind?: McpFnRemoteCredentialKind;
|
|
219
|
+
label?: string;
|
|
220
|
+
}
|
|
221
|
+
interface McpFnRemoteCredentialContext {
|
|
222
|
+
url: string;
|
|
223
|
+
requestId: string;
|
|
224
|
+
signal?: AbortSignal;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Application-owned credential lifecycle for external MCP targets. McpFn
|
|
228
|
+
* acquires once per target open, revokes before disposal, and never serializes
|
|
229
|
+
* the returned headers into descriptors or reports. If acquisition rejects, the
|
|
230
|
+
* provider must roll back its own partial resources; no lease has been returned.
|
|
231
|
+
*/
|
|
232
|
+
interface McpFnRemoteCredentialProvider {
|
|
233
|
+
acquire(context: McpFnRemoteCredentialContext): McpFnRemoteCredential | Promise<McpFnRemoteCredential>;
|
|
234
|
+
revoke?(credential: McpFnRemoteCredential, context: McpFnRemoteCredentialContext): void | Promise<void>;
|
|
235
|
+
dispose?(credential: McpFnRemoteCredential, context: McpFnRemoteCredentialContext): void | Promise<void>;
|
|
236
|
+
}
|
|
237
|
+
interface McpFnRemoteCredentialLease {
|
|
238
|
+
credential: McpFnRemoteCredential;
|
|
239
|
+
release(): Promise<void>;
|
|
240
|
+
/** The lifecycle stage that most recently prevented credential release. */
|
|
241
|
+
cleanupPhase(): "token-revocation" | "transport-close";
|
|
242
|
+
}
|
|
243
|
+
interface McpFnAuthenticatedHttpTargetOptions extends Omit<McpFnStreamableHttpTargetOptions, "authProvider" | "requestInit"> {
|
|
244
|
+
credential: McpFnRemoteCredential | McpFnRemoteCredentialProvider;
|
|
245
|
+
requestInit?: Omit<RequestInit, "headers" | "redirect"> & {
|
|
246
|
+
headers?: HeadersInit;
|
|
155
247
|
};
|
|
156
|
-
}
|
|
157
|
-
|
|
248
|
+
}
|
|
249
|
+
/** Create a provider for an already-bounded API key or OAuth-derived token. */
|
|
250
|
+
declare function staticRemoteCredentialProvider(credential: McpFnRemoteCredential): McpFnRemoteCredentialProvider;
|
|
251
|
+
/** Acquire a credential and return an idempotent revoke-then-dispose lease. */
|
|
252
|
+
declare function acquireRemoteCredential(source: McpFnRemoteCredential | McpFnRemoteCredentialProvider, context: McpFnRemoteCredentialContext): Promise<McpFnRemoteCredentialLease>;
|
|
253
|
+
/**
|
|
254
|
+
* A URL-plus-credential target for non-McpFn servers. It delegates MCP and
|
|
255
|
+
* transport behavior to the production @mcpfn/client session engine.
|
|
256
|
+
*/
|
|
257
|
+
declare function authenticatedHttpTarget(url: string | URL, options: McpFnAuthenticatedHttpTargetOptions): McpFnTarget;
|
|
258
|
+
declare function validateRemoteCredentialHeaders(value: HeadersInit): Headers;
|
|
158
259
|
|
|
159
260
|
type McpFnScenarioSideEffect = "none" | "idempotent" | "non-idempotent";
|
|
160
261
|
interface McpFnScenarioBase {
|
|
@@ -286,6 +387,8 @@ interface McpFnScenarioResult {
|
|
|
286
387
|
error?: string;
|
|
287
388
|
/** Observed client events discarded while this scenario was running. */
|
|
288
389
|
droppedObservedEvents?: number;
|
|
390
|
+
/** Dropped observed events whose original payload could not be safely redacted. */
|
|
391
|
+
redactionOmittedObservedEvents?: number;
|
|
289
392
|
}
|
|
290
393
|
interface McpFnScenarioReport {
|
|
291
394
|
formatVersion: 1;
|
|
@@ -298,6 +401,7 @@ interface McpFnScenarioReport {
|
|
|
298
401
|
incomplete: number;
|
|
299
402
|
droppedResults: number;
|
|
300
403
|
droppedObservedEvents: number;
|
|
404
|
+
redactionOmittedObservedEvents?: number;
|
|
301
405
|
incompleteReason?: string;
|
|
302
406
|
results: McpFnScenarioResult[];
|
|
303
407
|
}
|
|
@@ -340,10 +444,16 @@ interface RunMcpFnTargetSuiteOptions {
|
|
|
340
444
|
interface McpFnTargetSuiteReport {
|
|
341
445
|
formatVersion: 1;
|
|
342
446
|
kind: "mcpfn.target-suite-report";
|
|
447
|
+
/** Generated reports require retained target proof for derived encodings. */
|
|
448
|
+
artifactValidation?: "target-aware";
|
|
343
449
|
status: "complete" | "incomplete";
|
|
344
450
|
runtime: {
|
|
345
451
|
node: string;
|
|
346
452
|
scenarioFormatVersion: 1;
|
|
453
|
+
reportSchemaVersion: string;
|
|
454
|
+
packages: {
|
|
455
|
+
testing: string;
|
|
456
|
+
};
|
|
347
457
|
};
|
|
348
458
|
ok: boolean;
|
|
349
459
|
target: McpFnTargetDescriptor;
|
|
@@ -357,12 +467,239 @@ interface McpFnTargetSuiteReport {
|
|
|
357
467
|
incomplete: number;
|
|
358
468
|
droppedResults: number;
|
|
359
469
|
droppedObservedEvents: number;
|
|
470
|
+
redactionOmittedObservedEvents?: number;
|
|
360
471
|
incompleteReason?: string;
|
|
472
|
+
failure?: McpFnReportFailure;
|
|
361
473
|
timeline: McpFnDiagnosticEvent[];
|
|
362
474
|
droppedTimelineEvents: number;
|
|
363
475
|
results: McpFnScenarioResult[];
|
|
364
476
|
}
|
|
477
|
+
/** Final cleanup failed. The bounded report is a snapshot; retain this error to retry. */
|
|
478
|
+
declare class McpFnTargetSuiteCleanupError extends Error {
|
|
479
|
+
readonly report: McpFnTargetSuiteReport;
|
|
480
|
+
constructor(report: McpFnTargetSuiteReport, close: () => Promise<void>);
|
|
481
|
+
retryCleanup(): Promise<void>;
|
|
482
|
+
}
|
|
483
|
+
/** Report serialization failed after cleanup ownership had already transferred. */
|
|
484
|
+
declare class McpFnTargetSuiteArtifactCleanupError extends Error {
|
|
485
|
+
constructor(close: () => Promise<void>, cause: Error);
|
|
486
|
+
retryCleanup(): Promise<void>;
|
|
487
|
+
}
|
|
365
488
|
/** Runs local, stdio, HTTP, or custom targets through the production session engine. */
|
|
366
489
|
declare function runMcpFnTargetSuite(options: RunMcpFnTargetSuiteOptions): Promise<McpFnTargetSuiteReport>;
|
|
367
490
|
|
|
368
|
-
|
|
491
|
+
declare const MCPFN_TESTING_VERSION: string;
|
|
492
|
+
declare const MCPFN_REPORT_SCHEMA_VERSION = "1.0.0";
|
|
493
|
+
type McpFnFailureLayer = "mcpfn-preflight" | "authorization-server" | "resource-server" | "mcp-initialization" | "scenario" | "upstream-conformance";
|
|
494
|
+
interface McpFnReportFailure {
|
|
495
|
+
name: string;
|
|
496
|
+
message: string;
|
|
497
|
+
layer: McpFnFailureLayer;
|
|
498
|
+
code?: string;
|
|
499
|
+
phase?: string;
|
|
500
|
+
details?: Record<string, unknown>;
|
|
501
|
+
}
|
|
502
|
+
interface McpFnJunitOptions {
|
|
503
|
+
/** Aggregate XML size cap after serialization. Defaults to 1 MiB. */
|
|
504
|
+
maxBytes?: number;
|
|
505
|
+
}
|
|
506
|
+
interface McpFnTargetSuiteJsonOptions {
|
|
507
|
+
/** JSON indentation. Defaults to compact output; maximum 10 spaces. */
|
|
508
|
+
space?: number;
|
|
509
|
+
/** Include a final newline in the validated artifact. */
|
|
510
|
+
trailingNewline?: boolean;
|
|
511
|
+
}
|
|
512
|
+
/** Serialize the exact JSON representation while target proof is retained. */
|
|
513
|
+
declare function serializeMcpFnTargetSuiteReport(report: McpFnTargetSuiteReport, options?: McpFnTargetSuiteJsonOptions): string;
|
|
514
|
+
/** Release target-owned proof after every required report encoding is complete. */
|
|
515
|
+
declare function disposeMcpFnTargetSuiteReport(report: McpFnTargetSuiteReport): void;
|
|
516
|
+
declare function normalizeMcpFnReportFailure(error: unknown, fallbackPhase?: McpFnDiagnosticPhase | "scenario" | "upstream-conformance"): McpFnReportFailure;
|
|
517
|
+
/** Serialize a redacted target-suite report as bounded JUnit XML. */
|
|
518
|
+
declare function createMcpFnTargetSuiteJUnit(report: McpFnTargetSuiteReport, options?: McpFnJunitOptions): string;
|
|
519
|
+
|
|
520
|
+
declare const OFFICIAL_CONFORMANCE_VERSION = "0.1.16";
|
|
521
|
+
interface OfficialConformanceOptions {
|
|
522
|
+
url: string;
|
|
523
|
+
suite?: "active" | "all" | "pending";
|
|
524
|
+
scenario?: string;
|
|
525
|
+
expectedFailures?: string;
|
|
526
|
+
outputDir?: string;
|
|
527
|
+
specVersion?: string;
|
|
528
|
+
verbose?: boolean;
|
|
529
|
+
cwd?: string;
|
|
530
|
+
stdio?: "inherit" | "pipe";
|
|
531
|
+
/** Environment names removed before spawning the upstream runner. */
|
|
532
|
+
sensitiveEnvironmentVariables?: readonly string[];
|
|
533
|
+
}
|
|
534
|
+
interface OfficialConformanceResult {
|
|
535
|
+
formatVersion: 1;
|
|
536
|
+
kind: "mcpfn.official-conformance-report";
|
|
537
|
+
ok: boolean;
|
|
538
|
+
suiteVersion: string;
|
|
539
|
+
exitCode: number;
|
|
540
|
+
stdout: string;
|
|
541
|
+
stderr: string;
|
|
542
|
+
failure?: McpFnReportFailure;
|
|
543
|
+
/** Credential cleanup failure, separate from the upstream runner diagnosis. */
|
|
544
|
+
cleanupFailure?: McpFnReportFailure;
|
|
545
|
+
}
|
|
546
|
+
interface AuthenticatedConformanceProxy {
|
|
547
|
+
/** Loopback URL to pass to the official conformance runner. */
|
|
548
|
+
url: string;
|
|
549
|
+
close(): Promise<void>;
|
|
550
|
+
}
|
|
551
|
+
interface AuthenticatedConformanceProxyOptions {
|
|
552
|
+
/** Fixed loopback MCP URL. Requests cannot select a different origin or path. */
|
|
553
|
+
url: string;
|
|
554
|
+
/** Headers injected into requests using the proxy's own authority. Values are never logged. */
|
|
555
|
+
headers: HeadersInit;
|
|
556
|
+
}
|
|
557
|
+
interface AuthenticatedOfficialConformanceOptions extends OfficialConformanceOptions {
|
|
558
|
+
/** Preferred typed credential lifecycle. */
|
|
559
|
+
credential?: McpFnRemoteCredential | McpFnRemoteCredentialProvider;
|
|
560
|
+
/** Backward-compatible static header input. Prefer credential. */
|
|
561
|
+
headers?: HeadersInit;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Start a loopback-only streaming proxy for runners that cannot send auth
|
|
565
|
+
* headers. Authenticated requests use one fixed upstream authority and path.
|
|
566
|
+
* Host-manipulation probes are forwarded without injected credentials.
|
|
567
|
+
*/
|
|
568
|
+
declare function createAuthenticatedConformanceProxy(options: AuthenticatedConformanceProxyOptions): Promise<AuthenticatedConformanceProxy>;
|
|
569
|
+
declare function buildOfficialConformanceArgs(options: OfficialConformanceOptions): string[];
|
|
570
|
+
declare function buildOfficialConformanceEnvironment(sensitiveNames?: readonly string[], source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
571
|
+
declare function runOfficialConformance(options: OfficialConformanceOptions): Promise<OfficialConformanceResult>;
|
|
572
|
+
/** Cleanup failed after retries. Retain this error and call retryCleanup(). */
|
|
573
|
+
declare class McpFnConformanceCleanupError extends Error {
|
|
574
|
+
readonly result?: OfficialConformanceResult | undefined;
|
|
575
|
+
constructor(release: () => Promise<void>, result?: OfficialConformanceResult | undefined);
|
|
576
|
+
retryCleanup(): Promise<void>;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Run the pinned official suite against an authenticated MCP endpoint.
|
|
580
|
+
* Always captures stdio (even when inherit is requested) to redact credentials.
|
|
581
|
+
* outputDir is rejected before acquisition; only the returned redacted result is safe to persist.
|
|
582
|
+
*/
|
|
583
|
+
declare function runAuthenticatedOfficialConformance(options: AuthenticatedOfficialConformanceOptions): Promise<OfficialConformanceResult>;
|
|
584
|
+
|
|
585
|
+
type McpFnServerFeature = "tools" | "resources" | "prompts" | "completions" | "tasks" | "logging";
|
|
586
|
+
interface McpFnHostProfile {
|
|
587
|
+
id: string;
|
|
588
|
+
name: string;
|
|
589
|
+
protocolVersions: string[];
|
|
590
|
+
serverFeatures: McpFnServerFeature[];
|
|
591
|
+
clientFeatures?: {
|
|
592
|
+
sampling?: boolean;
|
|
593
|
+
elicitation?: Array<"form" | "url">;
|
|
594
|
+
roots?: boolean;
|
|
595
|
+
};
|
|
596
|
+
extensions?: string[];
|
|
597
|
+
}
|
|
598
|
+
interface McpFnHostCompatibilityIssue {
|
|
599
|
+
severity: "incompatible" | "degraded";
|
|
600
|
+
code: string;
|
|
601
|
+
path: string;
|
|
602
|
+
message: string;
|
|
603
|
+
}
|
|
604
|
+
interface McpFnHostCompatibilityResult {
|
|
605
|
+
status: "compatible" | "degraded" | "incompatible";
|
|
606
|
+
compatible: boolean;
|
|
607
|
+
issues: McpFnHostCompatibilityIssue[];
|
|
608
|
+
}
|
|
609
|
+
declare const MCPFN_HOST_PROFILES: {
|
|
610
|
+
readonly toolsOnly: {
|
|
611
|
+
readonly id: "mcpfn/tools-only";
|
|
612
|
+
readonly name: "Tools-only MCP host";
|
|
613
|
+
readonly protocolVersions: ["2025-03-26", "2025-06-18", "2025-11-25"];
|
|
614
|
+
readonly serverFeatures: ["tools"];
|
|
615
|
+
};
|
|
616
|
+
readonly fullProtocol: {
|
|
617
|
+
readonly id: "mcpfn/full-protocol";
|
|
618
|
+
readonly name: "Full protocol MCP host";
|
|
619
|
+
readonly protocolVersions: ["2025-03-26", "2025-06-18", "2025-11-25"];
|
|
620
|
+
readonly serverFeatures: ["tools", "resources", "prompts", "completions", "tasks", "logging"];
|
|
621
|
+
readonly clientFeatures: {
|
|
622
|
+
readonly sampling: true;
|
|
623
|
+
readonly elicitation: ["form", "url"];
|
|
624
|
+
readonly roots: true;
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
readonly mcpApps: {
|
|
628
|
+
readonly id: "mcpfn/mcp-apps";
|
|
629
|
+
readonly name: "Full protocol host with MCP Apps";
|
|
630
|
+
readonly protocolVersions: ["2025-11-25"];
|
|
631
|
+
readonly serverFeatures: ["tools", "resources", "prompts", "completions", "tasks", "logging"];
|
|
632
|
+
readonly clientFeatures: {
|
|
633
|
+
readonly sampling: true;
|
|
634
|
+
readonly elicitation: ["form", "url"];
|
|
635
|
+
readonly roots: true;
|
|
636
|
+
};
|
|
637
|
+
readonly extensions: ["io.modelcontextprotocol/ui"];
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
declare function checkHostCompatibility(manifest: McpFnManifest, profile: McpFnHostProfile): McpFnHostCompatibilityResult;
|
|
641
|
+
|
|
642
|
+
interface McpFnHostedRegistrationFixture {
|
|
643
|
+
clientId: string;
|
|
644
|
+
source: McpFnClientRegistrationSource;
|
|
645
|
+
metadata: OAuthClientMetadata;
|
|
646
|
+
}
|
|
647
|
+
interface McpFnHostedAuthorizationRequestFixture {
|
|
648
|
+
clientId: string;
|
|
649
|
+
redirectUri: string;
|
|
650
|
+
resource: string;
|
|
651
|
+
scopes: string[];
|
|
652
|
+
state: string;
|
|
653
|
+
codeVerifier: string;
|
|
654
|
+
}
|
|
655
|
+
interface McpFnHostedTokenRequestFixture {
|
|
656
|
+
grantType: string;
|
|
657
|
+
/** Optional independently-authored code override for negative token-exchange cases. */
|
|
658
|
+
code?: string;
|
|
659
|
+
refreshToken?: string;
|
|
660
|
+
refreshAfterExchange?: boolean;
|
|
661
|
+
}
|
|
662
|
+
interface McpFnHostedAuthorizationCase {
|
|
663
|
+
id: string;
|
|
664
|
+
host: "chatgpt" | "claude" | "generic";
|
|
665
|
+
registration: McpFnHostedRegistrationFixture;
|
|
666
|
+
authorization: McpFnHostedAuthorizationRequestFixture;
|
|
667
|
+
token?: McpFnHostedTokenRequestFixture;
|
|
668
|
+
expected: {
|
|
669
|
+
outcome: "allowed" | "rejected";
|
|
670
|
+
errorCode?: string;
|
|
671
|
+
phase?: "client-registration" | "authorization-request" | "token-exchange" | "token-refresh";
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
interface McpFnHostedAuthorizationTargetAdapter {
|
|
675
|
+
issuer: string;
|
|
676
|
+
prepareRegistration(fixture: McpFnHostedRegistrationFixture): Promise<void>;
|
|
677
|
+
request(request: Request): Promise<Response>;
|
|
678
|
+
}
|
|
679
|
+
interface McpFnHostedAuthorizationCaseResult {
|
|
680
|
+
formatVersion: 1;
|
|
681
|
+
id: string;
|
|
682
|
+
host: McpFnHostedAuthorizationCase["host"];
|
|
683
|
+
status: "passed" | "failed";
|
|
684
|
+
phase: "client-registration" | "authorization-request" | "token-exchange" | "token-refresh";
|
|
685
|
+
layer: "mcpfn-preflight" | "authorization-server";
|
|
686
|
+
responseStatus?: number;
|
|
687
|
+
errorCode?: string;
|
|
688
|
+
error?: string;
|
|
689
|
+
}
|
|
690
|
+
interface McpFnHostedAuthorizationFixtureOptions {
|
|
691
|
+
issuer: string;
|
|
692
|
+
resource: string;
|
|
693
|
+
chatgptRedirectUri?: string;
|
|
694
|
+
claudeRedirectUri?: string;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Provider-shaped role-3 fixtures. Registration metadata and authorization
|
|
698
|
+
* requests are separate objects so redirect, grant, and deployment drift can
|
|
699
|
+
* fail instead of being generated from one self-consistent source.
|
|
700
|
+
*/
|
|
701
|
+
declare function createHostedAuthorizationFixtures(options: McpFnHostedAuthorizationFixtureOptions): McpFnHostedAuthorizationCase[];
|
|
702
|
+
/** Run the independently-configured hosted-authorization matrix. */
|
|
703
|
+
declare function runHostedAuthorizationRegression(target: McpFnHostedAuthorizationTargetAdapter, fixtures: readonly McpFnHostedAuthorizationCase[]): Promise<McpFnHostedAuthorizationCaseResult[]>;
|
|
704
|
+
|
|
705
|
+
export { type AssertManifestContractOptions, type AuthenticatedConformanceProxy, type AuthenticatedConformanceProxyOptions, type AuthenticatedOfficialConformanceOptions, MCPFN_HOST_PROFILES, MCPFN_REPORT_SCHEMA_VERSION, MCPFN_TESTING_VERSION, McpFnAssertionError, type McpFnAuthScenario, type McpFnAuthenticatedHttpTargetOptions, type McpFnClientProfileContractCase, McpFnClientProfileContractCleanupError, type McpFnClientProfileContractReport, type McpFnClientProfileContractResult, type McpFnClientProfileFixture, type McpFnClientProfileFixtureExpectation, type McpFnClientProfileFixtureResult, type McpFnClientProfileSnapshot, type McpFnClientProfileSnapshotChange, type McpFnClientProfileSnapshotDiff, type McpFnClientProfileSnapshotTool, McpFnConformanceCleanupError, type McpFnCreateTaskScenario, type McpFnEventScenario, type McpFnFailureLayer, type McpFnFixtureSideEffect, type McpFnHostCompatibilityIssue, type McpFnHostCompatibilityResult, type McpFnHostProfile, type McpFnHostedAuthorizationCase, type McpFnHostedAuthorizationCaseResult, type McpFnHostedAuthorizationFixtureOptions, type McpFnHostedAuthorizationRequestFixture, type McpFnHostedAuthorizationTargetAdapter, type McpFnHostedRegistrationFixture, type McpFnHostedTokenRequestFixture, type McpFnInitializeScenario, type McpFnInventoryScenario, type McpFnJunitOptions, type McpFnPromptScenario, type McpFnRecordedOperation, type McpFnRecordedOperationResult, McpFnRedactionLimitError, type McpFnRemoteCredential, type McpFnRemoteCredentialContext, type McpFnRemoteCredentialKind, type McpFnRemoteCredentialLease, type McpFnRemoteCredentialProvider, type McpFnReportFailure, type McpFnResourceScenario, type McpFnScenario, type McpFnScenarioArtifact, type McpFnScenarioBase, type McpFnScenarioReport, type McpFnScenarioResult, type McpFnScenarioRunOptions, type McpFnScenarioSideEffect, type McpFnSchemaPortabilityIssue, type McpFnSchemaPortabilityPolicy, type McpFnServerFeature, McpFnStructuralCredentialCollisionError, McpFnTargetSuiteArtifactCleanupError, McpFnTargetSuiteCleanupError, type McpFnTargetSuiteJsonOptions, type McpFnTargetSuiteReport, type McpFnTaskScenario, McpFnTestClient, McpFnTestClientCleanupError, type McpFnTestClientOptions, type McpFnToolScenario, OFFICIAL_CONFORMANCE_VERSION, type OfficialConformanceOptions, type OfficialConformanceResult, type RunMcpFnClientProfileContractsOptions, type RunMcpFnTargetSuiteOptions, acquireRemoteCredential, assertManifestContract, assertStructuredTextParity, assertTargetArtifactSafe, authenticatedHttpTarget, beginTargetCredentialRedaction, buildOfficialConformanceArgs, buildOfficialConformanceEnvironment, checkHostCompatibility, createAuthenticatedConformanceProxy, createHostedAuthorizationFixtures, createMcpFnClientProfileSnapshot, createMcpFnScenario, createMcpFnScenarioArtifact, createMcpFnScenarioReport, createMcpFnTargetSuiteJUnit, diffMcpFnClientProfileSnapshots, disposeMcpFnTargetSuiteReport, normalizeMcpFnReportFailure, redactRemoteCredential, redactTargetCredentials, runAuthenticatedOfficialConformance, runHostedAuthorizationRegression, runMcpFnClientProfileContracts, runMcpFnTargetSuite, runOfficialConformance, runScenarios, serializeMcpFnTargetSuiteReport, stableJson, staticRemoteCredentialProvider, validateMcpFnClientProfileSnapshot, validateMcpFnScenarios, validateMcpFnSchemaPortability, validateRemoteCredentialHeaders };
|