@frontmcp/testing 0.7.2 → 0.8.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/auth/index.d.ts +2 -0
- package/auth/index.d.ts.map +1 -1
- package/auth/mock-cimd-server.d.ts +174 -0
- package/auth/mock-cimd-server.d.ts.map +1 -0
- package/auth/mock-oauth-server.d.ts +136 -6
- package/auth/mock-oauth-server.d.ts.map +1 -1
- package/auth/token-factory.d.ts.map +1 -1
- package/client/index.d.ts +1 -1
- package/client/index.d.ts.map +1 -1
- package/client/mcp-test-client.builder.d.ts +12 -0
- package/client/mcp-test-client.builder.d.ts.map +1 -1
- package/client/mcp-test-client.d.ts +48 -2
- package/client/mcp-test-client.d.ts.map +1 -1
- package/client/mcp-test-client.types.d.ts +60 -0
- package/client/mcp-test-client.types.d.ts.map +1 -1
- package/esm/fixtures/index.mjs +661 -83
- package/esm/index.mjs +3245 -219
- package/esm/package.json +5 -4
- package/esm/perf/index.mjs +4334 -0
- package/esm/perf/perf-setup.mjs +31 -0
- package/fixtures/fixture-types.d.ts +10 -1
- package/fixtures/fixture-types.d.ts.map +1 -1
- package/fixtures/index.js +661 -93
- package/fixtures/test-fixture.d.ts +1 -1
- package/fixtures/test-fixture.d.ts.map +1 -1
- package/index.d.ts +5 -1
- package/index.d.ts.map +1 -1
- package/index.js +3271 -219
- package/interceptor/interceptor-chain.d.ts +1 -0
- package/interceptor/interceptor-chain.d.ts.map +1 -1
- package/package.json +5 -4
- package/perf/baseline-store.d.ts +67 -0
- package/perf/baseline-store.d.ts.map +1 -0
- package/perf/index.d.ts +44 -0
- package/perf/index.d.ts.map +1 -0
- package/perf/index.js +4404 -0
- package/perf/jest-perf-reporter.d.ts +6 -0
- package/perf/jest-perf-reporter.d.ts.map +1 -0
- package/perf/leak-detector.d.ts +81 -0
- package/perf/leak-detector.d.ts.map +1 -0
- package/perf/metrics-collector.d.ts +83 -0
- package/perf/metrics-collector.d.ts.map +1 -0
- package/perf/perf-fixtures.d.ts +107 -0
- package/perf/perf-fixtures.d.ts.map +1 -0
- package/perf/perf-setup.d.ts +9 -0
- package/perf/perf-setup.d.ts.map +1 -0
- package/perf/perf-setup.js +50 -0
- package/perf/perf-test.d.ts +69 -0
- package/perf/perf-test.d.ts.map +1 -0
- package/perf/regression-detector.d.ts +55 -0
- package/perf/regression-detector.d.ts.map +1 -0
- package/perf/report-generator.d.ts +66 -0
- package/perf/report-generator.d.ts.map +1 -0
- package/perf/types.d.ts +439 -0
- package/perf/types.d.ts.map +1 -0
- package/platform/platform-client-info.d.ts +18 -0
- package/platform/platform-client-info.d.ts.map +1 -1
- package/server/index.d.ts +2 -0
- package/server/index.d.ts.map +1 -1
- package/server/port-registry.d.ts +179 -0
- package/server/port-registry.d.ts.map +1 -0
- package/server/test-server.d.ts +9 -5
- package/server/test-server.d.ts.map +1 -1
- package/transport/streamable-http.transport.d.ts +26 -0
- package/transport/streamable-http.transport.d.ts.map +1 -1
- package/transport/transport.interface.d.ts +9 -1
- package/transport/transport.interface.d.ts.map +1 -1
package/auth/index.d.ts
CHANGED
|
@@ -7,4 +7,6 @@ export type { CreateTokenOptions, TokenFactoryOptions } from './token-factory';
|
|
|
7
7
|
export { AuthHeaders } from './auth-headers';
|
|
8
8
|
export { TestUsers, createTestUser } from './user-fixtures';
|
|
9
9
|
export type { TestUserFixture } from './user-fixtures';
|
|
10
|
+
export { MockOAuthServer } from './mock-oauth-server';
|
|
11
|
+
export type { MockOAuthServerOptions, MockOAuthServerInfo, MockTestUser } from './mock-oauth-server';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
package/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file mock-cimd-server.ts
|
|
3
|
+
* @description Mock CIMD server for testing OAuth clients with CIMD support
|
|
4
|
+
*
|
|
5
|
+
* This module provides a mock HTTP server that serves CIMD (Client ID Metadata Documents)
|
|
6
|
+
* for testing OAuth flows with dynamic client metadata.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { MockCimdServer } from '@frontmcp/testing';
|
|
11
|
+
*
|
|
12
|
+
* const cimdServer = new MockCimdServer();
|
|
13
|
+
* const info = await cimdServer.start();
|
|
14
|
+
*
|
|
15
|
+
* // Register a client
|
|
16
|
+
* const clientId = cimdServer.registerClient({
|
|
17
|
+
* name: 'Test Client',
|
|
18
|
+
* redirectUris: ['http://localhost:3000/callback'],
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Use clientId in OAuth flow
|
|
22
|
+
* // client_id = http://localhost:PORT/clients/test-client/metadata.json
|
|
23
|
+
*
|
|
24
|
+
* await cimdServer.stop();
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Options for registering a mock CIMD client
|
|
29
|
+
*/
|
|
30
|
+
export interface MockCimdClientOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Human-readable name for the client.
|
|
33
|
+
* Also used to generate the URL path if not provided.
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Custom path for the metadata endpoint.
|
|
38
|
+
* If not provided, derived from name (e.g., "Test Client" -> "test-client")
|
|
39
|
+
*/
|
|
40
|
+
path?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Redirect URIs for the client.
|
|
43
|
+
* @default ['http://localhost:3000/callback']
|
|
44
|
+
*/
|
|
45
|
+
redirectUris?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Token endpoint authentication method.
|
|
48
|
+
* @default 'none'
|
|
49
|
+
*/
|
|
50
|
+
tokenEndpointAuthMethod?: 'none' | 'client_secret_basic' | 'client_secret_post' | 'private_key_jwt';
|
|
51
|
+
/**
|
|
52
|
+
* OAuth grant types the client can use.
|
|
53
|
+
* @default ['authorization_code']
|
|
54
|
+
*/
|
|
55
|
+
grantTypes?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* OAuth response types the client can request.
|
|
58
|
+
* @default ['code']
|
|
59
|
+
*/
|
|
60
|
+
responseTypes?: string[];
|
|
61
|
+
/**
|
|
62
|
+
* URL of the client's home page.
|
|
63
|
+
*/
|
|
64
|
+
clientUri?: string;
|
|
65
|
+
/**
|
|
66
|
+
* URL of the client's logo image.
|
|
67
|
+
*/
|
|
68
|
+
logoUri?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Requested OAuth scopes (space-separated).
|
|
71
|
+
*/
|
|
72
|
+
scope?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Contact emails for the client.
|
|
75
|
+
*/
|
|
76
|
+
contacts?: string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Server configuration options
|
|
80
|
+
*/
|
|
81
|
+
export interface MockCimdServerOptions {
|
|
82
|
+
/**
|
|
83
|
+
* Port to listen on (default: random available port)
|
|
84
|
+
*/
|
|
85
|
+
port?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Enable debug logging
|
|
88
|
+
*/
|
|
89
|
+
debug?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Server info returned after start
|
|
93
|
+
*/
|
|
94
|
+
export interface MockCimdServerInfo {
|
|
95
|
+
/**
|
|
96
|
+
* Base URL of the server
|
|
97
|
+
*/
|
|
98
|
+
baseUrl: string;
|
|
99
|
+
/**
|
|
100
|
+
* Port the server is listening on
|
|
101
|
+
*/
|
|
102
|
+
port: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Mock server for CIMD (Client ID Metadata Documents) testing.
|
|
106
|
+
*
|
|
107
|
+
* Serves client metadata documents at configurable paths, allowing
|
|
108
|
+
* testing of OAuth flows with dynamic client registration via CIMD.
|
|
109
|
+
*/
|
|
110
|
+
export declare class MockCimdServer {
|
|
111
|
+
private readonly options;
|
|
112
|
+
private server;
|
|
113
|
+
private _info;
|
|
114
|
+
/** Map of path -> client */
|
|
115
|
+
private clients;
|
|
116
|
+
/** Map of path -> custom response (for error testing) */
|
|
117
|
+
private customResponses;
|
|
118
|
+
constructor(options?: MockCimdServerOptions);
|
|
119
|
+
/**
|
|
120
|
+
* Start the mock CIMD server.
|
|
121
|
+
*/
|
|
122
|
+
start(): Promise<MockCimdServerInfo>;
|
|
123
|
+
/**
|
|
124
|
+
* Stop the mock CIMD server.
|
|
125
|
+
*/
|
|
126
|
+
stop(): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Get server info.
|
|
129
|
+
*/
|
|
130
|
+
get info(): MockCimdServerInfo;
|
|
131
|
+
/**
|
|
132
|
+
* Register a client and return its client_id URL.
|
|
133
|
+
*
|
|
134
|
+
* @param options - Client configuration
|
|
135
|
+
* @returns The client_id URL to use in OAuth flows
|
|
136
|
+
*/
|
|
137
|
+
registerClient(options: MockCimdClientOptions): string;
|
|
138
|
+
/**
|
|
139
|
+
* Get the client_id URL for a previously registered client.
|
|
140
|
+
*
|
|
141
|
+
* @param name - The client name used during registration
|
|
142
|
+
* @returns The client_id URL
|
|
143
|
+
*/
|
|
144
|
+
getClientId(name: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Register an invalid document for error testing.
|
|
147
|
+
*
|
|
148
|
+
* @param path - The path to serve the invalid document at
|
|
149
|
+
* @param document - The invalid document content
|
|
150
|
+
*/
|
|
151
|
+
registerInvalidDocument(path: string, document: unknown): void;
|
|
152
|
+
/**
|
|
153
|
+
* Register a custom error response for a path.
|
|
154
|
+
*
|
|
155
|
+
* @param path - The path to return the error at
|
|
156
|
+
* @param statusCode - HTTP status code to return
|
|
157
|
+
* @param body - Optional response body
|
|
158
|
+
*/
|
|
159
|
+
registerFetchError(path: string, statusCode: number, body?: unknown): void;
|
|
160
|
+
/**
|
|
161
|
+
* Remove a registered client.
|
|
162
|
+
*
|
|
163
|
+
* @param name - The client name to remove
|
|
164
|
+
*/
|
|
165
|
+
removeClient(name: string): void;
|
|
166
|
+
/**
|
|
167
|
+
* Clear all registered clients and custom responses.
|
|
168
|
+
*/
|
|
169
|
+
clear(): void;
|
|
170
|
+
private handleRequest;
|
|
171
|
+
private nameToPath;
|
|
172
|
+
private log;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=mock-cimd-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-cimd-server.d.ts","sourceRoot":"","sources":["../../src/auth/mock-cimd-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA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CAAC,IAAI,CAAC;IAoB3B;;OAEG;IACH,IAAI,IAAI,IAAI,kBAAkB,CAK7B;IAED;;;;;OAKG;IACH,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IA4BtD;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAgBjC;;;;;OAKG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI;IAiB9D;;;;;;OAMG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAM1E;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAOhC;;OAEG;IACH,KAAK,IAAI,IAAI;IAUb,OAAO,CAAC,aAAa;IAkDrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,GAAG;CAKZ"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file mock-oauth-server.ts
|
|
3
|
-
* @description Mock OAuth server for testing transparent auth
|
|
3
|
+
* @description Mock OAuth server for testing transparent and orchestrated auth modes
|
|
4
4
|
*
|
|
5
5
|
* This module provides a mock OAuth/OIDC server that serves:
|
|
6
6
|
* - JWKS endpoint for token verification
|
|
7
|
-
* - OAuth metadata endpoint
|
|
8
|
-
* -
|
|
7
|
+
* - OAuth metadata endpoint
|
|
8
|
+
* - Authorization endpoint (with auto-approve for E2E tests)
|
|
9
|
+
* - Token endpoint (supports authorization_code, refresh_token, anonymous)
|
|
10
|
+
* - UserInfo endpoint
|
|
9
11
|
*
|
|
10
|
-
* @example
|
|
12
|
+
* @example Basic usage
|
|
11
13
|
* ```typescript
|
|
12
14
|
* import { MockOAuthServer, TestTokenFactory } from '@frontmcp/testing';
|
|
13
15
|
*
|
|
@@ -26,8 +28,38 @@
|
|
|
26
28
|
* // Stop when done
|
|
27
29
|
* await oauthServer.stop();
|
|
28
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example Authorization code flow (E2E testing)
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const oauthServer = new MockOAuthServer(tokenFactory, {
|
|
35
|
+
* autoApprove: true,
|
|
36
|
+
* testUser: { sub: 'user-123', email: 'test@example.com' },
|
|
37
|
+
* clientId: 'my-client',
|
|
38
|
+
* validRedirectUris: ['http://localhost:3000/callback'],
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* await oauthServer.start();
|
|
42
|
+
*
|
|
43
|
+
* // User visits /oauth/authorize → automatically redirects back with code
|
|
44
|
+
* // Token exchange happens automatically
|
|
45
|
+
* ```
|
|
29
46
|
*/
|
|
30
47
|
import type { TestTokenFactory } from './token-factory';
|
|
48
|
+
/**
|
|
49
|
+
* Test user configuration for mock OAuth server
|
|
50
|
+
*/
|
|
51
|
+
export interface MockTestUser {
|
|
52
|
+
/** Subject identifier */
|
|
53
|
+
sub: string;
|
|
54
|
+
/** User email */
|
|
55
|
+
email?: string;
|
|
56
|
+
/** Display name */
|
|
57
|
+
name?: string;
|
|
58
|
+
/** Profile picture URL */
|
|
59
|
+
picture?: string;
|
|
60
|
+
/** Additional claims to include in tokens */
|
|
61
|
+
claims?: Record<string, unknown>;
|
|
62
|
+
}
|
|
31
63
|
export interface MockOAuthServerOptions {
|
|
32
64
|
/** Port to listen on (default: random available port) */
|
|
33
65
|
port?: number;
|
|
@@ -35,6 +67,20 @@ export interface MockOAuthServerOptions {
|
|
|
35
67
|
issuer?: string;
|
|
36
68
|
/** Enable debug logging */
|
|
37
69
|
debug?: boolean;
|
|
70
|
+
/** Auto-approve authorization requests (for E2E testing) */
|
|
71
|
+
autoApprove?: boolean;
|
|
72
|
+
/** Test user to return on authorization (required if autoApprove is true) */
|
|
73
|
+
testUser?: MockTestUser;
|
|
74
|
+
/** Expected client ID for validation */
|
|
75
|
+
clientId?: string;
|
|
76
|
+
/** Expected client secret (optional, for confidential clients) */
|
|
77
|
+
clientSecret?: string;
|
|
78
|
+
/** Allowed redirect URIs (supports wildcards like http://localhost:*) */
|
|
79
|
+
validRedirectUris?: string[];
|
|
80
|
+
/** Access token TTL in seconds (default: 3600) */
|
|
81
|
+
accessTokenTtlSeconds?: number;
|
|
82
|
+
/** Refresh token TTL in seconds (default: 30 days) */
|
|
83
|
+
refreshTokenTtlSeconds?: number;
|
|
38
84
|
}
|
|
39
85
|
export interface MockOAuthServerInfo {
|
|
40
86
|
/** Base URL of the server */
|
|
@@ -47,18 +93,45 @@ export interface MockOAuthServerInfo {
|
|
|
47
93
|
jwksUrl: string;
|
|
48
94
|
}
|
|
49
95
|
/**
|
|
50
|
-
* Mock OAuth/OIDC server for testing transparent auth
|
|
96
|
+
* Mock OAuth/OIDC server for testing transparent and orchestrated auth modes
|
|
51
97
|
*
|
|
52
98
|
* Serves JWKS from a TestTokenFactory so that MCP servers can
|
|
53
99
|
* validate test tokens without connecting to a real IdP.
|
|
100
|
+
*
|
|
101
|
+
* Supports full authorization code flow with PKCE for E2E testing
|
|
102
|
+
* of orchestrated multi-provider authentication.
|
|
54
103
|
*/
|
|
55
104
|
export declare class MockOAuthServer {
|
|
56
105
|
private readonly tokenFactory;
|
|
57
|
-
private
|
|
106
|
+
private options;
|
|
58
107
|
private server;
|
|
59
108
|
private _info;
|
|
60
109
|
private connections;
|
|
110
|
+
/** Authorization code storage (code -> record) */
|
|
111
|
+
private authCodes;
|
|
112
|
+
/** Refresh token storage (token -> record) */
|
|
113
|
+
private refreshTokens;
|
|
114
|
+
/** Access token TTL in seconds */
|
|
115
|
+
private readonly accessTokenTtlSeconds;
|
|
116
|
+
/** Refresh token TTL in seconds */
|
|
117
|
+
private readonly refreshTokenTtlSeconds;
|
|
61
118
|
constructor(tokenFactory: TestTokenFactory, options?: MockOAuthServerOptions);
|
|
119
|
+
/**
|
|
120
|
+
* Set auto-approve mode for authorization requests
|
|
121
|
+
*/
|
|
122
|
+
setAutoApprove(enabled: boolean): void;
|
|
123
|
+
/**
|
|
124
|
+
* Set the test user returned on authorization
|
|
125
|
+
*/
|
|
126
|
+
setTestUser(user: MockTestUser): void;
|
|
127
|
+
/**
|
|
128
|
+
* Add a valid redirect URI
|
|
129
|
+
*/
|
|
130
|
+
addValidRedirectUri(uri: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Clear all stored authorization codes and refresh tokens
|
|
133
|
+
*/
|
|
134
|
+
clearStoredTokens(): void;
|
|
62
135
|
/**
|
|
63
136
|
* Start the mock OAuth server
|
|
64
137
|
*/
|
|
@@ -79,8 +152,65 @@ export declare class MockOAuthServer {
|
|
|
79
152
|
private handleJwks;
|
|
80
153
|
private handleOidcConfig;
|
|
81
154
|
private handleOAuthMetadata;
|
|
155
|
+
/**
|
|
156
|
+
* Handle authorization endpoint (GET /oauth/authorize)
|
|
157
|
+
* Supports auto-approve mode for E2E testing
|
|
158
|
+
*/
|
|
159
|
+
private handleAuthorizeEndpoint;
|
|
82
160
|
private handleTokenEndpoint;
|
|
161
|
+
/**
|
|
162
|
+
* Handle authorization_code grant type
|
|
163
|
+
*/
|
|
164
|
+
private handleAuthorizationCodeGrant;
|
|
165
|
+
/**
|
|
166
|
+
* Handle refresh_token grant type
|
|
167
|
+
*/
|
|
168
|
+
private handleRefreshTokenGrant;
|
|
169
|
+
/**
|
|
170
|
+
* Handle userinfo endpoint (GET /userinfo)
|
|
171
|
+
*/
|
|
172
|
+
private handleUserInfoEndpoint;
|
|
173
|
+
/**
|
|
174
|
+
* Handle authorize form submission (POST /oauth/authorize/submit)
|
|
175
|
+
* Processes the manual login form for non-autoApprove testing
|
|
176
|
+
*/
|
|
177
|
+
private handleAuthorizeSubmit;
|
|
83
178
|
private readBody;
|
|
84
179
|
private log;
|
|
180
|
+
private logError;
|
|
181
|
+
/**
|
|
182
|
+
* Validate redirect URI against configured valid URIs
|
|
183
|
+
* Supports wildcards for port (e.g., http://localhost:*)
|
|
184
|
+
*/
|
|
185
|
+
private isValidRedirectUri;
|
|
186
|
+
/**
|
|
187
|
+
* Safe string-based wildcard matching (O(n) complexity)
|
|
188
|
+
* Avoids regex to prevent ReDoS vulnerabilities
|
|
189
|
+
*/
|
|
190
|
+
private matchWildcardPattern;
|
|
191
|
+
/**
|
|
192
|
+
* Redirect with OAuth error
|
|
193
|
+
*/
|
|
194
|
+
private redirectWithError;
|
|
195
|
+
/**
|
|
196
|
+
* Generate a random authorization code
|
|
197
|
+
*/
|
|
198
|
+
private generateCodeAsync;
|
|
199
|
+
/**
|
|
200
|
+
* Generate a random authorization code (sync wrapper for compatibility)
|
|
201
|
+
*/
|
|
202
|
+
private generateCode;
|
|
203
|
+
/**
|
|
204
|
+
* Compute PKCE code challenge from verifier
|
|
205
|
+
*/
|
|
206
|
+
private computeCodeChallengeAsync;
|
|
207
|
+
/**
|
|
208
|
+
* Render a simple login page for manual testing
|
|
209
|
+
*/
|
|
210
|
+
private renderLoginPage;
|
|
211
|
+
/**
|
|
212
|
+
* Escape HTML to prevent XSS
|
|
213
|
+
*/
|
|
214
|
+
private escapeHtml;
|
|
85
215
|
}
|
|
86
216
|
//# sourceMappingURL=mock-oauth-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-oauth-server.d.ts","sourceRoot":"","sources":["../../src/auth/mock-oauth-server.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mock-oauth-server.d.ts","sourceRoot":"","sources":["../../src/auth/mock-oauth-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAoBxD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,IAAI,CAAC,EAAE,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{"version":3,"file":"token-factory.d.ts","sourceRoot":"","sources":["../../src/auth/token-factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAwD,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAMtF,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe;IACf,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,GAAG,CAAoB;IAC/B,OAAO,CAAC,KAAK,CAAS;gBAEV,OAAO,GAAE,mBAAwB;IAM7C;;OAEG;YACW,UAAU;IAkBxB;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"token-factory.d.ts","sourceRoot":"","sources":["../../src/auth/token-factory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAwD,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAMtF,MAAM,WAA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AAM,CAAC;IAwBnF;;OAEG;IACH,+BAA+B,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,GAAG,MAAM;IAqBjF;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAU/C;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,WAAW,IAAI,MAAM;CAGtB"}
|
package/client/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { McpTestClient } from './mcp-test-client';
|
|
6
6
|
export { McpTestClientBuilder } from './mcp-test-client.builder';
|
|
7
|
-
export type { McpTestClientConfig, McpResponse, McpErrorInfo, TestTransportType, TestAuthConfig, ToolResultWrapper, ResourceContentWrapper, PromptResultWrapper, LogEntry, LogLevel, RequestTrace, NotificationEntry, ProgressUpdate, SessionInfo, AuthState, TransportState, JSONRPCRequest, JSONRPCResponse, InitializeResult, ListToolsResult, CallToolResult, ListResourcesResult, ReadResourceResult, ListResourceTemplatesResult, ListPromptsResult, GetPromptResult, Tool, Resource, ResourceTemplate, Prompt, } from './mcp-test-client.types';
|
|
7
|
+
export type { McpTestClientConfig, McpResponse, McpErrorInfo, TestTransportType, TestAuthConfig, ToolResultWrapper, ResourceContentWrapper, PromptResultWrapper, LogEntry, LogLevel, RequestTrace, NotificationEntry, ProgressUpdate, SessionInfo, AuthState, TransportState, JSONRPCRequest, JSONRPCResponse, ElicitationCreateRequest, ElicitResponse, ElicitationHandler, InitializeResult, ListToolsResult, CallToolResult, ListResourcesResult, ReadResourceResult, ListResourceTemplatesResult, ListPromptsResult, GetPromptResult, Tool, Resource, ResourceTemplate, Prompt, } from './mcp-test-client.types';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/client/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,EAEd,cAAc,EACd,eAAe,EAEf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,MAAM,GACP,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,EAEd,cAAc,EACd,eAAe,EAEf,wBAAwB,EACxB,cAAc,EACd,kBAAkB,EAElB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,MAAM,GACP,MAAM,yBAAyB,CAAC"}
|
|
@@ -103,6 +103,18 @@ export declare class McpTestClientBuilder {
|
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
105
|
withCapabilities(capabilities: TestClientCapabilities): this;
|
|
106
|
+
/**
|
|
107
|
+
* Set query parameters to append to the connection URL.
|
|
108
|
+
* Useful for testing mode switches like `?mode=skills_only`.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const client = await McpTestClient.create({ baseUrl })
|
|
113
|
+
* .withQueryParams({ mode: 'skills_only' })
|
|
114
|
+
* .buildAndConnect();
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
withQueryParams(params: Record<string, string>): this;
|
|
106
118
|
/**
|
|
107
119
|
* Build the McpTestClient instance (does not connect)
|
|
108
120
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-test-client.builder.d.ts","sourceRoot":"","sources":["../../src/client/mcp-test-client.builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIvC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAKpC;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK9B;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAQlD;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAKjD;;OAEG;IACH,WAAW,CAA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,GAAG,IAAI;IAQlD;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI;IAKjD;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKpC;;OAEG;IACH,SAAS,CAAC,OAAO,UAAO,GAAG,IAAI;IAK/B;;;;OAIG;IACH,cAAc,CAAC,OAAO,UAAO,GAAG,IAAI;IAKpC;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK1C;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAK7D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAS9C;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;IAK5D;;;;;;;;;;OAUG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAKrD;;OAEG;IACH,KAAK,IAAI,aAAa;IAItB;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,aAAa,CAAC;CAKhD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file mcp-test-client.ts
|
|
3
3
|
* @description Main MCP Test Client implementation for E2E testing
|
|
4
4
|
*/
|
|
5
|
-
import type { McpTestClientConfig, TestTransportType, ToolResultWrapper, ResourceContentWrapper, PromptResultWrapper, LogEntry, RequestTrace, NotificationEntry, ProgressUpdate, SessionInfo, AuthState, InitializeResult, Tool, Resource, ResourceTemplate, Prompt, JSONRPCResponse } from './mcp-test-client.types';
|
|
5
|
+
import type { McpTestClientConfig, TestTransportType, ToolResultWrapper, ResourceContentWrapper, PromptResultWrapper, LogEntry, RequestTrace, NotificationEntry, ProgressUpdate, SessionInfo, AuthState, InitializeResult, Tool, Resource, ResourceTemplate, Prompt, JSONRPCResponse, ElicitationHandler } from './mcp-test-client.types';
|
|
6
6
|
import { McpTestClientBuilder } from './mcp-test-client.builder';
|
|
7
7
|
import type { MockDefinition, MockHandle, RequestInterceptor, ResponseInterceptor } from '../interceptor';
|
|
8
8
|
export declare class McpTestClient {
|
|
@@ -19,6 +19,7 @@ export declare class McpTestClient {
|
|
|
19
19
|
private _notifications;
|
|
20
20
|
private _progressUpdates;
|
|
21
21
|
private _interceptors;
|
|
22
|
+
private _elicitationHandler?;
|
|
22
23
|
constructor(config: McpTestClientConfig);
|
|
23
24
|
/**
|
|
24
25
|
* Create a new McpTestClientBuilder for fluent configuration
|
|
@@ -166,6 +167,48 @@ export declare class McpTestClient {
|
|
|
166
167
|
*/
|
|
167
168
|
send: (method: string, params?: Record<string, unknown>) => Promise<void>;
|
|
168
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* Register a handler for elicitation requests from the server.
|
|
172
|
+
*
|
|
173
|
+
* When a tool calls `this.elicit()` during execution, the server sends an
|
|
174
|
+
* `elicitation/create` request to the client. This handler is called to
|
|
175
|
+
* provide the response that would normally come from user interaction.
|
|
176
|
+
*
|
|
177
|
+
* @param handler - Function that receives the elicitation request and returns a response
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* // Simple acceptance
|
|
182
|
+
* mcp.onElicitation(async () => ({
|
|
183
|
+
* action: 'accept',
|
|
184
|
+
* content: { confirmed: true }
|
|
185
|
+
* }));
|
|
186
|
+
*
|
|
187
|
+
* // Conditional response based on request
|
|
188
|
+
* mcp.onElicitation(async (request) => {
|
|
189
|
+
* if (request.message.includes('delete')) {
|
|
190
|
+
* return { action: 'decline' };
|
|
191
|
+
* }
|
|
192
|
+
* return { action: 'accept', content: { approved: true } };
|
|
193
|
+
* });
|
|
194
|
+
*
|
|
195
|
+
* // Multi-step wizard
|
|
196
|
+
* let step = 0;
|
|
197
|
+
* mcp.onElicitation(async () => {
|
|
198
|
+
* step++;
|
|
199
|
+
* if (step === 1) return { action: 'accept', content: { name: 'Alice' } };
|
|
200
|
+
* return { action: 'accept', content: { color: 'blue' } };
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
onElicitation(handler: ElicitationHandler): void;
|
|
205
|
+
/**
|
|
206
|
+
* Clear the elicitation handler.
|
|
207
|
+
*
|
|
208
|
+
* After calling this, elicitation requests from the server will not be
|
|
209
|
+
* handled automatically. This can be used to test timeout scenarios.
|
|
210
|
+
*/
|
|
211
|
+
clearElicitationHandler(): void;
|
|
169
212
|
readonly logs: {
|
|
170
213
|
all: () => LogEntry[];
|
|
171
214
|
filter: (level: "debug" | "info" | "warn" | "error") => LogEntry[];
|
|
@@ -333,7 +376,10 @@ export declare class McpTestClient {
|
|
|
333
376
|
private getPrompt;
|
|
334
377
|
private createTransport;
|
|
335
378
|
private request;
|
|
336
|
-
|
|
379
|
+
/**
|
|
380
|
+
* Get the transport, throwing if not connected.
|
|
381
|
+
*/
|
|
382
|
+
private getConnectedTransport;
|
|
337
383
|
private updateSessionActivity;
|
|
338
384
|
private wrapToolResult;
|
|
339
385
|
private wrapResourceContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-test-client.d.ts","sourceRoot":"","sources":["../../src/client/mcp-test-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EAEnB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"mcp-test-client.d.ts","sourceRoot":"","sources":["../../src/client/mcp-test-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EAEnB,iBAAiB,EAEjB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,SAAS,EAET,gBAAgB,EAQhB,IAAI,EACJ,QAAQ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AAmB;IAgC3B,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,GAAG;IAcX,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,gBAAgB;CAUzB;AAMD,cAAM,qBAAqB;IACb,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,iBAAiB,EAAE;IAE/D,IAAI,QAAQ,IAAI,iBAAiB,EAAE,CAElC;IAED,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAItB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAS7E;AAED,cAAM,iBAAiB;IACT,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc,EAAE;IAEtD,IAAI,GAAG,IAAI,cAAc,EAAE,CAE1B;IAEK,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWxD"}
|
|
@@ -63,6 +63,24 @@ export interface ExperimentalCapabilities {
|
|
|
63
63
|
/** Other experimental capabilities */
|
|
64
64
|
[key: string]: unknown;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Form elicitation capability options.
|
|
68
|
+
*/
|
|
69
|
+
export interface FormElicitationCapability {
|
|
70
|
+
/** Whether to apply default values from the schema */
|
|
71
|
+
applyDefaults?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Elicitation capabilities for interactive user input.
|
|
75
|
+
* Enables servers to request user input during tool execution.
|
|
76
|
+
* Note: MCP SDK expects form/url to be objects, not booleans.
|
|
77
|
+
*/
|
|
78
|
+
export interface ElicitationCapabilities {
|
|
79
|
+
/** Support for form-based elicitation (inline forms) - use empty object {} to enable */
|
|
80
|
+
form?: FormElicitationCapability | Record<string, unknown>;
|
|
81
|
+
/** Support for URL-based elicitation (external forms) - use empty object {} to enable */
|
|
82
|
+
url?: Record<string, unknown>;
|
|
83
|
+
}
|
|
66
84
|
/**
|
|
67
85
|
* Client capabilities sent during MCP initialization.
|
|
68
86
|
* These capabilities enable platform-specific detection and features.
|
|
@@ -70,6 +88,8 @@ export interface ExperimentalCapabilities {
|
|
|
70
88
|
export interface TestClientCapabilities {
|
|
71
89
|
/** Sampling capabilities */
|
|
72
90
|
sampling?: Record<string, unknown>;
|
|
91
|
+
/** Elicitation capabilities for interactive user input */
|
|
92
|
+
elicitation?: ElicitationCapabilities;
|
|
73
93
|
/** Experimental capabilities including MCP Apps extension */
|
|
74
94
|
experimental?: ExperimentalCapabilities;
|
|
75
95
|
}
|
|
@@ -118,6 +138,16 @@ export interface McpTestClientConfig {
|
|
|
118
138
|
* - Others: Uses frontmcp/* + ui/* keys for compatibility
|
|
119
139
|
*/
|
|
120
140
|
platform?: TestPlatformType;
|
|
141
|
+
/**
|
|
142
|
+
* Query parameters to append to the connection URL.
|
|
143
|
+
* Useful for testing mode switches like `?mode=skills_only`.
|
|
144
|
+
*
|
|
145
|
+
* Example:
|
|
146
|
+
* ```typescript
|
|
147
|
+
* queryParams: { mode: 'skills_only' }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
queryParams?: Record<string, string>;
|
|
121
151
|
}
|
|
122
152
|
export interface McpResponse<T> {
|
|
123
153
|
/** Whether the request succeeded */
|
|
@@ -274,5 +304,35 @@ export interface AuthState {
|
|
|
274
304
|
name?: string;
|
|
275
305
|
};
|
|
276
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Elicitation request from server to client.
|
|
309
|
+
* Sent when a tool needs interactive user input during execution.
|
|
310
|
+
*/
|
|
311
|
+
export interface ElicitationCreateRequest {
|
|
312
|
+
/** Mode of elicitation: 'form' for structured input, 'url' for redirect */
|
|
313
|
+
mode: 'form' | 'url';
|
|
314
|
+
/** Message to display to the user */
|
|
315
|
+
message: string;
|
|
316
|
+
/** JSON Schema for the expected response (form mode) */
|
|
317
|
+
requestedSchema?: Record<string, unknown>;
|
|
318
|
+
/** URL for out-of-band interaction (url mode) */
|
|
319
|
+
url?: string;
|
|
320
|
+
/** Unique identifier for tracking (url mode) */
|
|
321
|
+
elicitationId?: string;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Response from client to elicitation request.
|
|
325
|
+
*/
|
|
326
|
+
export interface ElicitResponse {
|
|
327
|
+
/** User's action: 'accept' (submitted), 'cancel', or 'decline' */
|
|
328
|
+
action: 'accept' | 'cancel' | 'decline';
|
|
329
|
+
/** Content submitted by user (only when action is 'accept') */
|
|
330
|
+
content?: Record<string, unknown>;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Handler function for elicitation requests.
|
|
334
|
+
* Called when the server requests interactive input during tool execution.
|
|
335
|
+
*/
|
|
336
|
+
export type ElicitationHandler = (request: ElicitationCreateRequest) => Promise<ElicitResponse> | ElicitResponse;
|
|
277
337
|
export type { InitializeResult, ListToolsResult, CallToolResult, ListResourcesResult, ReadResourceResult, ListResourceTemplatesResult, ListPromptsResult, GetPromptResult, Tool, Resource, ResourceTemplate, Prompt, };
|
|
278
338
|
//# sourceMappingURL=mcp-test-client.types.d.ts.map
|