mcp-proxy 5.5.4 → 5.5.6
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/bin/mcp-proxy.d.ts +1 -0
- package/dist/bin/mcp-proxy.js +5173 -358
- package/dist/bin/mcp-proxy.js.map +1 -1
- package/dist/index.d.ts +100 -74
- package/dist/index.js +1843 -112
- package/dist/index.js.map +1 -1
- package/dist/stdio-CQWnvum1.js +21424 -0
- package/dist/stdio-CQWnvum1.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +11 -13
- package/src/InMemoryEventStore.test.ts +160 -0
- package/src/InMemoryEventStore.ts +1 -1
- package/dist/chunk-JCZNH6HS.js +0 -535
- package/dist/chunk-JCZNH6HS.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { SSEClientTransportOptions } from
|
|
7
|
-
import { StreamableHTTPClientTransportOptions } from
|
|
8
|
-
import { Transport } from
|
|
1
|
+
import http from "http";
|
|
2
|
+
import { EventStore } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
3
|
+
import { JSONRPCMessage, ServerCapabilities } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
5
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
|
+
import { SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
7
|
+
import { StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8
|
+
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
* This is a copy of the InMemoryEventStore from the typescript-sdk
|
|
12
|
-
* https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/inMemoryEventStore.ts
|
|
13
|
-
*/
|
|
10
|
+
//#region src/InMemoryEventStore.d.ts
|
|
14
11
|
|
|
15
12
|
/**
|
|
16
13
|
* Simple in-memory implementation of the EventStore interface for resumability
|
|
@@ -18,84 +15,113 @@ import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
|
18
15
|
* where a persistent storage solution would be more appropriate.
|
|
19
16
|
*/
|
|
20
17
|
declare class InMemoryEventStore implements EventStore {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
private events;
|
|
19
|
+
/**
|
|
20
|
+
* Replays events that occurred after a specific event ID
|
|
21
|
+
* Implements EventStore.replayEventsAfter
|
|
22
|
+
*/
|
|
23
|
+
replayEventsAfter(lastEventId: string, {
|
|
24
|
+
send
|
|
25
|
+
}: {
|
|
26
|
+
send: (eventId: string, message: JSONRPCMessage) => Promise<void>;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Stores an event with a generated event ID
|
|
30
|
+
* Implements EventStore.storeEvent
|
|
31
|
+
*/
|
|
32
|
+
storeEvent(streamId: string, message: JSONRPCMessage): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Generates a unique event ID for a given stream ID
|
|
35
|
+
*/
|
|
36
|
+
private generateEventId;
|
|
37
|
+
/**
|
|
38
|
+
* Extracts the stream ID from an event ID
|
|
39
|
+
*/
|
|
40
|
+
private getStreamIdFromEventId;
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/proxyServer.d.ts
|
|
44
|
+
declare const proxyServer: ({
|
|
45
|
+
client,
|
|
46
|
+
server,
|
|
47
|
+
serverCapabilities
|
|
48
|
+
}: {
|
|
49
|
+
client: Client;
|
|
50
|
+
server: Server;
|
|
51
|
+
serverCapabilities: ServerCapabilities;
|
|
48
52
|
}) => Promise<void>;
|
|
49
|
-
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/startHTTPServer.d.ts
|
|
50
55
|
type SSEServer = {
|
|
51
|
-
|
|
56
|
+
close: () => Promise<void>;
|
|
52
57
|
};
|
|
53
58
|
type ServerLike = {
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
close: Server["close"];
|
|
60
|
+
connect: Server["connect"];
|
|
56
61
|
};
|
|
57
|
-
declare const startHTTPServer: <T extends ServerLike>({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
declare const startHTTPServer: <T extends ServerLike>({
|
|
63
|
+
createServer,
|
|
64
|
+
enableJsonResponse,
|
|
65
|
+
eventStore,
|
|
66
|
+
host,
|
|
67
|
+
onClose,
|
|
68
|
+
onConnect,
|
|
69
|
+
onUnhandledRequest,
|
|
70
|
+
port,
|
|
71
|
+
sseEndpoint,
|
|
72
|
+
stateless,
|
|
73
|
+
streamEndpoint
|
|
74
|
+
}: {
|
|
75
|
+
createServer: (request: http.IncomingMessage) => Promise<T>;
|
|
76
|
+
enableJsonResponse?: boolean;
|
|
77
|
+
eventStore?: EventStore;
|
|
78
|
+
host?: string;
|
|
79
|
+
onClose?: (server: T) => Promise<void>;
|
|
80
|
+
onConnect?: (server: T) => Promise<void>;
|
|
81
|
+
onUnhandledRequest?: (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
|
|
82
|
+
port: number;
|
|
83
|
+
sseEndpoint?: null | string;
|
|
84
|
+
stateless?: boolean;
|
|
85
|
+
streamEndpoint?: null | string;
|
|
69
86
|
}) => Promise<SSEServer>;
|
|
70
|
-
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/startStdioServer.d.ts
|
|
71
89
|
declare enum ServerType {
|
|
72
|
-
|
|
73
|
-
|
|
90
|
+
HTTPStream = "HTTPStream",
|
|
91
|
+
SSE = "SSE",
|
|
74
92
|
}
|
|
75
|
-
declare const startStdioServer: ({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
declare const startStdioServer: ({
|
|
94
|
+
initStdioServer,
|
|
95
|
+
initStreamClient,
|
|
96
|
+
serverType,
|
|
97
|
+
transportOptions,
|
|
98
|
+
url
|
|
99
|
+
}: {
|
|
100
|
+
initStdioServer?: () => Promise<Server>;
|
|
101
|
+
initStreamClient?: () => Promise<Client>;
|
|
102
|
+
serverType: ServerType;
|
|
103
|
+
transportOptions?: SSEClientTransportOptions | StreamableHTTPClientTransportOptions;
|
|
104
|
+
url: string;
|
|
81
105
|
}) => Promise<Server>;
|
|
82
|
-
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/tapTransport.d.ts
|
|
83
108
|
type TransportEvent = {
|
|
84
|
-
|
|
85
|
-
|
|
109
|
+
error: Error;
|
|
110
|
+
type: "onerror";
|
|
86
111
|
} | {
|
|
87
|
-
|
|
88
|
-
|
|
112
|
+
message: JSONRPCMessage;
|
|
113
|
+
type: "onmessage";
|
|
89
114
|
} | {
|
|
90
|
-
|
|
91
|
-
|
|
115
|
+
message: JSONRPCMessage;
|
|
116
|
+
type: "send";
|
|
92
117
|
} | {
|
|
93
|
-
|
|
118
|
+
type: "close";
|
|
94
119
|
} | {
|
|
95
|
-
|
|
120
|
+
type: "onclose";
|
|
96
121
|
} | {
|
|
97
|
-
|
|
122
|
+
type: "start";
|
|
98
123
|
};
|
|
99
124
|
declare const tapTransport: (transport: Transport, eventHandler: (event: TransportEvent) => void) => Transport;
|
|
100
|
-
|
|
125
|
+
//#endregion
|
|
101
126
|
export { InMemoryEventStore, ServerType, proxyServer, startHTTPServer, startStdioServer, tapTransport };
|
|
127
|
+
//# sourceMappingURL=index.d.ts.map
|