tiny-http-mcp-server 0.1.17 → 0.1.19
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/dist/cli.js +14 -2
- package/dist/composition.json +1 -1
- package/dist/http-server.d.ts +7 -5
- package/dist/http-server.js +3 -11
- package/dist/http-transport.d.ts +6 -1
- package/dist/http-transport.js +196 -15
- package/dist/index.d.ts +2 -2
- package/dist/modern-headers.d.ts +3 -0
- package/dist/modern-headers.js +35 -0
- package/dist/parse-body.d.ts +1 -0
- package/dist/parse-body.js +9 -5
- package/dist/test-support.js +17 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +3 -2
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +21 -4
- package/node_modules/mcp-oauth/dist/client/token-endpoint.d.ts +1 -1
- package/node_modules/mcp-oauth/dist/client/token-endpoint.js +14 -6
- package/node_modules/mcp-oauth/dist/http-fetch.d.ts +1 -0
- package/node_modules/mcp-oauth/dist/http-fetch.js +8 -0
- package/node_modules/mcp-oauth/dist/http-response.d.ts +1 -0
- package/node_modules/mcp-oauth/dist/http-response.js +50 -0
- package/node_modules/mcp-oauth/dist/index.d.ts +2 -0
- package/node_modules/mcp-oauth/dist/index.js +2 -0
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +21 -3
- package/node_modules/tiny-mcp-client/README.md +1 -0
- package/node_modules/tiny-mcp-client/dist/index.d.ts +178 -101
- package/node_modules/tiny-mcp-client/dist/index.js +4696 -291
- package/node_modules/tiny-mcp-client/package.json +2 -1
- package/package.json +1 -1
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { SpawnOptions, ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
2
2
|
import { Readable, Writable } from 'node:stream';
|
|
3
3
|
import http from 'node:http';
|
|
4
|
-
import { Server } from 'tiny-stdio-mcp-server';
|
|
4
|
+
import { ContentItem as ContentItem$1, ResourceContents as ResourceContents$1, Implementation, Tool as Tool$1, Resource, ResourceTemplate, Prompt, Server } from 'tiny-stdio-mcp-server';
|
|
5
|
+
export { ContentAnnotations, Icon, Implementation, Prompt, PromptArgument, Resource, ResourceLink, ResourceTemplate, ToolAnnotations, ToolExecution } from 'tiny-stdio-mcp-server';
|
|
6
|
+
|
|
7
|
+
interface NotificationFilter {
|
|
8
|
+
toolsListChanged?: boolean;
|
|
9
|
+
promptsListChanged?: boolean;
|
|
10
|
+
resourcesListChanged?: boolean;
|
|
11
|
+
resourceSubscriptions?: string[];
|
|
12
|
+
}
|
|
13
|
+
interface SubscriptionOptions {
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
interface McpSubscription {
|
|
17
|
+
readonly id: RequestId;
|
|
18
|
+
readonly notifications: NotificationFilter;
|
|
19
|
+
readonly closed: Promise<void>;
|
|
20
|
+
cancel(): void;
|
|
21
|
+
}
|
|
5
22
|
|
|
6
23
|
interface MachineIdentity {
|
|
7
24
|
hostname: string;
|
|
@@ -172,9 +189,12 @@ type OAuthClientProviderOptions = {
|
|
|
172
189
|
provider: OAuthClientProvider;
|
|
173
190
|
} | DefaultOAuthClientProviderOptions;
|
|
174
191
|
|
|
192
|
+
declare function fetchMcpResponse(fetchImplementation: (input: string | URL, init?: RequestInit) => Promise<Response>, input: string | URL, init?: RequestInit): Promise<Response>;
|
|
193
|
+
|
|
175
194
|
interface OAuthDiscoveryCache {
|
|
176
195
|
get(resourceUrl: string): OAuthDiscoveryResult | null | undefined | Promise<OAuthDiscoveryResult | null | undefined>;
|
|
177
196
|
set(resourceUrl: string, value: OAuthDiscoveryResult): void | Promise<void>;
|
|
197
|
+
delete?(resourceUrl: string): void | Promise<void>;
|
|
178
198
|
}
|
|
179
199
|
interface OAuthMetadataDiscoveryOptions {
|
|
180
200
|
fetch?: OAuthMetadataFetch;
|
|
@@ -188,16 +208,18 @@ declare class OAuthMetadataDiscovery {
|
|
|
188
208
|
private readonly cache;
|
|
189
209
|
private readonly memoryCache;
|
|
190
210
|
constructor({ fetch, cache }?: OAuthMetadataDiscoveryOptions);
|
|
211
|
+
private discoverProtectedResource;
|
|
191
212
|
discover(resourceUrl: string | URL, { resourceMetadataUrl }?: OAuthMetadataLookupOptions): Promise<OAuthDiscoveryResult>;
|
|
192
213
|
}
|
|
193
214
|
declare function discoverOAuthMetadata(resourceUrl: string | URL, options?: OAuthMetadataDiscoveryOptions & OAuthMetadataLookupOptions): Promise<OAuthDiscoveryResult>;
|
|
194
215
|
|
|
195
216
|
type RequestId = number | string;
|
|
196
|
-
interface Implementation {
|
|
197
|
-
name: string;
|
|
198
|
-
version: string;
|
|
199
|
-
}
|
|
200
217
|
interface ClientCapabilities {
|
|
218
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
219
|
+
elicitation?: {
|
|
220
|
+
form?: Record<string, unknown>;
|
|
221
|
+
url?: Record<string, unknown>;
|
|
222
|
+
};
|
|
201
223
|
roots?: {
|
|
202
224
|
listChanged?: boolean;
|
|
203
225
|
[key: string]: unknown;
|
|
@@ -208,6 +230,7 @@ interface ClientCapabilities {
|
|
|
208
230
|
experimental?: Record<string, unknown>;
|
|
209
231
|
}
|
|
210
232
|
interface ServerCapabilities {
|
|
233
|
+
extensions?: Record<string, Record<string, unknown>>;
|
|
211
234
|
prompts?: {
|
|
212
235
|
listChanged?: boolean;
|
|
213
236
|
[key: string]: unknown;
|
|
@@ -240,9 +263,32 @@ interface InitializeResult {
|
|
|
240
263
|
serverInfo: Implementation;
|
|
241
264
|
instructions?: string;
|
|
242
265
|
}
|
|
266
|
+
interface ConnectResult {
|
|
267
|
+
protocolVersion: string;
|
|
268
|
+
capabilities: ServerCapabilities;
|
|
269
|
+
serverInfo?: Implementation;
|
|
270
|
+
instructions?: string;
|
|
271
|
+
}
|
|
272
|
+
type ElicitationParams = {
|
|
273
|
+
mode?: "form";
|
|
274
|
+
message: string;
|
|
275
|
+
requestedSchema: Record<string, unknown>;
|
|
276
|
+
} | {
|
|
277
|
+
mode: "url";
|
|
278
|
+
message: string;
|
|
279
|
+
url: string;
|
|
280
|
+
elicitationId: string;
|
|
281
|
+
};
|
|
282
|
+
interface ElicitationResult {
|
|
283
|
+
_meta?: Record<string, unknown>;
|
|
284
|
+
action: "accept" | "decline" | "cancel";
|
|
285
|
+
content?: Record<string, string | number | boolean | string[]>;
|
|
286
|
+
}
|
|
243
287
|
interface McpClientOptions {
|
|
244
288
|
clientInfo: Implementation;
|
|
245
289
|
requestTimeoutMs?: number;
|
|
290
|
+
maxConcurrentRequests?: number;
|
|
291
|
+
protocolVersion?: "2025-03-26" | "2026-07-28";
|
|
246
292
|
capabilities?: ClientCapabilities;
|
|
247
293
|
onToolsChanged?: () => void | Promise<void>;
|
|
248
294
|
onResourcesChanged?: () => void | Promise<void>;
|
|
@@ -250,8 +296,9 @@ interface McpClientOptions {
|
|
|
250
296
|
onPromptsChanged?: () => void | Promise<void>;
|
|
251
297
|
onLog?: (message: LogMessage) => void | Promise<void>;
|
|
252
298
|
onProgress?: (params: ProgressParams) => void | Promise<void>;
|
|
253
|
-
onSamplingRequest?: (params: CreateMessageParams) => CreateMessageResult | Promise<CreateMessageResult>;
|
|
254
|
-
onRootsList?: () => Root[] | Promise<Root[]>;
|
|
299
|
+
onSamplingRequest?: (params: CreateMessageParams, context: McpRequestContext) => CreateMessageResult | Promise<CreateMessageResult>;
|
|
300
|
+
onRootsList?: (context: McpRequestContext) => Root[] | Promise<Root[]>;
|
|
301
|
+
onElicitationRequest?: (params: ElicitationParams, context: McpRequestContext) => ElicitationResult | Promise<ElicitationResult>;
|
|
255
302
|
}
|
|
256
303
|
declare class McpClient {
|
|
257
304
|
private currentState;
|
|
@@ -264,58 +311,70 @@ declare class McpClient {
|
|
|
264
311
|
private readonly options;
|
|
265
312
|
private transport;
|
|
266
313
|
private messageLayer;
|
|
314
|
+
private subscriptions;
|
|
315
|
+
private readonly resourceSubscriptions;
|
|
267
316
|
constructor(options: McpClientOptions);
|
|
268
317
|
get state(): "disconnected" | "initializing" | "ready" | "closed";
|
|
269
318
|
get serverCapabilities(): ServerCapabilities | null;
|
|
270
319
|
get serverInfo(): Implementation | null;
|
|
271
320
|
get instructions(): string | undefined;
|
|
272
321
|
private getMessageLayerOrThrow;
|
|
273
|
-
connect(transport: McpTransport
|
|
322
|
+
connect(transport: McpTransport, options?: {
|
|
323
|
+
signal?: AbortSignal;
|
|
324
|
+
}): Promise<ConnectResult>;
|
|
274
325
|
private getServerCapabilitiesOrThrow;
|
|
275
|
-
listTools(params?: PaginatedParams
|
|
326
|
+
listTools(params?: PaginatedParams, options?: {
|
|
327
|
+
signal?: AbortSignal;
|
|
328
|
+
}): Promise<PaginatedResult & {
|
|
276
329
|
tools: Tool[];
|
|
277
|
-
nextCursor?: string;
|
|
278
330
|
}>;
|
|
279
331
|
callTool(params: CallToolParams, options?: CallToolOptions): Promise<CallToolResult>;
|
|
280
|
-
listResources(params?: PaginatedParams
|
|
332
|
+
listResources(params?: PaginatedParams, options?: {
|
|
333
|
+
signal?: AbortSignal;
|
|
334
|
+
}): Promise<PaginatedResult & {
|
|
281
335
|
resources: Resource[];
|
|
282
|
-
nextCursor?: string;
|
|
283
336
|
}>;
|
|
284
|
-
listResourceTemplates(params?: PaginatedParams
|
|
337
|
+
listResourceTemplates(params?: PaginatedParams, options?: {
|
|
338
|
+
signal?: AbortSignal;
|
|
339
|
+
}): Promise<PaginatedResult & {
|
|
285
340
|
resourceTemplates: ResourceTemplate[];
|
|
286
|
-
nextCursor?: string;
|
|
287
341
|
}>;
|
|
288
|
-
readResource(params: ReadResourceParams
|
|
342
|
+
readResource(params: ReadResourceParams, options?: {
|
|
343
|
+
signal?: AbortSignal;
|
|
344
|
+
}): Promise<CacheableResultMetadata & {
|
|
289
345
|
contents: ResourceContents[];
|
|
290
346
|
}>;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
347
|
+
listenNotifications(filter: NotificationFilter, options?: SubscriptionOptions): Promise<McpSubscription>;
|
|
348
|
+
subscribe(uri: string, options?: {
|
|
349
|
+
signal?: AbortSignal;
|
|
350
|
+
}): Promise<void>;
|
|
351
|
+
unsubscribe(uri: string, options?: {
|
|
352
|
+
signal?: AbortSignal;
|
|
353
|
+
}): Promise<void>;
|
|
354
|
+
listPrompts(params?: PaginatedParams, options?: {
|
|
355
|
+
signal?: AbortSignal;
|
|
356
|
+
}): Promise<PaginatedResult & {
|
|
294
357
|
prompts: Prompt[];
|
|
295
|
-
nextCursor?: string;
|
|
296
358
|
}>;
|
|
297
|
-
getPrompt(params: GetPromptParams
|
|
298
|
-
|
|
299
|
-
|
|
359
|
+
getPrompt(params: GetPromptParams, options?: {
|
|
360
|
+
signal?: AbortSignal;
|
|
361
|
+
}): Promise<GetPromptResult>;
|
|
362
|
+
complete(params: CompleteParams, options?: {
|
|
363
|
+
signal?: AbortSignal;
|
|
364
|
+
}): Promise<CompleteResult>;
|
|
365
|
+
setLogLevel(level: LogLevel, options?: {
|
|
366
|
+
signal?: AbortSignal;
|
|
367
|
+
}): Promise<void>;
|
|
300
368
|
cancel(requestId: RequestId, reason?: string): Promise<void>;
|
|
301
369
|
sendRootsChanged(): Promise<void>;
|
|
302
|
-
ping(
|
|
370
|
+
ping(options?: {
|
|
371
|
+
signal?: AbortSignal;
|
|
372
|
+
}): Promise<void>;
|
|
303
373
|
close(): Promise<void>;
|
|
304
374
|
}
|
|
305
|
-
interface Tool {
|
|
306
|
-
name: string;
|
|
307
|
-
title?: string;
|
|
308
|
-
description?: string;
|
|
375
|
+
interface Tool extends Omit<Tool$1, "inputSchema" | "outputSchema"> {
|
|
309
376
|
inputSchema: Record<string, unknown>;
|
|
310
377
|
outputSchema?: Record<string, unknown>;
|
|
311
|
-
annotations?: ToolAnnotations;
|
|
312
|
-
}
|
|
313
|
-
interface ToolAnnotations {
|
|
314
|
-
title?: string;
|
|
315
|
-
readOnlyHint?: boolean;
|
|
316
|
-
destructiveHint?: boolean;
|
|
317
|
-
idempotentHint?: boolean;
|
|
318
|
-
openWorldHint?: boolean;
|
|
319
378
|
}
|
|
320
379
|
interface CallToolParams {
|
|
321
380
|
name: string;
|
|
@@ -328,70 +387,45 @@ interface CallToolOptions {
|
|
|
328
387
|
interface ReadResourceParams {
|
|
329
388
|
uri: string;
|
|
330
389
|
}
|
|
331
|
-
interface Resource {
|
|
332
|
-
uri: string;
|
|
333
|
-
name: string;
|
|
334
|
-
description?: string;
|
|
335
|
-
mimeType?: string;
|
|
336
|
-
size?: number;
|
|
337
|
-
}
|
|
338
|
-
interface ResourceTemplate {
|
|
339
|
-
uriTemplate: string;
|
|
340
|
-
name: string;
|
|
341
|
-
description?: string;
|
|
342
|
-
mimeType?: string;
|
|
343
|
-
}
|
|
344
390
|
interface PaginatedParams {
|
|
345
391
|
cursor?: string;
|
|
346
392
|
}
|
|
347
|
-
interface
|
|
393
|
+
interface ResultMetadata {
|
|
394
|
+
resultType?: "complete";
|
|
395
|
+
_meta?: Record<string, unknown>;
|
|
396
|
+
}
|
|
397
|
+
interface CacheableResultMetadata extends ResultMetadata {
|
|
398
|
+
ttlMs?: number;
|
|
399
|
+
cacheScope?: "public" | "private";
|
|
400
|
+
}
|
|
401
|
+
interface PaginatedResult extends CacheableResultMetadata {
|
|
348
402
|
nextCursor?: string;
|
|
349
403
|
}
|
|
350
|
-
|
|
351
|
-
uri: string;
|
|
352
|
-
mimeType?: string;
|
|
404
|
+
type TextResourceContents = Extract<ResourceContents$1, {
|
|
353
405
|
text: string;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
uri: string;
|
|
357
|
-
mimeType?: string;
|
|
406
|
+
}>;
|
|
407
|
+
type BlobResourceContents = Extract<ResourceContents$1, {
|
|
358
408
|
blob: string;
|
|
359
|
-
}
|
|
360
|
-
type ResourceContents =
|
|
361
|
-
|
|
409
|
+
}>;
|
|
410
|
+
type ResourceContents = ResourceContents$1;
|
|
411
|
+
type TextContent = Extract<ContentItem$1, {
|
|
362
412
|
type: "text";
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
interface ImageContent {
|
|
413
|
+
}>;
|
|
414
|
+
type ImageContent = Extract<ContentItem$1, {
|
|
366
415
|
type: "image";
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
interface AudioContent {
|
|
416
|
+
}>;
|
|
417
|
+
type AudioContent = Extract<ContentItem$1, {
|
|
371
418
|
type: "audio";
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
}
|
|
375
|
-
interface EmbeddedResource {
|
|
419
|
+
}>;
|
|
420
|
+
type EmbeddedResource = Extract<ContentItem$1, {
|
|
376
421
|
type: "resource";
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
type ContentItem = TextContent | ImageContent | AudioContent | EmbeddedResource;
|
|
380
|
-
interface Prompt {
|
|
381
|
-
name: string;
|
|
382
|
-
description?: string;
|
|
383
|
-
arguments?: PromptArgument[];
|
|
384
|
-
}
|
|
385
|
-
interface PromptArgument {
|
|
386
|
-
name: string;
|
|
387
|
-
description?: string;
|
|
388
|
-
required?: boolean;
|
|
389
|
-
}
|
|
422
|
+
}>;
|
|
423
|
+
type ContentItem = ContentItem$1;
|
|
390
424
|
interface PromptMessage {
|
|
391
425
|
role: "user" | "assistant";
|
|
392
426
|
content: ContentItem;
|
|
393
427
|
}
|
|
394
|
-
interface GetPromptResult {
|
|
428
|
+
interface GetPromptResult extends ResultMetadata {
|
|
395
429
|
description?: string;
|
|
396
430
|
messages: PromptMessage[];
|
|
397
431
|
}
|
|
@@ -399,12 +433,13 @@ interface GetPromptParams {
|
|
|
399
433
|
name: string;
|
|
400
434
|
arguments?: Record<string, string>;
|
|
401
435
|
}
|
|
402
|
-
interface CallToolResult {
|
|
436
|
+
interface CallToolResult extends ResultMetadata {
|
|
403
437
|
content: ContentItem[];
|
|
404
|
-
structuredContent?:
|
|
438
|
+
structuredContent?: unknown;
|
|
405
439
|
isError?: boolean;
|
|
406
440
|
}
|
|
407
441
|
interface Root {
|
|
442
|
+
_meta?: Record<string, unknown>;
|
|
408
443
|
uri: string;
|
|
409
444
|
name?: string;
|
|
410
445
|
}
|
|
@@ -430,9 +465,26 @@ interface ModelPreferences {
|
|
|
430
465
|
speedPriority?: number;
|
|
431
466
|
intelligencePriority?: number;
|
|
432
467
|
}
|
|
468
|
+
interface ToolUseContent {
|
|
469
|
+
_meta?: Record<string, unknown>;
|
|
470
|
+
type: "tool_use";
|
|
471
|
+
id: string;
|
|
472
|
+
name: string;
|
|
473
|
+
input: Record<string, unknown>;
|
|
474
|
+
}
|
|
475
|
+
interface ToolResultContent {
|
|
476
|
+
_meta?: Record<string, unknown>;
|
|
477
|
+
type: "tool_result";
|
|
478
|
+
toolUseId: string;
|
|
479
|
+
content: ContentItem[];
|
|
480
|
+
structuredContent?: unknown;
|
|
481
|
+
isError?: boolean;
|
|
482
|
+
}
|
|
483
|
+
type SamplingContent = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent;
|
|
433
484
|
interface SamplingMessage {
|
|
485
|
+
_meta?: Record<string, unknown>;
|
|
434
486
|
role: "user" | "assistant";
|
|
435
|
-
content:
|
|
487
|
+
content: SamplingContent | SamplingContent[];
|
|
436
488
|
}
|
|
437
489
|
type IncludeContext = "none" | "thisServer" | "allServers";
|
|
438
490
|
interface CreateMessageParams {
|
|
@@ -442,14 +494,19 @@ interface CreateMessageParams {
|
|
|
442
494
|
includeContext?: IncludeContext;
|
|
443
495
|
temperature?: number;
|
|
444
496
|
maxTokens: number;
|
|
497
|
+
tools?: Tool[];
|
|
498
|
+
toolChoice?: {
|
|
499
|
+
mode: "auto" | "required" | "none";
|
|
500
|
+
};
|
|
445
501
|
stopSequences?: string[];
|
|
446
502
|
metadata?: Record<string, unknown>;
|
|
447
503
|
}
|
|
448
504
|
interface CreateMessageResult {
|
|
505
|
+
_meta?: Record<string, unknown>;
|
|
449
506
|
model: string;
|
|
450
|
-
content:
|
|
507
|
+
content: SamplingContent | SamplingContent[];
|
|
451
508
|
role: "user" | "assistant";
|
|
452
|
-
stopReason
|
|
509
|
+
stopReason?: string;
|
|
453
510
|
}
|
|
454
511
|
interface PromptReference {
|
|
455
512
|
type: "ref/prompt";
|
|
@@ -464,6 +521,9 @@ interface CompleteArgument {
|
|
|
464
521
|
value: string;
|
|
465
522
|
}
|
|
466
523
|
interface CompleteParams {
|
|
524
|
+
context?: {
|
|
525
|
+
arguments?: Record<string, string>;
|
|
526
|
+
};
|
|
467
527
|
ref: PromptReference | ResourceReference;
|
|
468
528
|
argument: CompleteArgument;
|
|
469
529
|
}
|
|
@@ -472,7 +532,7 @@ interface Completion {
|
|
|
472
532
|
hasMore?: boolean;
|
|
473
533
|
total?: number;
|
|
474
534
|
}
|
|
475
|
-
interface CompleteResult {
|
|
535
|
+
interface CompleteResult extends ResultMetadata {
|
|
476
536
|
completion: Completion;
|
|
477
537
|
}
|
|
478
538
|
declare const ERROR_PARSE = -32700;
|
|
@@ -490,6 +550,7 @@ interface McpTransport {
|
|
|
490
550
|
writable: Writable;
|
|
491
551
|
closed: Promise<McpTransportClosedEvent>;
|
|
492
552
|
dispose(reason?: Error): void;
|
|
553
|
+
filterTools?(tools: Tool[], reset?: boolean): Tool[];
|
|
493
554
|
}
|
|
494
555
|
interface InMemoryServerTransport {
|
|
495
556
|
readable: Readable;
|
|
@@ -528,6 +589,8 @@ interface HttpTransportOptions {
|
|
|
528
589
|
fetch?: HttpTransportFetch;
|
|
529
590
|
oauth?: OAuthClientProviderOptions;
|
|
530
591
|
oauthDiscoveryCache?: OAuthDiscoveryCache;
|
|
592
|
+
onWarning?: (message: string) => void;
|
|
593
|
+
maxResponseBytes?: number;
|
|
531
594
|
}
|
|
532
595
|
declare class StdioTransport implements McpTransport {
|
|
533
596
|
readonly readable: Readable;
|
|
@@ -559,12 +622,18 @@ declare class HttpTransport implements McpTransport {
|
|
|
559
622
|
private readonly oauthProvider;
|
|
560
623
|
private readonly oauthMetadataDiscovery;
|
|
561
624
|
private readonly inFlightFetchAbortControllers;
|
|
562
|
-
private readonly
|
|
563
|
-
|
|
625
|
+
private readonly openResponseReaders;
|
|
626
|
+
private readonly modernRequests;
|
|
627
|
+
private modernMode;
|
|
628
|
+
private readonly maxResponseBytes;
|
|
629
|
+
private readonly toolParameterHeaders;
|
|
630
|
+
private readonly onWarning;
|
|
631
|
+
constructor({ url, headers, fetch: fetchImpl, oauth, oauthDiscoveryCache, onWarning, maxResponseBytes, }: HttpTransportOptions);
|
|
632
|
+
filterTools(tools: Tool[], reset?: boolean): Tool[];
|
|
564
633
|
dispose(reason?: Error): void;
|
|
565
634
|
private closeWithSessionTermination;
|
|
566
635
|
private abortInFlightFetches;
|
|
567
|
-
private
|
|
636
|
+
private cancelOpenResponseReaders;
|
|
568
637
|
private fetchWithAbort;
|
|
569
638
|
private consumeWrittenLines;
|
|
570
639
|
private sendPost;
|
|
@@ -620,35 +689,43 @@ interface JsonRpcErrorResponse {
|
|
|
620
689
|
type JsonRpcResponse = JsonRpcSuccessResponse | JsonRpcErrorResponse;
|
|
621
690
|
type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
|
|
622
691
|
interface JsonRpcRequestOptions {
|
|
623
|
-
|
|
692
|
+
signal?: AbortSignal;
|
|
693
|
+
timeoutMs?: number | null;
|
|
624
694
|
onRequestId?: (requestId: RequestId) => void;
|
|
625
695
|
onTimeout?: (requestId: RequestId) => void;
|
|
626
696
|
}
|
|
627
|
-
interface
|
|
628
|
-
id: RequestId;
|
|
629
|
-
method: string;
|
|
697
|
+
interface McpRequestContext {
|
|
698
|
+
readonly id: RequestId;
|
|
699
|
+
readonly method: string;
|
|
700
|
+
readonly signal: AbortSignal;
|
|
630
701
|
}
|
|
631
|
-
type JsonRpcRequestHandler = (params: unknown, context:
|
|
702
|
+
type JsonRpcRequestHandler = (params: unknown, context: McpRequestContext) => unknown | Promise<unknown>;
|
|
632
703
|
interface JsonRpcNotificationContext {
|
|
633
704
|
method: string;
|
|
634
705
|
}
|
|
635
706
|
type JsonRpcNotificationHandler = (params: unknown, context: JsonRpcNotificationContext) => unknown | Promise<unknown>;
|
|
636
707
|
declare class JsonRpcMessageLayer {
|
|
708
|
+
private readonly maxConcurrentRequests;
|
|
709
|
+
requestMetadata?: Record<string, unknown>;
|
|
637
710
|
readonly requestTimeoutMs: number;
|
|
638
711
|
private readonly input;
|
|
639
712
|
private readonly output;
|
|
640
713
|
private readonly inputClosedReason;
|
|
641
714
|
private nextRequestId;
|
|
715
|
+
private readonly exchangeControllers;
|
|
642
716
|
private disposedError;
|
|
643
717
|
private readonly pendingRequests;
|
|
644
718
|
private readonly activeIncomingRequests;
|
|
645
719
|
private readonly requestHandlers;
|
|
720
|
+
private readonly inputRequestHandlers;
|
|
646
721
|
private readonly notificationHandlers;
|
|
647
|
-
constructor(input: Readable, output: Writable, requestTimeoutMs?: number, inputClosedReason?: Promise<Error
|
|
722
|
+
constructor(input: Readable, output: Writable, requestTimeoutMs?: number, inputClosedReason?: Promise<Error>, maxConcurrentRequests?: number);
|
|
648
723
|
sendNotification(method: string, params?: unknown): void;
|
|
649
724
|
onRequest(method: string, handler: JsonRpcRequestHandler): void;
|
|
650
725
|
onNotification(method: string, handler: JsonRpcNotificationHandler): void;
|
|
726
|
+
onInputRequest(method: string, handler: JsonRpcRequestHandler): void;
|
|
651
727
|
sendRequest(method: string, params?: unknown, options?: JsonRpcRequestOptions): Promise<unknown>;
|
|
728
|
+
private sendRequestOnce;
|
|
652
729
|
cancelRequest(requestId: RequestId, reason: unknown): boolean;
|
|
653
730
|
dispose(reason?: Error): void;
|
|
654
731
|
private consumeInput;
|
|
@@ -658,5 +735,5 @@ declare class JsonRpcMessageLayer {
|
|
|
658
735
|
private handleCancellationNotification;
|
|
659
736
|
}
|
|
660
737
|
|
|
661
|
-
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 };
|
|
662
|
-
export type { AudioContent, BlobResourceContents, CallToolOptions, CallToolParams, CallToolResult, ClientCapabilities, CompleteArgument, CompleteParams, CompleteResult, Completion, ContentItem, CreateMessageParams, CreateMessageResult, EmbeddedResource, GetPromptParams, GetPromptResult, HttpTransportFetch, HttpTransportOptions, ImageContent,
|
|
738
|
+
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, fetchMcpResponse };
|
|
739
|
+
export type { AudioContent, BlobResourceContents, CacheableResultMetadata, CallToolOptions, CallToolParams, CallToolResult, ClientCapabilities, CompleteArgument, CompleteParams, CompleteResult, Completion, ConnectResult, ContentItem, CreateMessageParams, CreateMessageResult, ElicitationParams, ElicitationResult, EmbeddedResource, GetPromptParams, GetPromptResult, HttpTransportFetch, HttpTransportOptions, ImageContent, InMemoryTransportPair, IncludeContext, InitializeParams, InitializeResult, JsonRpcErrorObject, JsonRpcErrorResponse, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcRequestOptions, JsonRpcResponse, JsonRpcSuccessResponse, LogLevel, LogMessage, McpClientConnection, McpClientOptions, McpRequestContext, McpSubscription, McpTransport, McpTransportClosedEvent, ModelHint, ModelPreferences, NotificationFilter, OAuthAuthorizationServerMetadata, OAuthClientProvider, OAuthClientProviderOptions, OAuthDiscoveryCache, OAuthDiscoveryResult, OAuthMetadataFetch, OAuthProtectedResourceMetadata, OAuthSessionStore, OAuthUnauthorizedChallenge, PaginatedParams, PaginatedResult, ProgressParams, ProgressToken, PromptMessage, PromptReference, ReadResourceParams, RequestId, ResourceContents, ResourceReference, ResultMetadata, Root, SamplingContent, SamplingMessage, SdkTestPair, ServerCapabilities, StdioSpawn, StdioTransportOptions, StoredOAuthSession, SubscriptionOptions, TextContent, TextResourceContents, Tool, ToolResultContent, ToolUseContent };
|