poe-code 3.0.420 → 3.0.422-beta.1

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.
Files changed (28) hide show
  1. package/dist/index.js +3 -1
  2. package/dist/index.js.map +2 -2
  3. package/dist/metafile.json +1 -1
  4. package/package.json +3 -1
  5. package/packages/frontmatter/package.json +1 -1
  6. package/packages/package-lint/dist/model.d.ts +2 -0
  7. package/packages/package-lint/dist/model.js +4 -0
  8. package/packages/package-lint/dist/rules/imported-workspace-dep-unresolvable.js +3 -0
  9. package/packages/tiny-mcp-client/dist/index.d.ts +660 -2
  10. package/packages/tiny-mcp-client/dist/index.js +3870 -1
  11. package/packages/tiny-mcp-client/dist/internal.d.ts +0 -556
  12. package/packages/tiny-mcp-client/dist/internal.js +0 -2688
  13. package/packages/tiny-mcp-client/dist/jsonrpc-types.compile-check.d.ts +0 -1
  14. package/packages/tiny-mcp-client/dist/jsonrpc-types.compile-check.js +0 -37
  15. package/packages/tiny-mcp-client/dist/mcp-lifecycle-types.compile-check.d.ts +0 -1
  16. package/packages/tiny-mcp-client/dist/mcp-lifecycle-types.compile-check.js +0 -50
  17. package/packages/tiny-mcp-client/dist/mcp-prompt-types.compile-check.d.ts +0 -1
  18. package/packages/tiny-mcp-client/dist/mcp-prompt-types.compile-check.js +0 -50
  19. package/packages/tiny-mcp-client/dist/mcp-resource-types.compile-check.d.ts +0 -1
  20. package/packages/tiny-mcp-client/dist/mcp-resource-types.compile-check.js +0 -51
  21. package/packages/tiny-mcp-client/dist/mcp-tool-types.compile-check.d.ts +0 -1
  22. package/packages/tiny-mcp-client/dist/mcp-tool-types.compile-check.js +0 -99
  23. package/packages/tiny-mcp-client/dist/mcp-transport-types.compile-check.d.ts +0 -1
  24. package/packages/tiny-mcp-client/dist/mcp-transport-types.compile-check.js +0 -56
  25. package/packages/tiny-mcp-client/dist/mcp-utility-types.compile-check.d.ts +0 -1
  26. package/packages/tiny-mcp-client/dist/mcp-utility-types.compile-check.js +0 -145
  27. package/packages/tiny-mcp-client/dist/oauth-discovery.d.ts +0 -24
  28. package/packages/tiny-mcp-client/dist/oauth-discovery.js +0 -382
