@wrongstack/mcp 1.0.29 → 1.0.33
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/client-stdio-protocol.d.ts +24 -0
- package/dist/client-stdio.d.ts +32 -0
- package/dist/client.d.ts +5 -10
- package/dist/index.js +800 -408
- package/dist/registry-catalog-operations.d.ts +29 -0
- package/dist/registry-catalog.d.ts +2 -0
- package/dist/registry-slots.d.ts +4 -0
- package/dist/registry.d.ts +4 -1
- package/dist/server-dispatch.d.ts +160 -0
- package/dist/server-http.d.ts +60 -0
- package/dist/server-stdio.d.ts +19 -0
- package/dist/server.d.ts +6 -181
- package/dist/sse-reader.d.ts +2 -0
- package/dist/transport-sse.d.ts +2 -0
- package/dist/transport-streamable.d.ts +2 -0
- package/dist/wrap-tool.d.ts +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JsonRpcServerRequest, MCPClientOptions } from './client-types.js';
|
|
2
|
+
import type { JsonRpcResponse } from './contracts.js';
|
|
3
|
+
import type { ServerRequestResponder } from './elicitation.js';
|
|
4
|
+
export interface ClientStdioProtocolHost {
|
|
5
|
+
rxBufferBytes: number;
|
|
6
|
+
rxParts: string[];
|
|
7
|
+
failPending(reason: string): void;
|
|
8
|
+
readonly opts: MCPClientOptions;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
onLine(line: string): void;
|
|
11
|
+
handleServerRequest(request: JsonRpcServerRequest): Promise<void>;
|
|
12
|
+
readonly serverRequests: ServerRequestResponder;
|
|
13
|
+
handleToolsListChanged(): Promise<void>;
|
|
14
|
+
emitCapabilityChanged(capability: 'resources' | 'prompts'): void;
|
|
15
|
+
emitResourceUpdated(uri: string): void;
|
|
16
|
+
readonly pending: Map<number, {
|
|
17
|
+
resolve: (res: JsonRpcResponse) => void;
|
|
18
|
+
reject: (err: Error) => void;
|
|
19
|
+
timer: NodeJS.Timeout;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export declare function receiveStdioData(host: ClientStdioProtocolHost, s: string): void;
|
|
23
|
+
export declare function receiveStdioLine(host: ClientStdioProtocolHost, line: string): void;
|
|
24
|
+
//# sourceMappingURL=client-stdio-protocol.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ChildProcess } from 'node:child_process';
|
|
2
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
3
|
+
import type { ExitListener, MCPClientOptions } from './client-types.js';
|
|
4
|
+
import type { ConnectionState, JsonRpcResponse, MCPTool } from './contracts.js';
|
|
5
|
+
import type { ServerRequestResponder } from './elicitation.js';
|
|
6
|
+
import { type MCPServerMetadata } from './protocol.js';
|
|
7
|
+
export interface ClientStdioHost {
|
|
8
|
+
readonly opts: MCPClientOptions;
|
|
9
|
+
state: ConnectionState;
|
|
10
|
+
rxBuffer: string;
|
|
11
|
+
rxBufferBytes: number;
|
|
12
|
+
rxDecoder: StringDecoder;
|
|
13
|
+
child: ChildProcess | undefined;
|
|
14
|
+
onData(s: string): void;
|
|
15
|
+
onLine(line: string): void;
|
|
16
|
+
failPending(reason: string): void;
|
|
17
|
+
readonly exitListeners: Set<ExitListener>;
|
|
18
|
+
request(method: string, params: unknown, timeoutMs?: number | undefined, opts?: {
|
|
19
|
+
signal?: AbortSignal | undefined;
|
|
20
|
+
}): Promise<JsonRpcResponse>;
|
|
21
|
+
readonly serverRequests: ServerRequestResponder;
|
|
22
|
+
_serverMetadata: MCPServerMetadata | undefined;
|
|
23
|
+
notify(method: string, params: unknown): Promise<void>;
|
|
24
|
+
readonly toolCatalogRevision: number;
|
|
25
|
+
_tools: MCPTool[];
|
|
26
|
+
_toolsCache: MCPTool[] | undefined;
|
|
27
|
+
_drainPending: boolean;
|
|
28
|
+
_lastNotifySkipped: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare function connectStdio(host: ClientStdioHost): Promise<void>;
|
|
31
|
+
export declare function notifyStdio(host: ClientStdioHost, method: string, params: unknown): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=client-stdio.d.ts.map
|
package/dist/client.d.ts
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import type { ExitListener, MCPClientOptions, MCPListChangedListener, MCPPageOptions, MCPRequestOptions, MCPResourceUpdatedListener, ToolsChangedListener } from './client-types.js';
|
|
2
2
|
import type { ConnectionState, JsonRpcResponse, MCPTool, ToolCallResult } from './contracts.js';
|
|
3
3
|
import { ServerRequestResponder, type UrlElicitation } from './elicitation.js';
|
|
4
|
-
import {
|
|
4
|
+
import type { MCPGetPromptResult, MCPListPromptsResult, MCPListResourcesResult, MCPListResourceTemplatesResult, MCPReadResourceResult, MCPServerMetadata } from './protocol.js';
|
|
5
5
|
export { forceKillTree } from './client-process.js';
|
|
6
6
|
export { quoteWindowsArg } from './client-protocol-helpers.js';
|
|
7
7
|
export type { ConnectionState, JsonRpcResponse, MCPTool, ToolCallResult };
|
|
8
8
|
export declare class MCPClient {
|
|
9
9
|
readonly opts: MCPClientOptions;
|
|
10
10
|
private readonly capabilityClient;
|
|
11
|
-
/**
|
|
12
|
-
* Maximum bytes the rx buffer may accumulate before the connection is
|
|
13
|
-
* forcefully closed. A well-behaved JSON-RPC server emits newline-delimited
|
|
14
|
-
* messages that are individually much smaller than this; a server that never
|
|
15
|
-
* sends a newline would grow the buffer without limit and OOM the process.
|
|
16
|
-
* 16 MiB is generous for any legitimate single message while bounding the
|
|
17
|
-
* worst-case memory to a predictable cap.
|
|
18
|
-
*/
|
|
19
|
-
private static readonly MAX_RX_BUFFER_BYTES;
|
|
20
11
|
private state;
|
|
21
12
|
private child?;
|
|
22
13
|
private nextId;
|
|
@@ -53,6 +44,8 @@ export declare class MCPClient {
|
|
|
53
44
|
private _lastNotifySkipped;
|
|
54
45
|
private closePromise?;
|
|
55
46
|
private connectPromise?;
|
|
47
|
+
private toolCatalogVersion;
|
|
48
|
+
private toolCatalogRevision;
|
|
56
49
|
private sseTransport?;
|
|
57
50
|
private httpTransport?;
|
|
58
51
|
/** Notified when the stdio child process exits so the registry can attempt reconnect. */
|
|
@@ -137,6 +130,8 @@ export declare class MCPClient {
|
|
|
137
130
|
private emitResourceUpdated;
|
|
138
131
|
private emitCapabilityChanged;
|
|
139
132
|
private clientHttpConnectionHost;
|
|
133
|
+
private clientStdioHost;
|
|
134
|
+
private clientStdioProtocolHost;
|
|
140
135
|
}
|
|
141
136
|
export type { MCPClientOptions, MCPListChangedListener, MCPPageOptions, MCPRequestOptions, MCPResourceUpdatedListener, Transport, } from './client-types.js';
|
|
142
137
|
//# sourceMappingURL=client.d.ts.map
|