@alvin0/ai-agent-sdk-mcp 0.1.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/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/client-ChEdrVJ_.d.ts +310 -0
- package/dist/client-ChEdrVJ_.d.ts.map +1 -0
- package/dist/client-D7Th3S7z.js +1250 -0
- package/dist/client-D7Th3S7z.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/package.json +91 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 alvin0 (chaulamdinhai) <chaulamdinhai@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @alvin0/ai-agent-sdk-mcp
|
|
2
|
+
|
|
3
|
+
Runtime: **Universal** (Edge/Worker, browser, Deno, Bun, and Node).
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @alvin0/ai-agent-sdk-core @alvin0/ai-agent-sdk-mcp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Universal MCP client for Fetch-shaped HTTP runtimes. It connects remote MCP
|
|
10
|
+
servers to the SDK as a versioned `ToolSource`.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { createAgentRuntime } from '@alvin0/ai-agent-sdk-core'
|
|
14
|
+
import { connectMcpHttp } from '@alvin0/ai-agent-sdk-mcp'
|
|
15
|
+
|
|
16
|
+
const runtime = await createAgentRuntime({ providers: [modelProvider] })
|
|
17
|
+
let connection: Awaited<ReturnType<typeof connectMcpHttp>> | undefined
|
|
18
|
+
try {
|
|
19
|
+
connection = await connectMcpHttp({
|
|
20
|
+
serverName: 'tools',
|
|
21
|
+
url: 'https://tools.example.com/mcp',
|
|
22
|
+
logger: runtime.logger({ fields: { integration: 'mcp-http' } }),
|
|
23
|
+
})
|
|
24
|
+
const agent = runtime.agent({ model, toolSources: [connection] })
|
|
25
|
+
await agent.generate('Use the connected tools when needed.')
|
|
26
|
+
} finally {
|
|
27
|
+
try {
|
|
28
|
+
await runtime.close()
|
|
29
|
+
} finally {
|
|
30
|
+
await connection?.closeWithReport()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The normal root and `/client` route contain no server, stdio, filesystem,
|
|
36
|
+
`node:http`, or process lifecycle integration. Use `@alvin0/ai-agent-sdk-mcp-node` for
|
|
37
|
+
the Node stdio client, and a dedicated server package for hosting.
|
|
38
|
+
|
|
39
|
+
HTTP endpoints are host-selected. HTTPS, public-network-only access, and no
|
|
40
|
+
redirects are the defaults; local development must opt out explicitly. Use
|
|
41
|
+
`allowedOrigins`, the async `validateEndpoint` hook, a DNS-pinning custom fetch
|
|
42
|
+
or network egress policy, response/catalog/result bounds, and operation deadlines
|
|
43
|
+
according to the application's trust boundary. OAuth credential persistence and
|
|
44
|
+
redirect handling remain caller-owned.
|
|
45
|
+
|
|
46
|
+
Composition: `runtime-agent.toolSources`. Lifecycle: `connected-caller-owned`;
|
|
47
|
+
create the runtime first, pass `runtime.logger(...)` while connecting, close the
|
|
48
|
+
runtime to quiesce runs, then inspect `connection.closeWithReport()`.
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { ToolCatalog, ToolCatalogSnapshot, ToolFilter, ToolSource, ToolSourceSnapshotOptions } from "@alvin0/ai-agent-sdk-core/tools";
|
|
2
|
+
import { JsonObject, JsonValue, SdkLogger, SupportSafeError } from "@alvin0/ai-agent-sdk-core";
|
|
3
|
+
//#region src/client/public-types.d.ts
|
|
4
|
+
/** Protocol-selection surface owned by the SDK so Web consumers do not inherit Node ambient types. */
|
|
5
|
+
type McpVersionNegotiationMode = 'legacy' | 'auto' | {
|
|
6
|
+
readonly pin: string;
|
|
7
|
+
};
|
|
8
|
+
interface McpBearerAuthProvider {
|
|
9
|
+
token(): Promise<string | undefined>;
|
|
10
|
+
onUnauthorized?(context: {
|
|
11
|
+
readonly response: Response;
|
|
12
|
+
readonly resourceMetadataUrl?: URL;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* OAuth providers intentionally remain structural. The MCP protocol package accepts richer
|
|
17
|
+
* provider objects; this boundary keeps them portable without copying that package's full API.
|
|
18
|
+
*/
|
|
19
|
+
type McpAuthenticationProvider = McpBearerAuthProvider | object;
|
|
20
|
+
type McpFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
21
|
+
interface McpStreamableHttpReconnectionOptions {
|
|
22
|
+
readonly maxReconnectionDelay: number;
|
|
23
|
+
readonly initialReconnectionDelay: number;
|
|
24
|
+
readonly reconnectionDelayGrowFactor: number;
|
|
25
|
+
readonly maxRetries: number;
|
|
26
|
+
}
|
|
27
|
+
interface McpStreamableHttpTransportOptions {
|
|
28
|
+
readonly authProvider?: McpAuthenticationProvider;
|
|
29
|
+
readonly skipIssuerMetadataValidation?: boolean;
|
|
30
|
+
readonly requestInit?: RequestInit;
|
|
31
|
+
readonly fetch?: McpFetch;
|
|
32
|
+
readonly reconnectionOptions?: McpStreamableHttpReconnectionOptions;
|
|
33
|
+
readonly reconnectionScheduler?: (reconnect: () => void, delay: number, attemptCount: number) => (() => void) | void;
|
|
34
|
+
readonly sessionId?: string;
|
|
35
|
+
readonly protocolVersion?: string;
|
|
36
|
+
readonly onInsufficientScope?: 'reauthorize' | 'throw';
|
|
37
|
+
readonly maxStepUpRetries?: number;
|
|
38
|
+
}
|
|
39
|
+
interface McpSseTransportOptions {
|
|
40
|
+
readonly authProvider?: McpAuthenticationProvider;
|
|
41
|
+
readonly skipIssuerMetadataValidation?: boolean;
|
|
42
|
+
readonly eventSourceInit?: {
|
|
43
|
+
readonly fetch?: McpFetch;
|
|
44
|
+
};
|
|
45
|
+
readonly requestInit?: RequestInit;
|
|
46
|
+
readonly fetch?: McpFetch;
|
|
47
|
+
}
|
|
48
|
+
interface McpTransport {
|
|
49
|
+
start(): Promise<void>;
|
|
50
|
+
send(...args: never[]): Promise<void>;
|
|
51
|
+
close(): Promise<void>;
|
|
52
|
+
readonly hasPerRequestStream?: boolean;
|
|
53
|
+
onclose?: (() => void) | undefined;
|
|
54
|
+
onerror?: ((error: Error) => void) | undefined;
|
|
55
|
+
onmessage?: ((...args: never[]) => void) | undefined;
|
|
56
|
+
}
|
|
57
|
+
interface McpRemoteToolDefinition {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
readonly description?: string;
|
|
60
|
+
readonly inputSchema?: JsonObject;
|
|
61
|
+
readonly outputSchema?: JsonObject;
|
|
62
|
+
readonly annotations?: JsonObject;
|
|
63
|
+
}
|
|
64
|
+
interface McpCallToolResult {
|
|
65
|
+
readonly [key: string]: unknown;
|
|
66
|
+
readonly content: readonly unknown[];
|
|
67
|
+
readonly structuredContent?: unknown;
|
|
68
|
+
readonly isError?: boolean | undefined;
|
|
69
|
+
}
|
|
70
|
+
/** Common raw-protocol operations available without importing the upstream declaration graph. */
|
|
71
|
+
interface McpProtocolClient {
|
|
72
|
+
callTool(params: {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly arguments?: JsonObject;
|
|
75
|
+
}, options?: {
|
|
76
|
+
readonly signal?: AbortSignal;
|
|
77
|
+
readonly timeout?: number;
|
|
78
|
+
readonly toolDefinition?: McpRemoteToolDefinition;
|
|
79
|
+
}): Promise<McpCallToolResult>;
|
|
80
|
+
listTools(params?: JsonObject, options?: object): Promise<{
|
|
81
|
+
readonly tools: readonly McpRemoteToolDefinition[];
|
|
82
|
+
readonly nextCursor?: string;
|
|
83
|
+
}>;
|
|
84
|
+
listResources(params?: JsonObject, options?: object): Promise<JsonObject>;
|
|
85
|
+
readResource(params: {
|
|
86
|
+
readonly uri: string;
|
|
87
|
+
readonly _meta?: JsonObject;
|
|
88
|
+
}, options?: object): Promise<JsonObject>;
|
|
89
|
+
listPrompts(params?: JsonObject, options?: object): Promise<JsonObject>;
|
|
90
|
+
getPrompt(params: {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly arguments?: JsonObject;
|
|
93
|
+
}, options?: object): Promise<JsonObject>;
|
|
94
|
+
ping(options?: object): Promise<JsonObject>;
|
|
95
|
+
close(): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/client/api-types.d.ts
|
|
99
|
+
interface McpReconnectOptions {
|
|
100
|
+
readonly enabled?: boolean;
|
|
101
|
+
readonly initialDelayMs?: number;
|
|
102
|
+
readonly maxDelayMs?: number;
|
|
103
|
+
readonly maxAttempts?: number;
|
|
104
|
+
}
|
|
105
|
+
interface ResolvedMcpReconnectOptions {
|
|
106
|
+
readonly enabled: boolean;
|
|
107
|
+
readonly initialDelayMs: number;
|
|
108
|
+
readonly maxDelayMs: number;
|
|
109
|
+
readonly maxAttempts: number;
|
|
110
|
+
}
|
|
111
|
+
type McpClientStatus = 'idle' | 'connecting' | 'authorization-required' | 'authentication-required' | 'authentication-failed' | 'oauth-authorization-required' | 'scope-authorization-required' | 'ready' | 'reconnecting' | 'failed' | 'closed';
|
|
112
|
+
type McpAuthenticationKind = 'none' | 'bearer' | 'oauth' | 'unknown';
|
|
113
|
+
type McpTransportKind = 'streamable-http' | 'sse' | 'custom';
|
|
114
|
+
interface McpAuthorizationState {
|
|
115
|
+
readonly kind: McpAuthenticationKind;
|
|
116
|
+
readonly reason: 'credentials-required' | 'invalid-credentials' | 'authorization-code-required' | 'insufficient-scope';
|
|
117
|
+
readonly requiredScope?: string;
|
|
118
|
+
}
|
|
119
|
+
interface McpProtocolState {
|
|
120
|
+
readonly era: 'modern' | 'legacy';
|
|
121
|
+
readonly version?: string;
|
|
122
|
+
readonly transport: McpTransportKind;
|
|
123
|
+
readonly fallback: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface McpClientState {
|
|
126
|
+
readonly status: McpClientStatus;
|
|
127
|
+
readonly serverName: string;
|
|
128
|
+
readonly attempt: number;
|
|
129
|
+
readonly error?: Error;
|
|
130
|
+
readonly authorization?: McpAuthorizationState;
|
|
131
|
+
readonly protocol?: McpProtocolState;
|
|
132
|
+
readonly catalogRevision: number;
|
|
133
|
+
readonly supportError?: SupportSafeError;
|
|
134
|
+
}
|
|
135
|
+
interface McpClientLifecycleOptions {
|
|
136
|
+
readonly serverName: string;
|
|
137
|
+
readonly logger?: SdkLogger;
|
|
138
|
+
readonly clientName?: string;
|
|
139
|
+
readonly clientVersion?: string;
|
|
140
|
+
readonly protocol?: McpVersionNegotiationMode;
|
|
141
|
+
readonly reconnect?: McpReconnectOptions | false;
|
|
142
|
+
readonly toolFilter?: ToolFilter;
|
|
143
|
+
readonly prefixToolNames?: boolean;
|
|
144
|
+
readonly toolCallTimeoutMs?: number;
|
|
145
|
+
readonly operationTimeoutMs?: number;
|
|
146
|
+
readonly closeTimeoutMs?: number;
|
|
147
|
+
readonly maxTools?: number;
|
|
148
|
+
readonly maxCatalogBytes?: number;
|
|
149
|
+
readonly maxToolResultBytes?: number;
|
|
150
|
+
readonly trustReadOnlyAnnotations?: boolean;
|
|
151
|
+
readonly onStateChange?: (state: McpClientState) => void;
|
|
152
|
+
readonly signal?: AbortSignal;
|
|
153
|
+
}
|
|
154
|
+
interface McpHttpClientOptions extends McpClientLifecycleOptions {
|
|
155
|
+
readonly url: string | URL;
|
|
156
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
157
|
+
readonly headers?: RequestInit['headers'];
|
|
158
|
+
readonly allowedOrigins?: readonly string[];
|
|
159
|
+
readonly requireHttps?: boolean;
|
|
160
|
+
readonly allowPrivateNetwork?: boolean;
|
|
161
|
+
readonly allowRedirects?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Final host policy hook, awaited immediately before every request and
|
|
164
|
+
* redirect under the operation's absolute deadline. The signal is cancelled
|
|
165
|
+
* on caller abort or timeout. A server can resolve DNS here; pair it with a
|
|
166
|
+
* fetch/egress layer that pins the validated address to eliminate
|
|
167
|
+
* validation/connect races.
|
|
168
|
+
*/
|
|
169
|
+
readonly validateEndpoint?: (url: URL, signal: AbortSignal) => void | Promise<void>;
|
|
170
|
+
readonly maxTransportBytes?: number;
|
|
171
|
+
readonly transport?: Omit<McpStreamableHttpTransportOptions, 'requestInit'> & {
|
|
172
|
+
readonly requestInit?: RequestInit;
|
|
173
|
+
};
|
|
174
|
+
readonly legacySse?: false | {
|
|
175
|
+
readonly url?: string | URL;
|
|
176
|
+
readonly transport?: McpSseTransportOptions;
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
type McpToolResultValue = JsonObject & {
|
|
180
|
+
readonly content: readonly JsonValue[];
|
|
181
|
+
readonly structuredContent?: JsonValue;
|
|
182
|
+
};
|
|
183
|
+
type McpTransportFactory = () => McpTransport;
|
|
184
|
+
interface McpClientRuntimeOptions {
|
|
185
|
+
readonly authenticationKind?: McpAuthenticationKind;
|
|
186
|
+
readonly fallbackTransportFactory?: McpTransportFactory;
|
|
187
|
+
/** Internal transport family supplied by the official HTTP/stdio factories. */
|
|
188
|
+
readonly integrationFamily?: 'mcp-http-client' | 'mcp-stdio-client';
|
|
189
|
+
}
|
|
190
|
+
interface McpOAuthCallbackOptions {
|
|
191
|
+
readonly expectedState: string;
|
|
192
|
+
readonly signal?: AbortSignal;
|
|
193
|
+
}
|
|
194
|
+
interface McpCloseReport {
|
|
195
|
+
readonly state: 'closed';
|
|
196
|
+
readonly deadlineReached: boolean;
|
|
197
|
+
readonly unsettledOperations: number;
|
|
198
|
+
readonly error?: SupportSafeError;
|
|
199
|
+
}
|
|
200
|
+
interface McpConnectionPublicShape {
|
|
201
|
+
readonly serverName: string;
|
|
202
|
+
readonly tools: ToolCatalog;
|
|
203
|
+
}
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/client/result.d.ts
|
|
206
|
+
declare class McpRemoteToolError extends Error {
|
|
207
|
+
readonly result: McpCallToolResult;
|
|
208
|
+
constructor(serverName: string, toolName: string, result: McpCallToolResult);
|
|
209
|
+
}
|
|
210
|
+
type McpConnectionStage = 'transport' | 'authentication' | 'handshake' | 'catalog' | 'unknown';
|
|
211
|
+
declare class McpConnectionError extends Error {
|
|
212
|
+
readonly stage: McpConnectionStage;
|
|
213
|
+
readonly failure: SupportSafeError;
|
|
214
|
+
readonly cleanup: McpCloseReport;
|
|
215
|
+
readonly code: 'MCP_CONNECT_FAILED';
|
|
216
|
+
constructor(stage: McpConnectionStage, failure: SupportSafeError, cleanup: McpCloseReport, cause: unknown);
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/client/runtime-helpers.d.ts
|
|
220
|
+
declare function resolveMcpReconnectOptions(input: McpReconnectOptions | false | undefined): ResolvedMcpReconnectOptions;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/client/connection.d.ts
|
|
223
|
+
/**
|
|
224
|
+
* Owns one MCP server connection across transport generations.
|
|
225
|
+
*
|
|
226
|
+
* The ToolCatalog object is stable for the lifetime of this connection. A
|
|
227
|
+
* successful list refresh swaps its registrations synchronously; a failed
|
|
228
|
+
* refresh leaves the last-known-good catalog intact.
|
|
229
|
+
*/
|
|
230
|
+
declare class McpClientConnection implements ToolSource {
|
|
231
|
+
readonly kind: 'tool-source';
|
|
232
|
+
readonly apiVersion: 1;
|
|
233
|
+
readonly id: string;
|
|
234
|
+
readonly serverName: string;
|
|
235
|
+
readonly tools: ToolCatalog;
|
|
236
|
+
private readonly options;
|
|
237
|
+
private readonly transportFactory;
|
|
238
|
+
private readonly fallbackTransportFactory;
|
|
239
|
+
private readonly authenticationKind;
|
|
240
|
+
private readonly integrationFamily;
|
|
241
|
+
private readonly toolCallTimeoutMs;
|
|
242
|
+
private readonly operationTimeoutMs;
|
|
243
|
+
private readonly closeTimeoutMs;
|
|
244
|
+
private readonly maxTools;
|
|
245
|
+
private readonly maxCatalogBytes;
|
|
246
|
+
private readonly maxToolResultBytes;
|
|
247
|
+
private readonly reconnect;
|
|
248
|
+
private readonly registry;
|
|
249
|
+
private toolDisposers;
|
|
250
|
+
private current;
|
|
251
|
+
private pendingAuthorization;
|
|
252
|
+
private connecting;
|
|
253
|
+
private syncTail;
|
|
254
|
+
private pendingToolSyncs;
|
|
255
|
+
private reconnectTimer;
|
|
256
|
+
private reconnectAttempts;
|
|
257
|
+
private catalogRevision;
|
|
258
|
+
private connectedAt;
|
|
259
|
+
private closed;
|
|
260
|
+
private closeTask;
|
|
261
|
+
private currentState;
|
|
262
|
+
constructor(options: McpClientLifecycleOptions, transportFactory: McpTransportFactory, runtime?: McpClientRuntimeOptions);
|
|
263
|
+
get state(): McpClientState;
|
|
264
|
+
snapshot(options: ToolSourceSnapshotOptions): ToolCatalogSnapshot;
|
|
265
|
+
/**
|
|
266
|
+
* Use the currently owned protocol client for resources, prompts, or other
|
|
267
|
+
* MCP operations that do not map to the SDK ToolCatalog.
|
|
268
|
+
*/
|
|
269
|
+
withClient<T>(operation: (client: McpProtocolClient, signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
270
|
+
withClient<TClient, T>(operation: (client: TClient, signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
271
|
+
/** Connect, negotiate capabilities, and publish the first tool snapshot. */
|
|
272
|
+
connect(): Promise<void>;
|
|
273
|
+
/** Force a fresh tools/list and atomically replace the published snapshot. */
|
|
274
|
+
refreshTools(options?: {
|
|
275
|
+
readonly signal?: AbortSignal;
|
|
276
|
+
}): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Validate an OAuth callback, exchange its authorization code on the pending
|
|
279
|
+
* HTTP transport, then reconnect with a fresh transport generation.
|
|
280
|
+
*/
|
|
281
|
+
finishOAuth(callbackParams: URLSearchParams, options: McpOAuthCallbackOptions): Promise<void>;
|
|
282
|
+
/** Stop reconnecting, close the live generation, and unregister its tools. */
|
|
283
|
+
close(): Promise<void>;
|
|
284
|
+
closeWithReport(options?: {
|
|
285
|
+
readonly signal?: AbortSignal;
|
|
286
|
+
}): Promise<McpCloseReport>;
|
|
287
|
+
private performClose;
|
|
288
|
+
private connectGeneration;
|
|
289
|
+
private createGeneration;
|
|
290
|
+
private clientOptions;
|
|
291
|
+
private generationDown;
|
|
292
|
+
private scheduleReconnect;
|
|
293
|
+
private enqueueToolSync;
|
|
294
|
+
private swapTools;
|
|
295
|
+
private bridgeTool;
|
|
296
|
+
private clearTools;
|
|
297
|
+
private bumpCatalogRevision;
|
|
298
|
+
private logAuthenticationFailure;
|
|
299
|
+
private closeGeneration;
|
|
300
|
+
private publish;
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/client/http-client.d.ts
|
|
304
|
+
/** Construct an HTTP client without opening the connection yet. */
|
|
305
|
+
declare function createMcpHttpClient(options: McpHttpClientOptions): McpClientConnection;
|
|
306
|
+
/** Construct and fully initialize an HTTP client. */
|
|
307
|
+
declare function connectMcpHttp(options: McpHttpClientOptions): Promise<McpClientConnection>;
|
|
308
|
+
//#endregion
|
|
309
|
+
export { McpStreamableHttpReconnectionOptions as A, McpAuthenticationProvider as C, McpProtocolClient as D, McpFetch as E, McpTransport as M, McpVersionNegotiationMode as N, McpRemoteToolDefinition as O, ResolvedMcpReconnectOptions as S, McpCallToolResult as T, McpProtocolState as _, McpConnectionError as a, McpTransportFactory as b, McpAuthorizationState as c, McpClientState as d, McpClientStatus as f, McpOAuthCallbackOptions as g, McpHttpClientOptions as h, resolveMcpReconnectOptions as i, McpStreamableHttpTransportOptions as j, McpSseTransportOptions as k, McpClientLifecycleOptions as l, McpConnectionPublicShape as m, createMcpHttpClient as n, McpRemoteToolError as o, McpCloseReport as p, McpClientConnection as r, McpAuthenticationKind as s, connectMcpHttp as t, McpClientRuntimeOptions as u, McpReconnectOptions as v, McpBearerAuthProvider as w, McpTransportKind as x, McpToolResultValue as y };
|
|
310
|
+
//# sourceMappingURL=client-ChEdrVJ_.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-ChEdrVJ_.d.ts","names":[],"sources":["../src/client/public-types.ts","../src/client/api-types.ts","../src/client/result.ts","../src/client/runtime-helpers.ts","../src/client/connection.ts","../src/client/http-client.ts"],"mappings":";;;;KAGY;WAA2D;;UAEtD;EACf,SAAS;EACT,gBAAgB;aAAoB,UAAU;aAAmB,sBAAsB;MAAQ;;;;;;KAOrF,4BAA4B;KAE5B,YAAY,gBAAgB,KAAK,OAAO,gBAAgB,QAAQ;UAE3D;WACN;WACA;WACA;WACA;;UAGM;WACN,eAAe;WACf;WACA,cAAc;WACd,QAAQ;WACR,sBAAsB;WACtB,yBACP,uBACA,eACA;WAEO;WACA;WACA;WACA;;UAGM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