mcp-proxy 5.11.0 → 5.11.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.
- package/dist/bin/mcp-proxy.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/{stdio-BEX6di72.js → stdio-DLSsHME0.js} +16 -4
- package/dist/stdio-DLSsHME0.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/InMemoryEventStore.test.ts +72 -0
- package/src/InMemoryEventStore.ts +19 -2
- package/src/proxyServer.ts +8 -6
- package/dist/stdio-BEX6di72.js.map +0 -1
package/dist/bin/mcp-proxy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Client, InMemoryEventStore, ReadBuffer, Server, __commonJS, __toESM, proxyServer, serializeMessage, startHTTPServer } from "../stdio-
|
|
2
|
+
import { Client, InMemoryEventStore, ReadBuffer, Server, __commonJS, __toESM, proxyServer, serializeMessage, startHTTPServer } from "../stdio-DLSsHME0.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { basename, dirname, extname, join, normalize, relative, resolve } from "path";
|
|
5
5
|
import { format, inspect } from "util";
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ declare class AuthenticationMiddleware {
|
|
|
44
44
|
*/
|
|
45
45
|
declare class InMemoryEventStore implements EventStore {
|
|
46
46
|
private events;
|
|
47
|
+
private lastTimestamp;
|
|
48
|
+
private lastTimestampCounter;
|
|
47
49
|
/**
|
|
48
50
|
* Replays events that occurred after a specific event ID
|
|
49
51
|
* Implements EventStore.replayEventsAfter
|
|
@@ -59,7 +61,8 @@ declare class InMemoryEventStore implements EventStore {
|
|
|
59
61
|
*/
|
|
60
62
|
storeEvent(streamId: string, message: JSONRPCMessage): Promise<string>;
|
|
61
63
|
/**
|
|
62
|
-
* Generates a unique event ID
|
|
64
|
+
* Generates a monotonic unique event ID in
|
|
65
|
+
* `${streamId}_${timestamp}_${counter}_${random}` format.
|
|
63
66
|
*/
|
|
64
67
|
private generateEventId;
|
|
65
68
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticationMiddleware, Client, InMemoryEventStore, JSONRPCMessageSchema, LATEST_PROTOCOL_VERSION, NEVER, ReadBuffer, Server, ZodIssueCode, anyType, arrayType, booleanType, isInitializedNotification, isJSONRPCRequest, isJSONRPCResponse, numberType, objectType, proxyServer, serializeMessage, startHTTPServer, stringType } from "./stdio-
|
|
1
|
+
import { AuthenticationMiddleware, Client, InMemoryEventStore, JSONRPCMessageSchema, LATEST_PROTOCOL_VERSION, NEVER, ReadBuffer, Server, ZodIssueCode, anyType, arrayType, booleanType, isInitializedNotification, isJSONRPCRequest, isJSONRPCResponse, numberType, objectType, proxyServer, serializeMessage, startHTTPServer, stringType } from "./stdio-DLSsHME0.js";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
|
|
4
4
|
//#region node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
|
|
@@ -80,6 +80,8 @@ var AuthenticationMiddleware = class {
|
|
|
80
80
|
*/
|
|
81
81
|
var InMemoryEventStore = class {
|
|
82
82
|
events = /* @__PURE__ */ new Map();
|
|
83
|
+
lastTimestamp = 0;
|
|
84
|
+
lastTimestampCounter = 0;
|
|
83
85
|
/**
|
|
84
86
|
* Replays events that occurred after a specific event ID
|
|
85
87
|
* Implements EventStore.replayEventsAfter
|
|
@@ -113,10 +115,20 @@ var InMemoryEventStore = class {
|
|
|
113
115
|
return eventId;
|
|
114
116
|
}
|
|
115
117
|
/**
|
|
116
|
-
* Generates a unique event ID
|
|
118
|
+
* Generates a monotonic unique event ID in
|
|
119
|
+
* `${streamId}_${timestamp}_${counter}_${random}` format.
|
|
117
120
|
*/
|
|
118
121
|
generateEventId(streamId) {
|
|
119
|
-
|
|
122
|
+
const now = Date.now();
|
|
123
|
+
if (now === this.lastTimestamp) this.lastTimestampCounter++;
|
|
124
|
+
else {
|
|
125
|
+
this.lastTimestampCounter = 0;
|
|
126
|
+
this.lastTimestamp = now;
|
|
127
|
+
}
|
|
128
|
+
const timestamp = now.toString();
|
|
129
|
+
const counter = this.lastTimestampCounter.toString(36).padStart(4, "0");
|
|
130
|
+
const random = Math.random().toString(36).substring(2, 5);
|
|
131
|
+
return `${streamId}_${timestamp}_${counter}_${random}`;
|
|
120
132
|
}
|
|
121
133
|
/**
|
|
122
134
|
* Extracts the stream ID from an event ID
|
|
@@ -4489,7 +4501,7 @@ const proxyServer = async ({ client, requestTimeout, server, serverCapabilities
|
|
|
4489
4501
|
return client.listTools(args.params, requestTimeout ? { timeout: requestTimeout } : void 0);
|
|
4490
4502
|
});
|
|
4491
4503
|
}
|
|
4492
|
-
server.setRequestHandler(CompleteRequestSchema, async (args) => {
|
|
4504
|
+
if (serverCapabilities?.completions) server.setRequestHandler(CompleteRequestSchema, async (args) => {
|
|
4493
4505
|
return client.complete(args.params, requestTimeout ? { timeout: requestTimeout } : void 0);
|
|
4494
4506
|
});
|
|
4495
4507
|
};
|
|
@@ -21633,4 +21645,4 @@ function serializeMessage(message) {
|
|
|
21633
21645
|
|
|
21634
21646
|
//#endregion
|
|
21635
21647
|
export { AuthenticationMiddleware, Client, InMemoryEventStore, JSONRPCMessageSchema, LATEST_PROTOCOL_VERSION, NEVER, ReadBuffer, Server, ZodIssueCode, __commonJS, __toESM, anyType, arrayType, booleanType, isInitializedNotification, isJSONRPCRequest, isJSONRPCResponse, numberType, objectType, proxyServer, serializeMessage, startHTTPServer, stringType };
|
|
21636
|
-
//# sourceMappingURL=stdio-
|
|
21648
|
+
//# sourceMappingURL=stdio-DLSsHME0.js.map
|