@nest-mcp/client 1.0.2 → 2.0.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/CHANGELOG.md +139 -0
- package/README.md +845 -69
- package/dist/ai-sdk/index.d.mts +14 -0
- package/dist/ai-sdk/index.d.mts.map +1 -0
- package/dist/ai-sdk/index.mjs +27 -0
- package/dist/ai-sdk/index.mjs.map +1 -0
- package/dist/bootstrap-BIAcDnHp.d.mts +394 -0
- package/dist/bootstrap-BIAcDnHp.d.mts.map +1 -0
- package/dist/index.d.mts +480 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1960 -0
- package/dist/index.mjs.map +1 -0
- package/dist/oauth/dynamic-registration.d.mts +92 -0
- package/dist/oauth/dynamic-registration.d.mts.map +1 -0
- package/dist/oauth/dynamic-registration.mjs +392 -0
- package/dist/oauth/dynamic-registration.mjs.map +1 -0
- package/dist/oauth/index.d.mts +422 -0
- package/dist/oauth/index.d.mts.map +1 -0
- package/dist/oauth/index.mjs +3349 -0
- package/dist/oauth/index.mjs.map +1 -0
- package/dist/scope-CxGBCDdr.mjs +22 -0
- package/dist/scope-CxGBCDdr.mjs.map +1 -0
- package/package.json +76 -50
- package/scripts/external-smoke.mjs +693 -0
- package/dist/decorators/inject-mcp-client.decorator.d.ts +0 -3
- package/dist/decorators/inject-mcp-client.decorator.js +0 -12
- package/dist/decorators/on-notification.decorator.d.ts +0 -7
- package/dist/decorators/on-notification.decorator.js +0 -13
- package/dist/health/mcp-client.health.d.ts +0 -20
- package/dist/health/mcp-client.health.js +0 -42
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -64
- package/dist/interfaces/client-options.interface.d.ts +0 -139
- package/dist/interfaces/client-options.interface.js +0 -3
- package/dist/mcp-client.module.d.ts +0 -20
- package/dist/mcp-client.module.js +0 -188
- package/dist/mcp-client.service.d.ts +0 -558
- package/dist/mcp-client.service.js +0 -532
- package/dist/mcp-clients.service.d.ts +0 -39
- package/dist/mcp-clients.service.js +0 -104
- package/dist/testing/mock-client.d.ts +0 -67
- package/dist/testing/mock-client.js +0 -154
- package/dist/transport/apply-auth-headers.d.ts +0 -3
- package/dist/transport/apply-auth-headers.js +0 -13
- package/dist/transport/client-transport.factory.d.ts +0 -4
- package/dist/transport/client-transport.factory.js +0 -21
- package/dist/transport/sse-client.transport.d.ts +0 -4
- package/dist/transport/sse-client.transport.js +0 -15
- package/dist/transport/stdio-client.transport.d.ts +0 -4
- package/dist/transport/stdio-client.transport.js +0 -14
- package/dist/transport/streamable-client.transport.d.ts +0 -4
- package/dist/transport/streamable-client.transport.js +0 -17
- package/dist/utils/format-error-message.d.ts +0 -2
- package/dist/utils/format-error-message.js +0 -7
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { AddClientAuthentication, AuthOptions, AuthProvider, AuthProvider as AuthProvider$1, AuthResult, AuthorizationServerMismatchError, CacheableRequestOptions, CallToolRequest, CallToolRequest as CallToolRequest$1, CallToolRequestOptions, CallToolRequestOptions as CallToolRequestOptions$1, CallToolResult, CallToolResult as CallToolResult$1, Client, Client as Client$1, ClientAuthMethod, ClientCredentialsProvider, ClientCredentialsProviderOptions, ClientOptions, ClientOptions as ClientOptions$1, CompleteRequest, CompleteRequest as CompleteRequest$1, CompleteResult, CompleteResult as CompleteResult$1, ConnectOptions, ConnectOptions as ConnectOptions$1, CrossAppAccessContext, CrossAppAccessProvider, CrossAppAccessProviderOptions, DiscoverResult, EmptyResult, EmptyResult as EmptyResult$1, FetchLike, FetchLike as FetchLike$1, GetPromptRequest, GetPromptRequest as GetPromptRequest$1, GetPromptResult, GetPromptResult as GetPromptResult$1, Implementation, InputRequest, InputRequests, InputRequiredOptions, InputRequiredResult, InputRequiredResult as InputRequiredResult$1, InputResponse, InputResponses, InputResponses as InputResponses$1, InsecureTokenEndpointError, InsufficientScopeError, IssuerMismatchError, ListPromptsRequest, ListPromptsResult, ListResourceTemplatesRequest, ListResourceTemplatesResult, ListResourcesRequest, ListResourcesResult, ListToolsRequest, ListToolsResult, LoggingLevel, LoggingLevel as LoggingLevel$1, LoggingOptions, McpSubscription, McpSubscription as McpSubscription$1, Middleware, Middleware as Middleware$1, Notification, Notification as Notification$1, NotificationOptions, NotificationOptions as NotificationOptions$1, OAuthClientFlowError, OAuthClientInformationContext, OAuthClientProvider, OAuthClientProvider as OAuthClientProvider$1, OAuthDiscoveryState, OAuthServerInfo, PriorDiscovery, PriorDiscovery as PriorDiscovery$1, PrivateKeyJwtProvider, PrivateKeyJwtProviderOptions, Prompt, ProtocolEra, ReadResourceRequest, ReadResourceRequest as ReadResourceRequest$1, ReadResourceResult, ReadResourceResult as ReadResourceResult$1, RegistrationRejectedError, Request, Request as Request$1, RequestLogger, RequestMethod, RequestMethod as RequestMethod$1, RequestOptions, RequestOptions as RequestOptions$1, RequestTypeMap, RequestTypeMap as RequestTypeMap$1, Resource, ResourceTemplateType, ResultTypeMap, ResultTypeMap as ResultTypeMap$1, ServerCapabilities, StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1, StaticPrivateKeyJwtProvider, StaticPrivateKeyJwtProviderOptions, StreamableHTTPClientTransport, StreamableHTTPClientTransport as StreamableHTTPClientTransport$1, StreamableHTTPClientTransportOptions, StreamableHTTPClientTransportOptions as StreamableHTTPClientTransportOptions$1, SubscribeRequest, SubscribeRequest as SubscribeRequest$1, SubscriptionFilter, SubscriptionFilter as SubscriptionFilter$1, Tool, Transport, Transport as Transport$1, UnauthorizedError, UnsubscribeRequest, UnsubscribeRequest as UnsubscribeRequest$1, applyMiddlewares, auth, createMiddleware, createPrivateKeyJwtAuth, discoverOAuthMetadata, discoverOAuthProtectedResourceMetadata, discoverOAuthServerInfo, isInputRequiredResult, refreshAuthorization, specTypeSchemas, withInputRequired, withLogging, withOAuth } from "@modelcontextprotocol/client";
|
|
2
|
+
import { StdioClientTransport, StdioClientTransport as StdioClientTransport$1, StdioServerParameters, StdioServerParameters as StdioServerParameters$1 } from "@modelcontextprotocol/client/stdio";
|
|
3
|
+
import { MaybePromise, McpAttributes, McpErrorDetails, McpLifecycleMiddlewareOptions, McpLifecycleObserver, McpOperationContext, McpOperationMiddleware, McpPassthroughMiddleware } from "@nest-mcp/core";
|
|
4
|
+
import { McpPassiveDiscoveryTarget } from "@nest-mcp/conformance";
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
|
+
//#region src/errors.d.ts
|
|
7
|
+
declare const MCP_CLIENT_RUNTIME_CLOSED: "MCP_CLIENT_RUNTIME_CLOSED";
|
|
8
|
+
declare const MCP_CLIENT_SERVER_EXISTS: "MCP_CLIENT_SERVER_EXISTS";
|
|
9
|
+
declare const MCP_CLIENT_SERVER_NOT_FOUND: "MCP_CLIENT_SERVER_NOT_FOUND";
|
|
10
|
+
declare const MCP_CLIENT_NOT_CONNECTED: "MCP_CLIENT_NOT_CONNECTED";
|
|
11
|
+
declare const MCP_CLIENT_SHUTDOWN_TIMEOUT: "MCP_CLIENT_SHUTDOWN_TIMEOUT";
|
|
12
|
+
declare const MCP_CLIENT_LEASE_MANAGER_CLOSED: "MCP_CLIENT_LEASE_MANAGER_CLOSED";
|
|
13
|
+
declare const MCP_CLIENT_LEASE_CAPACITY_EXCEEDED: "MCP_CLIENT_LEASE_CAPACITY_EXCEEDED";
|
|
14
|
+
declare const MCP_CLIENT_LEASE_RELEASE_MODE_CONFLICT: "MCP_CLIENT_LEASE_RELEASE_MODE_CONFLICT";
|
|
15
|
+
declare const MCP_CLIENT_LEASE_INVALIDATED: "MCP_CLIENT_LEASE_INVALIDATED";
|
|
16
|
+
type McpClientRuntimeErrorCode = typeof MCP_CLIENT_RUNTIME_CLOSED | typeof MCP_CLIENT_SERVER_EXISTS | typeof MCP_CLIENT_SERVER_NOT_FOUND | typeof MCP_CLIENT_NOT_CONNECTED | typeof MCP_CLIENT_SHUTDOWN_TIMEOUT;
|
|
17
|
+
type McpClientLeaseManagerErrorCode = typeof MCP_CLIENT_LEASE_MANAGER_CLOSED | typeof MCP_CLIENT_LEASE_CAPACITY_EXCEEDED | typeof MCP_CLIENT_LEASE_RELEASE_MODE_CONFLICT | typeof MCP_CLIENT_LEASE_INVALIDATED;
|
|
18
|
+
/** Base error for deterministic registry and lifecycle failures. */
|
|
19
|
+
declare class McpClientRuntimeError extends Error {
|
|
20
|
+
readonly code: McpClientRuntimeErrorCode;
|
|
21
|
+
readonly serverName?: string;
|
|
22
|
+
constructor(code: McpClientRuntimeErrorCode, message: string, serverName?: string);
|
|
23
|
+
}
|
|
24
|
+
/** Key-free error for deterministic lease-manager admission and lifecycle failures. */
|
|
25
|
+
declare class McpClientLeaseManagerError extends Error {
|
|
26
|
+
readonly code: McpClientLeaseManagerErrorCode;
|
|
27
|
+
constructor(code: McpClientLeaseManagerErrorCode, message: string);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/transport.d.ts
|
|
31
|
+
interface McpHttpClientTransportDefinition {
|
|
32
|
+
readonly kind: "http";
|
|
33
|
+
readonly url: string | URL;
|
|
34
|
+
/** Passed directly to the official Streamable HTTP transport. */
|
|
35
|
+
readonly authProvider?: AuthProvider$1 | OAuthClientProvider$1;
|
|
36
|
+
/** Base fetch implementation wrapped by `middleware`, when supplied. */
|
|
37
|
+
readonly fetch?: FetchLike$1;
|
|
38
|
+
/** Official fetch middleware composed with `applyMiddlewares`. */
|
|
39
|
+
readonly middleware?: readonly Middleware$1[];
|
|
40
|
+
readonly requestInit?: RequestInit;
|
|
41
|
+
readonly options?: Omit<StreamableHTTPClientTransportOptions$1, "authProvider" | "fetch" | "requestInit">;
|
|
42
|
+
}
|
|
43
|
+
interface McpStdioClientTransportDefinition {
|
|
44
|
+
readonly kind: "stdio";
|
|
45
|
+
readonly command: string;
|
|
46
|
+
readonly args?: readonly string[];
|
|
47
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
48
|
+
readonly stderr?: StdioServerParameters$1["stderr"];
|
|
49
|
+
readonly cwd?: string;
|
|
50
|
+
readonly maxBufferSize?: number;
|
|
51
|
+
}
|
|
52
|
+
type McpClientTransportDefinition = McpHttpClientTransportDefinition | McpStdioClientTransportDefinition;
|
|
53
|
+
interface McpClientTransportFactoryContext {
|
|
54
|
+
readonly serverName: string;
|
|
55
|
+
readonly signal: AbortSignal;
|
|
56
|
+
}
|
|
57
|
+
/** Injectable seam for custom, in-memory, and test transports. */
|
|
58
|
+
interface McpClientTransportFactory {
|
|
59
|
+
createTransport(definition: McpClientTransportDefinition, context: McpClientTransportFactoryContext): MaybePromise<Transport$1>;
|
|
60
|
+
}
|
|
61
|
+
/** Applies the official SDK's fetch-middleware composition semantics. */
|
|
62
|
+
declare function composeMcpFetchMiddleware(middleware: readonly Middleware$1[], baseFetch?: FetchLike$1): FetchLike$1;
|
|
63
|
+
/** Creates the official MCP v2 Streamable HTTP client transport. */
|
|
64
|
+
declare function createMcpHttpClientTransport(definition: McpHttpClientTransportDefinition): StreamableHTTPClientTransport$1;
|
|
65
|
+
/** Creates the official Node.js stdio transport. */
|
|
66
|
+
declare function createMcpStdioClientTransport(definition: McpStdioClientTransportDefinition): StdioClientTransport$1;
|
|
67
|
+
/** Creates one of the official transports from a discriminated definition. */
|
|
68
|
+
declare function createMcpClientTransport(definition: McpClientTransportDefinition): StreamableHTTPClientTransport$1 | StdioClientTransport$1;
|
|
69
|
+
/** Stateless transport factory used by runtimes that do not inject a custom factory. */
|
|
70
|
+
declare const defaultMcpClientTransportFactory: McpClientTransportFactory;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/types.d.ts
|
|
73
|
+
type McpClientConnectionState = "disconnected" | "connecting" | "connected" | "disconnecting" | "failed";
|
|
74
|
+
/** Official MCP tool shape returned by client discovery. */
|
|
75
|
+
type McpClientTool = Tool;
|
|
76
|
+
/** Official JSON Schema shape accepted for MCP tool input. */
|
|
77
|
+
type McpClientToolInputSchema = McpClientTool["inputSchema"];
|
|
78
|
+
/** Official JSON Schema shape accepted for MCP tool structured output. */
|
|
79
|
+
type McpClientToolOutputSchema = NonNullable<McpClientTool["outputSchema"]>;
|
|
80
|
+
/** An exact method/params pair accepted by the official protocol request funnel. */
|
|
81
|
+
type McpClientProtocolRequest<Method extends RequestMethod$1 = RequestMethod$1> = Method extends RequestMethod$1 ? {
|
|
82
|
+
readonly method: Method;
|
|
83
|
+
} & Omit<RequestTypeMap$1[Method], "method"> : never;
|
|
84
|
+
/** Official request methods eligible for operation-specific transforms. */
|
|
85
|
+
type McpClientRequestMethod = RequestMethod$1;
|
|
86
|
+
/** Recursive readonly view for detached transform input while preserving live control objects. */
|
|
87
|
+
type McpClientReadonly<Value> = Value extends AbortSignal ? Value : Value extends ((...arguments_: never[]) => unknown) ? Value : Value extends readonly unknown[] ? { readonly [Index in keyof Value]: McpClientReadonly<Value[Index]>; } : Value extends object ? { readonly [Key in keyof Value]: McpClientReadonly<Value[Key]>; } : Value;
|
|
88
|
+
type CompleteResultOptions<Options extends RequestOptions$1> = Omit<Options, "allowInputRequired"> & {
|
|
89
|
+
readonly allowInputRequired?: false | undefined;
|
|
90
|
+
};
|
|
91
|
+
/** Exact SDK option family associated with one transformable request method. */
|
|
92
|
+
type McpClientTransformOptions<Method extends McpClientRequestMethod> = Method extends "tools/call" ? CompleteResultOptions<CallToolRequestOptions$1> : Method extends "resources/read" ? CompleteResultOptions<CacheableRequestOptions> : Method extends "prompts/get" ? CompleteResultOptions<RequestOptions$1> : Method extends "tools/list" | "prompts/list" | "resources/list" | "resources/templates/list" ? CacheableRequestOptions : RequestOptions$1;
|
|
93
|
+
/** Exact middleware input for one official request method. */
|
|
94
|
+
type McpClientTransformInput<Method extends McpClientRequestMethod> = McpClientReadonly<{
|
|
95
|
+
readonly serverName: string;
|
|
96
|
+
readonly options?: McpClientTransformOptions<Method>;
|
|
97
|
+
} & McpClientProtocolRequest<Method>>;
|
|
98
|
+
/** Exact official result for one request method. */
|
|
99
|
+
type McpClientTransformResult<Method extends McpClientRequestMethod> = ResultTypeMap$1[Method];
|
|
100
|
+
/** Modern methods whose results may request another client-input round. */
|
|
101
|
+
type McpClientMrtrMethod = "prompts/get" | "resources/read" | "tools/call";
|
|
102
|
+
/** An official, method-keyed request that supports modern multi-round trips. */
|
|
103
|
+
type McpClientMrtrRequest<Method extends McpClientMrtrMethod = McpClientMrtrMethod> = RequestTypeMap$1[Method];
|
|
104
|
+
/**
|
|
105
|
+
* Per-leg request controls for manual MRTR calls.
|
|
106
|
+
*
|
|
107
|
+
* `allowInputRequired` is runtime-owned and always enabled by the manual APIs.
|
|
108
|
+
*/
|
|
109
|
+
type McpClientMrtrRequestOptions = Omit<RequestOptions$1, "allowInputRequired">;
|
|
110
|
+
/** The complete result or the official modern continuation payload. */
|
|
111
|
+
type McpClientMrtrResult<Schema extends StandardSchemaV1$1> = StandardSchemaV1$1.InferOutput<Schema> | InputRequiredResult$1;
|
|
112
|
+
/**
|
|
113
|
+
* A modern `subscriptions/listen` handle owned by this runtime.
|
|
114
|
+
*
|
|
115
|
+
* The handle remains structurally compatible with the official SDK handle,
|
|
116
|
+
* adds its logical server name, and is closed during server disconnect.
|
|
117
|
+
*/
|
|
118
|
+
interface McpClientSubscription extends McpSubscription$1 {
|
|
119
|
+
readonly serverName: string;
|
|
120
|
+
}
|
|
121
|
+
interface McpClientConfigurationContext {
|
|
122
|
+
readonly serverName: string;
|
|
123
|
+
readonly definition: McpClientServerDefinition;
|
|
124
|
+
}
|
|
125
|
+
type McpClientConfigurator = (client: Client$1, context: McpClientConfigurationContext) => MaybePromise<void>;
|
|
126
|
+
/** Complete configuration for one logical upstream MCP server. */
|
|
127
|
+
interface McpClientServerDefinition {
|
|
128
|
+
readonly name: string;
|
|
129
|
+
readonly transport: McpClientTransportDefinition;
|
|
130
|
+
readonly clientInfo?: Implementation;
|
|
131
|
+
readonly clientOptions?: ClientOptions$1;
|
|
132
|
+
readonly connectOptions?: ConnectOptions$1;
|
|
133
|
+
/**
|
|
134
|
+
* Cached discovery verdict. Reuse it only within the same authorization
|
|
135
|
+
* context; freshness remains the host application's responsibility.
|
|
136
|
+
*/
|
|
137
|
+
readonly prior?: PriorDiscovery$1;
|
|
138
|
+
/** Installs SDK handlers and callbacks before the transport is connected. */
|
|
139
|
+
readonly configureClient?: McpClientConfigurator;
|
|
140
|
+
readonly transportFactory?: McpClientTransportFactory;
|
|
141
|
+
readonly attributes?: McpAttributes;
|
|
142
|
+
}
|
|
143
|
+
interface McpSdkClientFactoryContext {
|
|
144
|
+
readonly serverName: string;
|
|
145
|
+
readonly definition: McpClientServerDefinition;
|
|
146
|
+
}
|
|
147
|
+
/** Injectable official Client constructor seam, primarily useful for testing. */
|
|
148
|
+
interface McpSdkClientFactory {
|
|
149
|
+
createClient(clientInfo: Implementation, options: ClientOptions$1, context: McpSdkClientFactoryContext): Client$1;
|
|
150
|
+
}
|
|
151
|
+
/** Stable operation envelope visible to client middleware. */
|
|
152
|
+
interface McpClientOperationInput {
|
|
153
|
+
readonly serverName: string;
|
|
154
|
+
readonly method: string;
|
|
155
|
+
readonly params?: unknown;
|
|
156
|
+
readonly options?: unknown;
|
|
157
|
+
}
|
|
158
|
+
type McpClientOperationContext<Principal = unknown> = McpOperationContext<Principal>;
|
|
159
|
+
/**
|
|
160
|
+
* Transforming client middleware retained for deliberate result replacement
|
|
161
|
+
* and successful short-circuiting. Prefer `McpClientPassthroughMiddleware`
|
|
162
|
+
* when the method-specific result should remain opaque.
|
|
163
|
+
*/
|
|
164
|
+
type McpClientMiddleware<Principal = unknown> = McpOperationMiddleware<McpClientOperationInput, unknown, McpClientOperationContext<Principal>>;
|
|
165
|
+
/** Transforming middleware scoped to one exact official request/result pair. */
|
|
166
|
+
type McpClientTransform<Method extends McpClientRequestMethod, Principal = unknown> = McpOperationMiddleware<McpClientTransformInput<Method>, McpClientTransformResult<Method>, McpClientOperationContext<Principal>>;
|
|
167
|
+
/**
|
|
168
|
+
* Result-opaque client middleware. Use this for cross-cutting concerns that
|
|
169
|
+
* must observe or delay an operation without replacing its method-specific
|
|
170
|
+
* result with an unrelated value.
|
|
171
|
+
*/
|
|
172
|
+
type McpClientPassthroughMiddleware<Principal = unknown> = McpPassthroughMiddleware<McpClientOperationInput, McpClientOperationContext<Principal>>;
|
|
173
|
+
type McpClientPrincipalResolver<Principal> = (operation: McpClientOperationInput) => MaybePromise<Principal | undefined>;
|
|
174
|
+
type McpClientAttributesResolver = (operation: McpClientOperationInput) => MaybePromise<McpAttributes>;
|
|
175
|
+
interface McpClientRuntimeOptions<Principal = unknown> {
|
|
176
|
+
readonly servers?: readonly McpClientServerDefinition[];
|
|
177
|
+
readonly clientInfo?: Implementation;
|
|
178
|
+
readonly clientFactory?: McpSdkClientFactory;
|
|
179
|
+
readonly transportFactory?: McpClientTransportFactory;
|
|
180
|
+
readonly middleware?: readonly McpClientMiddleware<Principal>[];
|
|
181
|
+
readonly observer?: McpLifecycleObserver<McpClientOperationContext<Principal>>;
|
|
182
|
+
readonly lifecycle?: McpLifecycleMiddlewareOptions<McpClientOperationContext<Principal>>;
|
|
183
|
+
readonly principal?: Principal;
|
|
184
|
+
readonly resolvePrincipal?: McpClientPrincipalResolver<Principal>;
|
|
185
|
+
readonly attributes?: McpAttributes;
|
|
186
|
+
readonly resolveAttributes?: McpClientAttributesResolver;
|
|
187
|
+
readonly operationIdFactory?: () => string;
|
|
188
|
+
/**
|
|
189
|
+
* Absolute deadline for disconnect/unregister/close connection quiescence,
|
|
190
|
+
* subscription teardown, and SDK client/transport close. Defaults to 30 seconds.
|
|
191
|
+
*/
|
|
192
|
+
readonly shutdownTimeoutMs?: number;
|
|
193
|
+
/** Unix epoch milliseconds, injectable for deterministic snapshots. */
|
|
194
|
+
readonly now?: () => number;
|
|
195
|
+
}
|
|
196
|
+
interface McpClientConnectionSnapshot {
|
|
197
|
+
readonly name: string;
|
|
198
|
+
readonly state: McpClientConnectionState;
|
|
199
|
+
readonly transportKind: McpClientTransportDefinition["kind"];
|
|
200
|
+
readonly sessionId?: string;
|
|
201
|
+
readonly connectedAt?: number;
|
|
202
|
+
readonly disconnectedAt?: number;
|
|
203
|
+
readonly negotiatedProtocolVersion?: string;
|
|
204
|
+
readonly protocolEra?: ProtocolEra;
|
|
205
|
+
readonly serverInfo?: Implementation;
|
|
206
|
+
readonly serverCapabilities?: ServerCapabilities;
|
|
207
|
+
readonly instructions?: string;
|
|
208
|
+
readonly discoverResult?: DiscoverResult;
|
|
209
|
+
readonly lastError?: McpErrorDetails;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/runtime.d.ts
|
|
213
|
+
/**
|
|
214
|
+
* Owns a registry of named MCP servers and their independent official Client
|
|
215
|
+
* instances. One runtime may safely connect, disconnect, and inspect many
|
|
216
|
+
* upstreams while applying a shared middleware and lifecycle policy.
|
|
217
|
+
*/
|
|
218
|
+
declare class McpClientRuntime<Principal = unknown> implements AsyncDisposable {
|
|
219
|
+
#private;
|
|
220
|
+
constructor(options?: McpClientRuntimeOptions<Principal>);
|
|
221
|
+
get closed(): boolean;
|
|
222
|
+
get size(): number;
|
|
223
|
+
register(definition: McpClientServerDefinition): this;
|
|
224
|
+
unregister(serverName: string): Promise<boolean>;
|
|
225
|
+
has(serverName: string): boolean;
|
|
226
|
+
names(): readonly string[];
|
|
227
|
+
getDefinition(serverName: string): McpClientServerDefinition;
|
|
228
|
+
setPriorDiscovery(serverName: string, prior: PriorDiscovery$1 | undefined): this;
|
|
229
|
+
/** Returns a persistable current verdict without automatically reusing it. */
|
|
230
|
+
getPriorDiscovery(serverName: string): PriorDiscovery$1 | undefined;
|
|
231
|
+
getClient(serverName: string): Client$1 | undefined;
|
|
232
|
+
requireClient(serverName: string): Client$1;
|
|
233
|
+
snapshot(): readonly McpClientConnectionSnapshot[];
|
|
234
|
+
snapshot(serverName: string): McpClientConnectionSnapshot;
|
|
235
|
+
connect(serverName: string, options?: ConnectOptions$1): Promise<Client$1>;
|
|
236
|
+
connectAll(options?: Readonly<Record<string, ConnectOptions$1 | undefined>>): Promise<ReadonlyMap<string, Client$1>>;
|
|
237
|
+
disconnect(serverName: string): Promise<void>;
|
|
238
|
+
disconnectAll(): Promise<void>;
|
|
239
|
+
close(): Promise<void>;
|
|
240
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
241
|
+
discover(serverName: string, options?: RequestOptions$1): Promise<DiscoverResult>;
|
|
242
|
+
/** Checks that a connected server is responsive. */
|
|
243
|
+
ping(serverName: string, options?: RequestOptions$1): Promise<EmptyResult$1>;
|
|
244
|
+
/** Sends any official method-keyed request through runtime policy and lifecycle hooks. */
|
|
245
|
+
request<const RequestValue extends McpClientProtocolRequest>(serverName: string, request: RequestValue, options: RequestOptions$1 & {
|
|
246
|
+
readonly allowInputRequired: true;
|
|
247
|
+
}): Promise<ResultTypeMap$1[RequestValue["method"]] | InputRequiredResultForMethod<RequestValue["method"]>>;
|
|
248
|
+
request<const RequestValue extends McpClientProtocolRequest>(serverName: string, request: RequestValue, options?: RequestOptions$1 & {
|
|
249
|
+
readonly allowInputRequired?: false | undefined;
|
|
250
|
+
}): Promise<ResultTypeMap$1[RequestValue["method"]]>;
|
|
251
|
+
request<const RequestValue extends McpClientProtocolRequest>(serverName: string, request: RequestValue, options?: RequestOptions$1): Promise<ResultTypeMap$1[RequestValue["method"]] | InputRequiredResultForMethod<RequestValue["method"]>>;
|
|
252
|
+
/** Sends a custom extension request and validates its result with a Standard Schema. */
|
|
253
|
+
requestWithSchema<Schema extends StandardSchemaV1$1>(serverName: string, request: Request$1, resultSchema: Schema, options?: RequestOptions$1): Promise<StandardSchemaV1$1.InferOutput<Schema>>;
|
|
254
|
+
/**
|
|
255
|
+
* Sends a modern multi-round-trip request in manual mode.
|
|
256
|
+
*
|
|
257
|
+
* A complete response is validated by `resultSchema`; an `input_required`
|
|
258
|
+
* response is returned as the official typed continuation payload.
|
|
259
|
+
*/
|
|
260
|
+
requestWithInputRequired<Method extends McpClientMrtrMethod, Schema extends StandardSchemaV1$1>(serverName: string, request: McpClientMrtrRequest<Method>, resultSchema: Schema, options?: McpClientMrtrRequestOptions): Promise<McpClientMrtrResult<Schema>>;
|
|
261
|
+
/**
|
|
262
|
+
* Resumes one manual modern multi-round-trip round through a fresh official
|
|
263
|
+
* request. The server-owned `requestState` is echoed without interpretation.
|
|
264
|
+
* Only this round's `inputResponses` are included.
|
|
265
|
+
*/
|
|
266
|
+
resumeInputRequired<Method extends McpClientMrtrMethod, Schema extends StandardSchemaV1$1>(serverName: string, originalRequest: McpClientMrtrRequest<Method>, inputRequired: InputRequiredResult$1, inputResponses: InputResponses$1, resultSchema: Schema, options?: McpClientMrtrRequestOptions): Promise<McpClientMrtrResult<Schema>>;
|
|
267
|
+
/** Sends an official notification through runtime policy and lifecycle hooks. */
|
|
268
|
+
notification(serverName: string, notification: Notification$1, options?: NotificationOptions$1): Promise<void>;
|
|
269
|
+
/** Requests argument suggestions for a prompt or resource template. */
|
|
270
|
+
complete(serverName: string, params: CompleteRequest$1["params"], options?: RequestOptions$1): Promise<CompleteResult$1>;
|
|
271
|
+
/**
|
|
272
|
+
* Sets the minimum server log level on protocol eras that support it.
|
|
273
|
+
*
|
|
274
|
+
* @deprecated Deprecated by MCP 2026-07-28. Prefer stderr or OpenTelemetry.
|
|
275
|
+
*/
|
|
276
|
+
setLoggingLevel(serverName: string, level: LoggingLevel$1, options?: RequestOptions$1): Promise<EmptyResult$1>;
|
|
277
|
+
listTools(serverName: string, params?: ListToolsRequest["params"], options?: CacheableRequestOptions): Promise<ListToolsResult>;
|
|
278
|
+
callTool(serverName: string, params: CallToolRequest$1["params"], options: CallToolRequestOptions$1 & {
|
|
279
|
+
readonly allowInputRequired: true;
|
|
280
|
+
}): Promise<CallToolResult$1 | InputRequiredResult$1>;
|
|
281
|
+
callTool(serverName: string, params: CallToolRequest$1["params"], options?: CallToolRequestOptions$1 & {
|
|
282
|
+
readonly allowInputRequired?: false | undefined;
|
|
283
|
+
}): Promise<CallToolResult$1>;
|
|
284
|
+
callTool(serverName: string, params: CallToolRequest$1["params"], options: CallToolRequestOptions$1): Promise<CallToolResult$1 | InputRequiredResult$1>;
|
|
285
|
+
listResources(serverName: string, params?: ListResourcesRequest["params"], options?: CacheableRequestOptions): Promise<ListResourcesResult>;
|
|
286
|
+
listResourceTemplates(serverName: string, params?: ListResourceTemplatesRequest["params"], options?: CacheableRequestOptions): Promise<ListResourceTemplatesResult>;
|
|
287
|
+
readResource(serverName: string, params: ReadResourceRequest$1["params"], options: CacheableRequestOptions & {
|
|
288
|
+
readonly allowInputRequired: true;
|
|
289
|
+
}): Promise<ReadResourceResult$1 | InputRequiredResult$1>;
|
|
290
|
+
readResource(serverName: string, params: ReadResourceRequest$1["params"], options?: CacheableRequestOptions & {
|
|
291
|
+
readonly allowInputRequired?: false | undefined;
|
|
292
|
+
}): Promise<ReadResourceResult$1>;
|
|
293
|
+
readResource(serverName: string, params: ReadResourceRequest$1["params"], options: CacheableRequestOptions): Promise<ReadResourceResult$1 | InputRequiredResult$1>;
|
|
294
|
+
/** Uses the legacy-era per-resource subscription request. */
|
|
295
|
+
subscribeResource(serverName: string, params: SubscribeRequest$1["params"], options?: RequestOptions$1): Promise<EmptyResult$1>;
|
|
296
|
+
/** Uses the legacy-era per-resource unsubscribe request. */
|
|
297
|
+
unsubscribeResource(serverName: string, params: UnsubscribeRequest$1["params"], options?: RequestOptions$1): Promise<EmptyResult$1>;
|
|
298
|
+
/**
|
|
299
|
+
* Opens a modern change-notification stream and binds it to this runtime's
|
|
300
|
+
* connection lifecycle. Register notification handlers in `configureClient`
|
|
301
|
+
* before connecting.
|
|
302
|
+
*/
|
|
303
|
+
listen(serverName: string, filter: SubscriptionFilter$1, options?: RequestOptions$1): Promise<McpClientSubscription>;
|
|
304
|
+
/** Returns runtime-opened subscription streams for one logical server. */
|
|
305
|
+
activeSubscriptions(serverName: string): readonly McpClientSubscription[];
|
|
306
|
+
/** Returns the runtime-owned stream opened by `ClientOptions.listChanged`, when present. */
|
|
307
|
+
getAutoOpenedSubscription(serverName: string): McpClientSubscription | undefined;
|
|
308
|
+
listPrompts(serverName: string, params?: ListPromptsRequest["params"], options?: CacheableRequestOptions): Promise<ListPromptsResult>;
|
|
309
|
+
getPrompt(serverName: string, params: GetPromptRequest$1["params"], options: RequestOptions$1 & {
|
|
310
|
+
readonly allowInputRequired: true;
|
|
311
|
+
}): Promise<GetPromptResult$1 | InputRequiredResult$1>;
|
|
312
|
+
getPrompt(serverName: string, params: GetPromptRequest$1["params"], options?: RequestOptions$1 & {
|
|
313
|
+
readonly allowInputRequired?: false | undefined;
|
|
314
|
+
}): Promise<GetPromptResult$1>;
|
|
315
|
+
getPrompt(serverName: string, params: GetPromptRequest$1["params"], options: RequestOptions$1): Promise<GetPromptResult$1 | InputRequiredResult$1>;
|
|
316
|
+
/**
|
|
317
|
+
* Notifies a legacy-era server that the client's roots changed.
|
|
318
|
+
*
|
|
319
|
+
* @deprecated Deprecated by MCP 2026-07-28. Pass paths through tool inputs,
|
|
320
|
+
* resource URIs, or configuration instead.
|
|
321
|
+
*/
|
|
322
|
+
sendRootsListChanged(serverName: string): Promise<void>;
|
|
323
|
+
}
|
|
324
|
+
type InputRequiredResultForMethod<Method extends RequestMethod$1> = Method extends McpClientMrtrMethod ? InputRequiredResult$1 : never;
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/catalog-inspection.d.ts
|
|
327
|
+
interface McpClientCatalogSnapshot {
|
|
328
|
+
readonly tools: readonly Tool[];
|
|
329
|
+
readonly resources: readonly Resource[];
|
|
330
|
+
readonly resourceTemplates: readonly ResourceTemplateType[];
|
|
331
|
+
readonly prompts: readonly Prompt[];
|
|
332
|
+
}
|
|
333
|
+
interface McpClientCatalogInspectionOptions {
|
|
334
|
+
readonly runtime: Pick<McpClientRuntime, "request" | "snapshot">;
|
|
335
|
+
readonly serverName: string;
|
|
336
|
+
readonly signal: AbortSignal;
|
|
337
|
+
readonly maxPages: number;
|
|
338
|
+
readonly maxItems: number;
|
|
339
|
+
/** Parallel waves settle every request before returning. Credential-bound callers use sequential. */
|
|
340
|
+
readonly mode?: "sequential" | "parallel";
|
|
341
|
+
}
|
|
342
|
+
declare class McpClientCatalogLimitError extends Error {
|
|
343
|
+
readonly code: "MCP_CLIENT_CATALOG_LIMIT_EXCEEDED";
|
|
344
|
+
constructor();
|
|
345
|
+
}
|
|
346
|
+
/** Fresh bounded protocol traversal on an already acquired runtime; owns no lease or cache. */
|
|
347
|
+
declare function discoverMcpClientCatalog(input: McpClientCatalogInspectionOptions): Promise<McpClientCatalogSnapshot>;
|
|
348
|
+
/** Per-run diagnostic target. It shares discovery across checks and never opens a nested lease. */
|
|
349
|
+
declare function createMcpClientInspectionTarget(input: Omit<McpClientCatalogInspectionOptions, "signal" | "mode"> & {
|
|
350
|
+
readonly leaseSignal: AbortSignal;
|
|
351
|
+
}): McpPassiveDiscoveryTarget;
|
|
352
|
+
//#endregion
|
|
353
|
+
//#region src/lease-manager.d.ts
|
|
354
|
+
/** Determines what happens when the final reference to one resource is released. */
|
|
355
|
+
type McpClientLeaseReleaseMode = "close" | "idle";
|
|
356
|
+
interface McpClientLeaseFactoryContext {
|
|
357
|
+
/** Aborted when this identity generation is invalidated, abandoned, or shut down. */
|
|
358
|
+
readonly signal: AbortSignal;
|
|
359
|
+
}
|
|
360
|
+
interface McpClientLeaseManagerOptions<Identity, Resource extends object> {
|
|
361
|
+
/** A stable, non-secret identity is passed only to this caller-owned factory. */
|
|
362
|
+
readonly create: (identity: Identity, context: McpClientLeaseFactoryContext) => Promise<Resource>;
|
|
363
|
+
/** Closes a resource exactly once after its identity generation is retired. */
|
|
364
|
+
readonly close: (resource: Resource) => Promise<void> | void;
|
|
365
|
+
/** Hard bound across pending, ready, and retiring resource generations. */
|
|
366
|
+
readonly maxResources?: number;
|
|
367
|
+
/** Retention window for resources explicitly acquired in `idle` mode. */
|
|
368
|
+
readonly idleTtlMs?: number;
|
|
369
|
+
/** Injectable monotonic-enough wall clock for deterministic expiry tests. */
|
|
370
|
+
readonly now?: () => number;
|
|
371
|
+
/** Called after capacity is released; observer failures cannot affect cleanup. */
|
|
372
|
+
readonly onCapacityAvailable?: () => void;
|
|
373
|
+
}
|
|
374
|
+
interface McpClientLeaseAcquireOptions {
|
|
375
|
+
/** Defaults to `close`; use `idle` only for resources safe to reuse. */
|
|
376
|
+
readonly releaseMode?: McpClientLeaseReleaseMode;
|
|
377
|
+
/** Cancels only this acquisition, never another caller sharing the same creation. */
|
|
378
|
+
readonly signal?: AbortSignal;
|
|
379
|
+
/** Wait for this reservation's required cleanup on cancellation; defaults to false. */
|
|
380
|
+
readonly awaitCleanupOnCancel?: boolean;
|
|
381
|
+
}
|
|
382
|
+
interface McpClientLease<Resource extends object> extends AsyncDisposable {
|
|
383
|
+
readonly resource: Resource;
|
|
384
|
+
readonly released: boolean;
|
|
385
|
+
/** Releases this reference. Repeated calls return the same settlement. */
|
|
386
|
+
release(): Promise<void>;
|
|
387
|
+
}
|
|
388
|
+
/** Aggregate diagnostics deliberately omit opaque identity keys and resources. */
|
|
389
|
+
interface McpClientLeaseManagerSnapshot {
|
|
390
|
+
readonly closed: boolean;
|
|
391
|
+
readonly maxResources: number;
|
|
392
|
+
readonly resourceCount: number;
|
|
393
|
+
readonly pendingResourceCount: number;
|
|
394
|
+
readonly activeResourceCount: number;
|
|
395
|
+
readonly idleResourceCount: number;
|
|
396
|
+
readonly closingResourceCount: number;
|
|
397
|
+
readonly failedResourceCount: number;
|
|
398
|
+
readonly referenceCount: number;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Bounded, framework-neutral ownership for identity-isolated MCP client resources.
|
|
402
|
+
* Identity keys are compared opaquely with `Map` semantics and are never emitted.
|
|
403
|
+
*/
|
|
404
|
+
declare class McpClientLeaseManager<Identity, Resource extends object> implements AsyncDisposable {
|
|
405
|
+
#private;
|
|
406
|
+
constructor(options: McpClientLeaseManagerOptions<Identity, Resource>);
|
|
407
|
+
get closed(): boolean;
|
|
408
|
+
get size(): number;
|
|
409
|
+
snapshot(): McpClientLeaseManagerSnapshot;
|
|
410
|
+
/** Read-only availability for a synchronous acquire reservation. Includes all cleanup. */
|
|
411
|
+
canAcquire(identity: Identity): boolean;
|
|
412
|
+
acquire(identity: Identity, options?: McpClientLeaseAcquireOptions): Promise<McpClientLease<Resource>>;
|
|
413
|
+
/** Retires the current identity generation before waiting for its close. */
|
|
414
|
+
invalidate(identity: Identity): Promise<boolean>;
|
|
415
|
+
close(): Promise<void>;
|
|
416
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/tool-schema.d.ts
|
|
420
|
+
interface McpClientToolSchemaIssue {
|
|
421
|
+
readonly message: string;
|
|
422
|
+
}
|
|
423
|
+
type McpClientToolSchemaResult = {
|
|
424
|
+
readonly value: unknown;
|
|
425
|
+
} | {
|
|
426
|
+
readonly issues: readonly McpClientToolSchemaIssue[];
|
|
427
|
+
};
|
|
428
|
+
/** Standard Schema compatibility retained by the Zod tool schema. */
|
|
429
|
+
interface McpClientToolStandardSchema {
|
|
430
|
+
readonly "~standard": {
|
|
431
|
+
readonly version: 1;
|
|
432
|
+
readonly vendor: string;
|
|
433
|
+
readonly validate: (value: unknown) => Promise<McpClientToolSchemaResult>;
|
|
434
|
+
readonly jsonSchema: {
|
|
435
|
+
readonly input: (options: unknown) => Record<string, unknown>;
|
|
436
|
+
readonly output: (options: unknown) => Record<string, unknown>;
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/** Runtime Zod view of a dynamically discovered MCP tool JSON Schema. */
|
|
441
|
+
type McpClientToolSchema = McpClientToolStandardSchema & z.ZodType;
|
|
442
|
+
/**
|
|
443
|
+
* Converts a discovered MCP tool JSON Schema into a Zod v4 schema.
|
|
444
|
+
*
|
|
445
|
+
* Zod v4 schemas also implement Standard Schema and Standard JSON Schema, so
|
|
446
|
+
* the returned schema can be passed directly to either kind of consumer. The
|
|
447
|
+
* official MCP validator remains the exact predicate because a discovered
|
|
448
|
+
* Draft 2020-12 schema can contain constraints that Zod cannot reconstruct.
|
|
449
|
+
* Invalid or unsupported schemas fail synchronously during construction.
|
|
450
|
+
*/
|
|
451
|
+
declare function createMcpClientToolSchema(schema: McpClientToolInputSchema | McpClientToolOutputSchema): McpClientToolSchema;
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/middleware.d.ts
|
|
454
|
+
type SingleValueConstraint<Value, Whole = Value> = Value extends unknown ? [Whole] extends [Value] ? unknown : never : never;
|
|
455
|
+
/**
|
|
456
|
+
* Defines a transform for one ordinary official request/result pair.
|
|
457
|
+
*
|
|
458
|
+
* Runtime-owned custom-schema, manual-MRTR, input-required, and managed
|
|
459
|
+
* subscription operations are intentionally not dispatched to this helper,
|
|
460
|
+
* even when they share the same protocol method string.
|
|
461
|
+
*/
|
|
462
|
+
declare function defineMcpClientTransform<const Method extends McpClientRequestMethod, Principal = unknown>(method: Method & SingleValueConstraint<Method>, transform: McpClientTransform<Method, Principal>): McpClientMiddleware<Principal>;
|
|
463
|
+
/**
|
|
464
|
+
* Binds provider-owned middleware without erasing exact-transform identity.
|
|
465
|
+
*
|
|
466
|
+
* Exact transforms carry runtime-only identity used to keep their typed
|
|
467
|
+
* continuation behind broad middleware. Since `Function.bind()` creates a new
|
|
468
|
+
* function, exact transforms must remain unchanged; their defining adapter
|
|
469
|
+
* already closes over the supplied transform callback.
|
|
470
|
+
*/
|
|
471
|
+
declare function bindMcpClientMiddleware<Principal>(middleware: McpClientMiddleware<Principal>, receiver: object): McpClientMiddleware<Principal>;
|
|
472
|
+
/**
|
|
473
|
+
* Creates client middleware that always returns the exact downstream result.
|
|
474
|
+
* The callback can run before and after `next()`, but cannot inspect, replace,
|
|
475
|
+
* or swallow a method-specific result.
|
|
476
|
+
*/
|
|
477
|
+
declare function createMcpClientPassthroughMiddleware<Principal = unknown>(middleware: McpClientPassthroughMiddleware<Principal>): McpClientMiddleware<Principal>;
|
|
478
|
+
//#endregion
|
|
479
|
+
export { type AddClientAuthentication, type AuthOptions, type AuthProvider, type AuthResult, AuthorizationServerMismatchError, type CallToolRequest, type CallToolRequestOptions, type CallToolResult, Client, type ClientAuthMethod, ClientCredentialsProvider, type ClientCredentialsProviderOptions, type ClientOptions, type CompleteRequest, type CompleteResult, type ConnectOptions, type CrossAppAccessContext, CrossAppAccessProvider, type CrossAppAccessProviderOptions, type EmptyResult, type FetchLike, type GetPromptRequest, type GetPromptResult, type InputRequest, type InputRequests, type InputRequiredOptions, type InputRequiredResult, type InputResponse, type InputResponses, InsecureTokenEndpointError, InsufficientScopeError, IssuerMismatchError, type LoggingLevel, type LoggingOptions, MCP_CLIENT_LEASE_CAPACITY_EXCEEDED, MCP_CLIENT_LEASE_INVALIDATED, MCP_CLIENT_LEASE_MANAGER_CLOSED, MCP_CLIENT_LEASE_RELEASE_MODE_CONFLICT, MCP_CLIENT_NOT_CONNECTED, MCP_CLIENT_RUNTIME_CLOSED, MCP_CLIENT_SERVER_EXISTS, MCP_CLIENT_SERVER_NOT_FOUND, MCP_CLIENT_SHUTDOWN_TIMEOUT, type McpClientAttributesResolver, type McpClientCatalogInspectionOptions, McpClientCatalogLimitError, type McpClientCatalogSnapshot, type McpClientConfigurationContext, type McpClientConfigurator, type McpClientConnectionSnapshot, type McpClientConnectionState, type McpClientLease, type McpClientLeaseAcquireOptions, type McpClientLeaseFactoryContext, McpClientLeaseManager, McpClientLeaseManagerError, type McpClientLeaseManagerErrorCode, type McpClientLeaseManagerOptions, type McpClientLeaseManagerSnapshot, type McpClientLeaseReleaseMode, type McpClientMiddleware, type McpClientMrtrMethod, type McpClientMrtrRequest, type McpClientMrtrRequestOptions, type McpClientMrtrResult, type McpClientOperationContext, type McpClientOperationInput, type McpClientPassthroughMiddleware, type McpClientPrincipalResolver, type McpClientProtocolRequest, type McpClientReadonly, type McpClientRequestMethod, McpClientRuntime, McpClientRuntimeError, type McpClientRuntimeErrorCode, type McpClientRuntimeOptions, type McpClientServerDefinition, type McpClientSubscription, type McpClientTool, type McpClientToolInputSchema, type McpClientToolOutputSchema, type McpClientToolSchema, type McpClientToolSchemaIssue, type McpClientToolSchemaResult, type McpClientToolStandardSchema, type McpClientTransform, type McpClientTransformInput, type McpClientTransformOptions, type McpClientTransformResult, type McpClientTransportDefinition, type McpClientTransportFactory, type McpClientTransportFactoryContext, type McpHttpClientTransportDefinition, type McpSdkClientFactory, type McpSdkClientFactoryContext, type McpStdioClientTransportDefinition, type McpSubscription, type Middleware, type Notification, type NotificationOptions, OAuthClientFlowError, type OAuthClientInformationContext, type OAuthClientProvider, type OAuthDiscoveryState, type OAuthServerInfo, type PriorDiscovery, PrivateKeyJwtProvider, type PrivateKeyJwtProviderOptions, type ReadResourceRequest, type ReadResourceResult, RegistrationRejectedError, type Request, type RequestLogger, type RequestMethod, type RequestOptions, type RequestTypeMap, type ResultTypeMap, type StandardSchemaV1, StaticPrivateKeyJwtProvider, type StaticPrivateKeyJwtProviderOptions, StdioClientTransport, type StdioServerParameters, StreamableHTTPClientTransport, type StreamableHTTPClientTransportOptions, type SubscribeRequest, type SubscriptionFilter, type Transport, UnauthorizedError, type UnsubscribeRequest, applyMiddlewares, auth, bindMcpClientMiddleware, composeMcpFetchMiddleware, createMcpClientInspectionTarget, createMcpClientPassthroughMiddleware, createMcpClientToolSchema, createMcpClientTransport, createMcpHttpClientTransport, createMcpStdioClientTransport, createMiddleware, createPrivateKeyJwtAuth, defaultMcpClientTransportFactory, defineMcpClientTransform, discoverMcpClientCatalog, discoverOAuthMetadata, discoverOAuthProtectedResourceMetadata, discoverOAuthServerInfo, isInputRequiredResult, refreshAuthorization, specTypeSchemas, withInputRequired, withLogging, withOAuth };
|
|
480
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors.ts","../src/transport.ts","../src/types.ts","../src/runtime.ts","../src/catalog-inspection.ts","../src/lease-manager.ts","../src/tool-schema.ts","../src/middleware.ts"],"mappings":";;;;;;cAAa;cACA;cACA;cACA;cACA;cACA;cACA;cACA;cAEA;K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