@@ -1,2 +1,660 @@
1
- export { createInMemoryTransportPair, discoverOAuthMetadata, createSdkTestPair, createTestPair, ERROR_INTERNAL, ERROR_INVALID_PARAMS, ERROR_INVALID_REQUEST, ERROR_METHOD_NOT_FOUND, ERROR_PARSE, HttpTransport, JsonRpcMessageLayer, McpClient, McpError, OAuthMetadataDiscovery, StdioTransport, } from "./internal.js";
2
- export type { AudioContent, BlobResourceContents, CallToolOptions, CallToolParams, CallToolResult, ClientCapabilities, CompleteArgument, CompleteParams, CompleteResult, Completion, ContentItem, CreateMessageParams, CreateMessageResult, EmbeddedResource, GetPromptParams, GetPromptResult, HttpTransportFetch, HttpTransportOptions, ImageContent, Implementation, IncludeContext, InitializeParams, InitializeResult, InMemoryTransportPair, JsonRpcErrorObject, JsonRpcErrorResponse, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcRequestOptions, JsonRpcResponse, JsonRpcSuccessResponse, LogLevel, LogMessage, McpClientConnection, McpClientOptions, McpTransport, McpTransportClosedEvent, ModelHint, ModelPreferences, OAuthAuthorizationServerMetadata, OAuthClientProvider, OAuthClientProviderOptions, OAuthDiscoveryCache, OAuthDiscoveryResult, OAuthMetadataFetch, OAuthSessionStore, OAuthProtectedResourceMetadata, OAuthUnauthorizedChallenge, PaginatedParams, PaginatedResult, ProgressParams, ProgressToken, Prompt, PromptArgument, PromptMessage, PromptReference, ReadResourceParams, RequestId, Resource, ResourceContents, ResourceReference, ResourceTemplate, Root, SamplingMessage, SdkTestPair, ServerCapabilities, StdioSpawn, StdioTransportOptions, TextContent, TextResourceContents, Tool, ToolAnnotations, StoredOAuthSession, } from "./internal.js";
1
+ import { SpawnOptions, ChildProcessWithoutNullStreams } from 'node:child_process';
2
+ import { Readable, Writable } from 'node:stream';
3
+ import http from 'node:http';
4
+ import { Server } from '../../tiny-stdio-mcp-server/dist/index.js';
5
+
6
+ interface MachineIdentity {
7
+ hostname: string;
8
+ username: string;
9
+ }
10
+ interface EncryptedFileStoreFileSystem {
11
+ readFile(path: string, encoding: BufferEncoding): Promise<string>;
12
+ writeFile(path: string, data: string | NodeJS.ArrayBufferView, options?: {
13
+ encoding?: BufferEncoding;
14
+ flag?: string;
15
+ mode?: number;
16
+ }): Promise<void>;
17
+ mkdir(path: string, options?: {
18
+ recursive?: boolean;
19
+ }): Promise<void | string | undefined>;
20
+ rename(oldPath: string, newPath: string): Promise<void>;
21
+ lstat(path: string): Promise<{
22
+ isSymbolicLink(): boolean;
23
+ }>;
24
+ unlink(path: string): Promise<void>;
25
+ chmod(path: string, mode: number): Promise<void>;
26
+ }
27
+ interface EncryptedFileStoreInput {
28
+ fs?: EncryptedFileStoreFileSystem;
29
+ filePath?: string;
30
+ salt: string;
31
+ defaultDirectory?: string;
32
+ defaultFileName?: string;
33
+ getMachineIdentity?: () => MachineIdentity | Promise<MachineIdentity>;
34
+ getHomeDirectory?: () => string;
35
+ getRandomBytes?: (size: number) => Buffer;
36
+ }
37
+
38
+ interface KeychainCommandResult {
39
+ stdout: string;
40
+ stderr: string;
41
+ exitCode: number;
42
+ }
43
+ interface KeychainCommandOptions {
44
+ stdin?: string;
45
+ }
46
+ type KeychainCommandRunner = (command: string, args: string[], options?: KeychainCommandOptions) => Promise<KeychainCommandResult>;
47
+ interface KeychainStoreInput {
48
+ runCommand?: KeychainCommandRunner;
49
+ service: string;
50
+ account: string;
51
+ }
52
+
53
+ type StoreBackend = "file" | "keychain";
54
+ interface CreateSecretStoreInput {
55
+ backend?: StoreBackend;
56
+ env?: NodeJS.ProcessEnv;
57
+ platform?: NodeJS.Platform;
58
+ backendEnvVar?: string;
59
+ fileStore?: EncryptedFileStoreInput;
60
+ keychainStore?: KeychainStoreInput;
61
+ }
62
+
63
+ type OAuthMetadataFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
64
+ interface OAuthProtectedResourceMetadata extends Record<string, unknown> {
65
+ resource: string;
66
+ authorization_servers: string[];
67
+ }
68
+ interface OAuthAuthorizationServerMetadata extends Record<string, unknown> {
69
+ issuer: string;
70
+ authorization_endpoint: string;
71
+ token_endpoint: string;
72
+ registration_endpoint?: string;
73
+ response_types_supported: string[];
74
+ code_challenge_methods_supported: string[];
75
+ authorization_response_iss_parameter_supported?: boolean;
76
+ }
77
+ interface OAuthDiscoveryResult {
78
+ resource: string;
79
+ resourceMetadataUrl: string;
80
+ resourceMetadata: OAuthProtectedResourceMetadata;
81
+ authorizationServer: string;
82
+ authorizationServerMetadataUrl: string;
83
+ authorizationServerMetadata: OAuthAuthorizationServerMetadata;
84
+ }
85
+ interface OAuthUnauthorizedChallenge {
86
+ scheme: "Bearer";
87
+ params: Record<string, string>;
88
+ raw: string;
89
+ }
90
+ interface OAuthClientProvider {
91
+ authorizeRequest?(input: {
92
+ requestUrl: URL;
93
+ headers: Headers;
94
+ fetch: OAuthMetadataFetch;
95
+ }): Promise<void> | void;
96
+ handleUnauthorized(input: {
97
+ requestUrl: URL;
98
+ response: Response;
99
+ challenge: OAuthUnauthorizedChallenge | null;
100
+ discovery: OAuthDiscoveryResult;
101
+ fetch: OAuthMetadataFetch;
102
+ }): Promise<{
103
+ action: "retry";
104
+ } | {
105
+ action: "fail";
106
+ error?: Error;
107
+ }> | {
108
+ action: "retry";
109
+ } | {
110
+ action: "fail";
111
+ error?: Error;
112
+ };
113
+ }
114
+ interface OAuthClientMetadata {
115
+ clientName?: string;
116
+ scope?: string;
117
+ softwareId?: string;
118
+ softwareVersion?: string;
119
+ }
120
+ interface StoredOAuthTokens {
121
+ accessToken: string;
122
+ refreshToken?: string;
123
+ tokenType: "Bearer";
124
+ expiresAt: number | null;
125
+ scope?: string;
126
+ }
127
+ interface StoredOAuthSession {
128
+ resource: string;
129
+ authorizationServer: string;
130
+ client: {
131
+ clientId: string;
132
+ clientSecret?: string;
133
+ };
134
+ tokens?: StoredOAuthTokens;
135
+ discovery: {
136
+ resourceMetadataUrl: string;
137
+ resourceMetadata: Record<string, unknown>;
138
+ authorizationServerMetadata: Record<string, unknown>;
139
+ };
140
+ }
141
+ interface OAuthSessionStore {
142
+ load(resource: string): Promise<StoredOAuthSession | null>;
143
+ save(resource: string, session: StoredOAuthSession): Promise<void>;
144
+ clear(resource: string): Promise<void>;
145
+ }
146
+ interface DefaultOAuthClientProviderOptions {
147
+ client: {
148
+ mode: "dynamic";
149
+ clientId?: string;
150
+ clientSecret?: string;
151
+ metadata?: OAuthClientMetadata;
152
+ } | {
153
+ mode: "static";
154
+ clientId: string;
155
+ clientSecret?: string;
156
+ metadata?: OAuthClientMetadata;
157
+ };
158
+ browser: {
159
+ openBrowser(url: string): Promise<void>;
160
+ readLine?: () => Promise<string>;
161
+ createServer?: () => http.Server;
162
+ landingPage?: {
163
+ title: string;
164
+ body: string;
165
+ };
166
+ };
167
+ sessionStore?: OAuthSessionStore;
168
+ authStore?: CreateSecretStoreInput;
169
+ now?: () => number;
170
+ }
171
+ type OAuthClientProviderOptions = {
172
+ provider: OAuthClientProvider;
173
+ } | DefaultOAuthClientProviderOptions;
174
+
175
+ interface OAuthDiscoveryCache {
176
+ get(resourceUrl: string): OAuthDiscoveryResult | null | undefined | Promise<OAuthDiscoveryResult | null | undefined>;
177
+ set(resourceUrl: string, value: OAuthDiscoveryResult): void | Promise<void>;
178
+ }
179
+ interface OAuthMetadataDiscoveryOptions {
180
+ fetch?: OAuthMetadataFetch;
181
+ cache?: OAuthDiscoveryCache;
182
+ }
183
+ interface OAuthMetadataLookupOptions {
184
+ resourceMetadataUrl?: string | URL;
185
+ }
186
+ declare class OAuthMetadataDiscovery {
187
+ private readonly fetchImpl;
188
+ private readonly cache;
189
+ private readonly memoryCache;
190
+ constructor({ fetch, cache }?: OAuthMetadataDiscoveryOptions);
191
+ discover(resourceUrl: string | URL, { resourceMetadataUrl }?: OAuthMetadataLookupOptions): Promise<OAuthDiscoveryResult>;
192
+ }
193
+ declare function discoverOAuthMetadata(resourceUrl: string | URL, options?: OAuthMetadataDiscoveryOptions & OAuthMetadataLookupOptions): Promise<OAuthDiscoveryResult>;
194
+
195
+ type RequestId = number | string;
196
+ interface Implementation {
197
+ name: string;
198
+ version: string;
199
+ }
200
+ interface ClientCapabilities {
201
+ roots?: {
202
+ listChanged?: boolean;
203
+ [key: string]: unknown;
204
+ };
205
+ sampling?: {
206
+ [key: string]: unknown;
207
+ };
208
+ experimental?: Record<string, unknown>;
209
+ }
210
+ interface ServerCapabilities {
211
+ prompts?: {
212
+ listChanged?: boolean;
213
+ [key: string]: unknown;
214
+ };
215
+ resources?: {
216
+ subscribe?: boolean;
217
+ listChanged?: boolean;
218
+ [key: string]: unknown;
219
+ };
220
+ tools?: {
221
+ listChanged?: boolean;
222
+ [key: string]: unknown;
223
+ };
224
+ logging?: {
225
+ [key: string]: unknown;
226
+ };
227
+ completions?: {
228
+ [key: string]: unknown;
229
+ };
230
+ experimental?: Record<string, unknown>;
231
+ }
232
+ interface InitializeParams {
233
+ protocolVersion: string;
234
+ capabilities: ClientCapabilities;
235
+ clientInfo: Implementation;
236
+ }
237
+ interface InitializeResult {
238
+ protocolVersion: string;
239
+ capabilities: ServerCapabilities;
240
+ serverInfo: Implementation;
241
+ instructions?: string;
242
+ }
243
+ interface McpClientOptions {
244
+ clientInfo: Implementation;
245
+ requestTimeoutMs?: number;
246
+ capabilities?: ClientCapabilities;
247
+ onToolsChanged?: () => void | Promise<void>;
248
+ onResourcesChanged?: () => void | Promise<void>;
249
+ onResourceUpdated?: (uri: string) => void | Promise<void>;
250
+ onPromptsChanged?: () => void | Promise<void>;
251
+ onLog?: (message: LogMessage) => void | Promise<void>;
252
+ onProgress?: (params: ProgressParams) => void | Promise<void>;
253
+ onSamplingRequest?: (params: CreateMessageParams) => CreateMessageResult | Promise<CreateMessageResult>;
254
+ onRootsList?: () => Root[] | Promise<Root[]>;
255
+ }
256
+ declare class McpClient {
257
+ private currentState;
258
+ private currentServerCapabilities;
259
+ private currentClientCapabilities;
260
+ private currentServerInfo;
261
+ private currentInstructions;
262
+ private readonly subscribedResourceUris;
263
+ private readonly activeProgressTokens;
264
+ private readonly options;
265
+ private transport;
266
+ private messageLayer;
267
+ constructor(options: McpClientOptions);
268
+ get state(): "disconnected" | "initializing" | "ready" | "closed";
269
+ get serverCapabilities(): ServerCapabilities | null;
270
+ get serverInfo(): Implementation | null;
271
+ get instructions(): string | undefined;
272
+ private getMessageLayerOrThrow;
273
+ connect(transport: McpTransport): Promise<InitializeResult>;
274
+ private getServerCapabilitiesOrThrow;
275
+ listTools(params?: PaginatedParams): Promise<{
276
+ tools: Tool[];
277
+ nextCursor?: string;
278
+ }>;
279
+ callTool(params: CallToolParams, options?: CallToolOptions): Promise<CallToolResult>;
280
+ listResources(params?: PaginatedParams): Promise<{
281
+ resources: Resource[];
282
+ nextCursor?: string;
283
+ }>;
284
+ listResourceTemplates(params?: PaginatedParams): Promise<{
285
+ resourceTemplates: ResourceTemplate[];
286
+ nextCursor?: string;
287
+ }>;
288
+ readResource(params: ReadResourceParams): Promise<{
289
+ contents: ResourceContents[];
290
+ }>;
291
+ subscribe(uri: string): Promise<void>;
292
+ unsubscribe(uri: string): Promise<void>;
293
+ listPrompts(params?: PaginatedParams): Promise<{
294
+ prompts: Prompt[];
295
+ nextCursor?: string;
296
+ }>;
297
+ getPrompt(params: GetPromptParams): Promise<GetPromptResult>;
298
+ complete(params: CompleteParams): Promise<CompleteResult>;
299
+ setLogLevel(level: LogLevel): Promise<void>;
300
+ cancel(requestId: RequestId, reason?: string): Promise<void>;
301
+ sendRootsChanged(): Promise<void>;
302
+ ping(): Promise<void>;
303
+ close(): Promise<void>;
304
+ }
305
+ interface Tool {
306
+ name: string;
307
+ description?: string;
308
+ inputSchema: Record<string, unknown>;
309
+ outputSchema?: Record<string, unknown>;
310
+ annotations?: ToolAnnotations;
311
+ }
312
+ interface ToolAnnotations {
313
+ title?: string;
314
+ readOnlyHint?: boolean;
315
+ destructiveHint?: boolean;
316
+ idempotentHint?: boolean;
317
+ openWorldHint?: boolean;
318
+ }
319
+ interface CallToolParams {
320
+ name: string;
321
+ arguments?: Record<string, unknown>;
322
+ }
323
+ interface CallToolOptions {
324
+ signal?: AbortSignal;
325
+ progressToken?: ProgressToken;
326
+ }
327
+ interface ReadResourceParams {
328
+ uri: string;
329
+ }
330
+ interface Resource {
331
+ uri: string;
332
+ name: string;
333
+ description?: string;
334
+ mimeType?: string;
335
+ size?: number;
336
+ }
337
+ interface ResourceTemplate {
338
+ uriTemplate: string;
339
+ name: string;
340
+ description?: string;
341
+ mimeType?: string;
342
+ }
343
+ interface PaginatedParams {
344
+ cursor?: string;
345
+ }
346
+ interface PaginatedResult {
347
+ nextCursor?: string;
348
+ }
349
+ interface TextResourceContents {
350
+ uri: string;
351
+ mimeType?: string;
352
+ text: string;
353
+ }
354
+ interface BlobResourceContents {
355
+ uri: string;
356
+ mimeType?: string;
357
+ blob: string;
358
+ }
359
+ type ResourceContents = TextResourceContents | BlobResourceContents;
360
+ interface TextContent {
361
+ type: "text";
362
+ text: string;
363
+ }
364
+ interface ImageContent {
365
+ type: "image";
366
+ data: string;
367
+ mimeType: string;
368
+ }
369
+ interface AudioContent {
370
+ type: "audio";
371
+ data: string;
372
+ mimeType: string;
373
+ }
374
+ interface EmbeddedResource {
375
+ type: "resource";
376
+ resource: ResourceContents;
377
+ }
378
+ type ContentItem = TextContent | ImageContent | AudioContent | EmbeddedResource;
379
+ interface Prompt {
380
+ name: string;
381
+ description?: string;
382
+ arguments?: PromptArgument[];
383
+ }
384
+ interface PromptArgument {
385
+ name: string;
386
+ description?: string;
387
+ required?: boolean;
388
+ }
389
+ interface PromptMessage {
390
+ role: "user" | "assistant";
391
+ content: ContentItem;
392
+ }
393
+ interface GetPromptResult {
394
+ description?: string;
395
+ messages: PromptMessage[];
396
+ }
397
+ interface GetPromptParams {
398
+ name: string;
399
+ arguments?: Record<string, string>;
400
+ }
401
+ interface CallToolResult {
402
+ content: ContentItem[];
403
+ structuredContent?: Record<string, unknown>;
404
+ isError?: boolean;
405
+ }
406
+ interface Root {
407
+ uri: string;
408
+ name?: string;
409
+ }
410
+ type LogLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
411
+ interface LogMessage {
412
+ level: LogLevel;
413
+ logger?: string;
414
+ data: unknown;
415
+ }
416
+ type ProgressToken = RequestId;
417
+ interface ProgressParams {
418
+ progressToken: ProgressToken;
419
+ progress: number;
420
+ total?: number;
421
+ message?: string;
422
+ }
423
+ interface ModelHint {
424
+ name?: string;
425
+ }
426
+ interface ModelPreferences {
427
+ hints?: ModelHint[];
428
+ costPriority?: number;
429
+ speedPriority?: number;
430
+ intelligencePriority?: number;
431
+ }
432
+ interface SamplingMessage {
433
+ role: "user" | "assistant";
434
+ content: ContentItem | ContentItem[];
435
+ }
436
+ type IncludeContext = "none" | "thisServer" | "allServers";
437
+ interface CreateMessageParams {
438
+ messages: SamplingMessage[];
439
+ modelPreferences?: ModelPreferences;
440
+ systemPrompt?: string;
441
+ includeContext?: IncludeContext;
442
+ temperature?: number;
443
+ maxTokens: number;
444
+ stopSequences?: string[];
445
+ metadata?: Record<string, unknown>;
446
+ }
447
+ interface CreateMessageResult {
448
+ model: string;
449
+ content: ContentItem | ContentItem[];
450
+ role: "user" | "assistant";
451
+ stopReason: string;
452
+ }
453
+ interface PromptReference {
454
+ type: "ref/prompt";
455
+ name: string;
456
+ }
457
+ interface ResourceReference {
458
+ type: "ref/resource";
459
+ uri: string;
460
+ }
461
+ interface CompleteArgument {
462
+ name: string;
463
+ value: string;
464
+ }
465
+ interface CompleteParams {
466
+ ref: PromptReference | ResourceReference;
467
+ argument: CompleteArgument;
468
+ }
469
+ interface Completion {
470
+ values: string[];
471
+ hasMore?: boolean;
472
+ total?: number;
473
+ }
474
+ interface CompleteResult {
475
+ completion: Completion;
476
+ }
477
+ declare const ERROR_PARSE = -32700;
478
+ declare const ERROR_INVALID_REQUEST = -32600;
479
+ declare const ERROR_METHOD_NOT_FOUND = -32601;
480
+ declare const ERROR_INVALID_PARAMS = -32602;
481
+ declare const ERROR_INTERNAL = -32603;
482
+ interface McpTransportClosedEvent {
483
+ reason: Error;
484
+ code?: number;
485
+ signal?: NodeJS.Signals;
486
+ }
487
+ interface McpTransport {
488
+ readable: Readable;
489
+ writable: Writable;
490
+ closed: Promise<McpTransportClosedEvent>;
491
+ dispose(reason?: Error): void;
492
+ }
493
+ interface InMemoryServerTransport {
494
+ readable: Readable;
495
+ writable: Writable;
496
+ }
497
+ interface InMemoryTransportPair {
498
+ clientTransport: McpTransport;
499
+ serverTransport: InMemoryServerTransport;
500
+ }
501
+ declare function createInMemoryTransportPair(): InMemoryTransportPair;
502
+ interface McpClientConnection {
503
+ connect(transport: McpTransport): Promise<void>;
504
+ close(): Promise<void>;
505
+ }
506
+ interface SdkServerConnection {
507
+ connect(transport: unknown): Promise<void>;
508
+ }
509
+ interface SdkTestPair<TClient extends McpClientConnection> {
510
+ client: TClient;
511
+ cleanup: () => Promise<void>;
512
+ }
513
+ declare function createSdkTestPair<TClient extends McpClientConnection>(server: SdkServerConnection, createClient: () => TClient): Promise<SdkTestPair<TClient>>;
514
+ declare function createTestPair<TClient extends McpClientConnection>(server: Server, createClient: () => TClient): Promise<SdkTestPair<TClient>>;
515
+ type StdioSpawn = (command: string, args: ReadonlyArray<string>, options: SpawnOptions) => ChildProcessWithoutNullStreams;
516
+ interface StdioTransportOptions {
517
+ command: string;
518
+ args?: string[];
519
+ cwd?: string;
520
+ env?: NodeJS.ProcessEnv;
521
+ spawn?: StdioSpawn;
522
+ }
523
+ type HttpTransportFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
524
+ interface HttpTransportOptions {
525
+ url: string;
526
+ headers?: HeadersInit;
527
+ fetch?: HttpTransportFetch;
528
+ oauth?: OAuthClientProviderOptions;
529
+ oauthDiscoveryCache?: OAuthDiscoveryCache;
530
+ }
531
+ declare class StdioTransport implements McpTransport {
532
+ readonly readable: Readable;
533
+ readonly writable: Writable;
534
+ readonly closed: Promise<McpTransportClosedEvent>;
535
+ private readonly child;
536
+ private disposed;
537
+ private stderrOutput;
538
+ private static readonly STDERR_MAX_LENGTH;
539
+ constructor({ command, args, cwd, env, spawn: spawnProcess, }: StdioTransportOptions);
540
+ getStderrOutput(): string;
541
+ private appendStderrOutput;
542
+ dispose(reason?: Error): void;
543
+ }
544
+ declare class HttpTransport implements McpTransport {
545
+ readonly readable: Readable;
546
+ readonly writable: Writable;
547
+ readonly closed: Promise<McpTransportClosedEvent>;
548
+ private readonly url;
549
+ private readonly headers;
550
+ private readonly fetchImpl;
551
+ private readonly readStream;
552
+ private readonly writeStream;
553
+ private resolveClosed;
554
+ private sessionId;
555
+ private lastEventId;
556
+ private getSseStreamStarted;
557
+ private disposed;
558
+ private readonly oauthProvider;
559
+ private readonly oauthMetadataDiscovery;
560
+ private readonly inFlightFetchAbortControllers;
561
+ private readonly openSseReaders;
562
+ constructor({ url, headers, fetch: fetchImpl, oauth, oauthDiscoveryCache, }: HttpTransportOptions);
563
+ dispose(reason?: Error): void;
564
+ private closeWithSessionTermination;
565
+ private abortInFlightFetches;
566
+ private cancelOpenSseReaders;
567
+ private fetchWithAbort;
568
+ private consumeWrittenLines;
569
+ private createPostHeaders;
570
+ private createGetHeaders;
571
+ private createDeleteHeaders;
572
+ private authorizeRequestHeaders;
573
+ private captureSessionId;
574
+ private maybeOpenGetSseStream;
575
+ private sendSessionTerminationRequest;
576
+ private consumeGetSseStream;
577
+ private throwForPostHttpError;
578
+ private maybeHandleUnauthorizedResponse;
579
+ private forwardResponseMessages;
580
+ private forwardSseResponseMessages;
581
+ private forwardJsonResponseMessage;
582
+ private writeSseMessages;
583
+ private writeReadableLine;
584
+ private fetchWithOAuthRetry;
585
+ private readOAuthChallengeError;
586
+ }
587
+ interface JsonRpcRequest {
588
+ jsonrpc: "2.0";
589
+ id: RequestId;
590
+ method: string;
591
+ params?: unknown;
592
+ }
593
+ interface JsonRpcNotification {
594
+ jsonrpc: "2.0";
595
+ method: string;
596
+ params?: unknown;
597
+ }
598
+ interface JsonRpcErrorObject {
599
+ code: number;
600
+ message: string;
601
+ data?: unknown;
602
+ }
603
+ declare class McpError extends Error {
604
+ readonly code: number;
605
+ readonly data?: unknown;
606
+ constructor(code: number, message: string, data?: unknown);
607
+ }
608
+ interface JsonRpcSuccessResponse {
609
+ jsonrpc: "2.0";
610
+ id: RequestId;
611
+ result: unknown;
612
+ }
613
+ interface JsonRpcErrorResponse {
614
+ jsonrpc: "2.0";
615
+ id: RequestId;
616
+ error: JsonRpcErrorObject;
617
+ }
618
+ type JsonRpcResponse = JsonRpcSuccessResponse | JsonRpcErrorResponse;
619
+ type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
620
+ interface JsonRpcRequestOptions {
621
+ timeoutMs?: number;
622
+ onRequestId?: (requestId: RequestId) => void;
623
+ onTimeout?: (requestId: RequestId) => void;
624
+ }
625
+ interface JsonRpcRequestContext {
626
+ id: RequestId;
627
+ method: string;
628
+ }
629
+ type JsonRpcRequestHandler = (params: unknown, context: JsonRpcRequestContext) => unknown | Promise<unknown>;
630
+ interface JsonRpcNotificationContext {
631
+ method: string;
632
+ }
633
+ type JsonRpcNotificationHandler = (params: unknown, context: JsonRpcNotificationContext) => unknown | Promise<unknown>;
634
+ declare class JsonRpcMessageLayer {
635
+ readonly requestTimeoutMs: number;
636
+ private readonly input;
637
+ private readonly output;
638
+ private readonly inputClosedReason;
639
+ private nextRequestId;
640
+ private disposedError;
641
+ private readonly pendingRequests;
642
+ private readonly activeIncomingRequests;
643
+ private readonly requestHandlers;
644
+ private readonly notificationHandlers;
645
+ constructor(input: Readable, output: Writable, requestTimeoutMs?: number, inputClosedReason?: Promise<Error>);
646
+ sendNotification(method: string, params?: unknown): void;
647
+ onRequest(method: string, handler: JsonRpcRequestHandler): void;
648
+ onNotification(method: string, handler: JsonRpcNotificationHandler): void;
649
+ sendRequest(method: string, params?: unknown, options?: JsonRpcRequestOptions): Promise<unknown>;
650
+ cancelRequest(requestId: RequestId, reason: unknown): boolean;
651
+ dispose(reason?: Error): void;
652
+ private consumeInput;
653
+ private resolveInputStreamClosedReason;
654
+ private processParsedMessage;
655
+ private handleIncomingRequest;
656
+ private handleCancellationNotification;
657
+ }
658
+
659
+ export { ERROR_INTERNAL, ERROR_INVALID_PARAMS, ERROR_INVALID_REQUEST, ERROR_METHOD_NOT_FOUND, ERROR_PARSE, HttpTransport, JsonRpcMessageLayer, McpClient, McpError, OAuthMetadataDiscovery, StdioTransport, createInMemoryTransportPair, createSdkTestPair, createTestPair, discoverOAuthMetadata };
660
+ export type { AudioContent, BlobResourceContents, CallToolOptions, CallToolParams, CallToolResult, ClientCapabilities, CompleteArgument, CompleteParams, CompleteResult, Completion, ContentItem, CreateMessageParams, CreateMessageResult, EmbeddedResource, GetPromptParams, GetPromptResult, HttpTransportFetch, HttpTransportOptions, ImageContent, Implementation, InMemoryTransportPair, IncludeContext, InitializeParams, InitializeResult, JsonRpcErrorObject, JsonRpcErrorResponse, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcRequestOptions, JsonRpcResponse, JsonRpcSuccessResponse, LogLevel, LogMessage, McpClientConnection, McpClientOptions, McpTransport, McpTransportClosedEvent, ModelHint, ModelPreferences, OAuthAuthorizationServerMetadata, OAuthClientProvider, OAuthClientProviderOptions, OAuthDiscoveryCache, OAuthDiscoveryResult, OAuthMetadataFetch, OAuthProtectedResourceMetadata, OAuthSessionStore, OAuthUnauthorizedChallenge, PaginatedParams, PaginatedResult, ProgressParams, ProgressToken, Prompt, PromptArgument, PromptMessage, PromptReference, ReadResourceParams, RequestId, Resource, ResourceContents, ResourceReference, ResourceTemplate, Root, SamplingMessage, SdkTestPair, ServerCapabilities, StdioSpawn, StdioTransportOptions, StoredOAuthSession, TextContent, TextResourceContents, Tool, ToolAnnotations };