mcp-proxy 6.5.1 → 6.5.3
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/LICENSE +21 -20
- package/README.md +2 -0
- package/dist/bin/mcp-proxy.mjs +7 -1
- package/dist/bin/mcp-proxy.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{stdio-DN-u_q7a.mjs → stdio-DNR9B0BZ.mjs} +12 -3
- package/dist/stdio-DNR9B0BZ.mjs.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/bin/mcp-proxy.ts +7 -0
- package/src/startHTTPServer.test.ts +97 -0
- package/src/startHTTPServer.ts +21 -1
- package/dist/stdio-DN-u_q7a.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -113,6 +113,7 @@ declare const startHTTPServer: <T extends ServerLike>({
|
|
|
113
113
|
enableJsonResponse,
|
|
114
114
|
eventStore,
|
|
115
115
|
host,
|
|
116
|
+
keepAliveTimeout,
|
|
116
117
|
oauth,
|
|
117
118
|
onClose,
|
|
118
119
|
onConnect,
|
|
@@ -132,6 +133,7 @@ declare const startHTTPServer: <T extends ServerLike>({
|
|
|
132
133
|
enableJsonResponse?: boolean;
|
|
133
134
|
eventStore?: EventStore;
|
|
134
135
|
host?: string;
|
|
136
|
+
keepAliveTimeout?: number;
|
|
135
137
|
oauth?: AuthConfig["oauth"];
|
|
136
138
|
onClose?: (server: T) => Promise<void>;
|
|
137
139
|
onConnect?: (server: T) => Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as NEVER, S as _coercedNumber, T as AuthenticationMiddleware, _ as looseObject, a as startHTTPServer, b as string, c as LATEST_PROTOCOL_VERSION, d as isJSONRPCResultResponse, f as ZodNumber, g as literal, h as boolean, i as Client, l as isInitializedNotification, m as array, n as serializeMessage, o as proxyServer, p as any, r as Server, s as JSONRPCMessageSchema, t as ReadBuffer, u as isJSONRPCRequest, v as number$1, w as InMemoryEventStore, x as url, y as object } from "./stdio-
|
|
1
|
+
import { C as NEVER, S as _coercedNumber, T as AuthenticationMiddleware, _ as looseObject, a as startHTTPServer, b as string, c as LATEST_PROTOCOL_VERSION, d as isJSONRPCResultResponse, f as ZodNumber, g as literal, h as boolean, i as Client, l as isInitializedNotification, m as array, n as serializeMessage, o as proxyServer, p as any, r as Server, s as JSONRPCMessageSchema, t as ReadBuffer, u as isJSONRPCRequest, v as number$1, w as InMemoryEventStore, x as url, y as object } from "./stdio-DNR9B0BZ.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
|
|
4
4
|
//#region node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/compat.js
|
|
@@ -15856,6 +15856,7 @@ var StreamableHTTPServerTransport = class {
|
|
|
15856
15856
|
|
|
15857
15857
|
//#endregion
|
|
15858
15858
|
//#region src/startHTTPServer.ts
|
|
15859
|
+
const DEFAULT_KEEP_ALIVE_TIMEOUT = 3e5;
|
|
15859
15860
|
const getBody = (request) => {
|
|
15860
15861
|
return new Promise((resolve$2) => {
|
|
15861
15862
|
const bodyParts = [];
|
|
@@ -16236,7 +16237,7 @@ const handleSSERequest = async ({ activeTransports, createServer, endpoint, onCl
|
|
|
16236
16237
|
}
|
|
16237
16238
|
return false;
|
|
16238
16239
|
};
|
|
16239
|
-
const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enableJsonResponse, eventStore, host = "::", oauth, onClose, onConnect, onUnhandledRequest, port, sseEndpoint = "/sse", sslCa, sslCert, sslKey, stateless, streamEndpoint = "/mcp" }) => {
|
|
16240
|
+
const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enableJsonResponse, eventStore, host = "::", keepAliveTimeout = DEFAULT_KEEP_ALIVE_TIMEOUT, oauth, onClose, onConnect, onUnhandledRequest, port, sseEndpoint = "/sse", sslCa, sslCert, sslKey, stateless, streamEndpoint = "/mcp" }) => {
|
|
16240
16241
|
const activeSSETransports = {};
|
|
16241
16242
|
const activeStreamTransports = {};
|
|
16242
16243
|
const authMiddleware = new AuthenticationMiddleware({
|
|
@@ -16257,7 +16258,13 @@ const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enabl
|
|
|
16257
16258
|
res.writeHead(200).end("pong");
|
|
16258
16259
|
return;
|
|
16259
16260
|
}
|
|
16260
|
-
|
|
16261
|
+
let requestUrl;
|
|
16262
|
+
try {
|
|
16263
|
+
requestUrl = new URL(req.url || "", "http://localhost");
|
|
16264
|
+
} catch {
|
|
16265
|
+
res.writeHead(400).end("Bad Request");
|
|
16266
|
+
return;
|
|
16267
|
+
}
|
|
16261
16268
|
const isMcpEndpoint = sseEndpoint && requestUrl.pathname === sseEndpoint || streamEndpoint && requestUrl.pathname === streamEndpoint;
|
|
16262
16269
|
if (onUnhandledRequest && !isMcpEndpoint) {
|
|
16263
16270
|
await onUnhandledRequest(req, res);
|
|
@@ -16315,6 +16322,8 @@ const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enabl
|
|
|
16315
16322
|
}
|
|
16316
16323
|
httpServer = https.createServer(options, requestListener);
|
|
16317
16324
|
} else httpServer = http.createServer(requestListener);
|
|
16325
|
+
httpServer.keepAliveTimeout = keepAliveTimeout;
|
|
16326
|
+
httpServer.headersTimeout = Math.max(httpServer.headersTimeout, keepAliveTimeout + 1e3);
|
|
16318
16327
|
await new Promise((resolve$2) => {
|
|
16319
16328
|
httpServer.listen(port, host, () => {
|
|
16320
16329
|
resolve$2(void 0);
|
|
@@ -24815,4 +24824,4 @@ function serializeMessage(message) {
|
|
|
24815
24824
|
|
|
24816
24825
|
//#endregion
|
|
24817
24826
|
export { NEVER as C, __toESM as D, __commonJSMin as E, _coercedNumber as S, AuthenticationMiddleware as T, looseObject as _, startHTTPServer as a, string as b, LATEST_PROTOCOL_VERSION as c, isJSONRPCResultResponse as d, ZodNumber as f, literal as g, boolean as h, Client as i, isInitializedNotification as l, array as m, serializeMessage as n, proxyServer as o, any as p, Server as r, JSONRPCMessageSchema as s, ReadBuffer as t, isJSONRPCRequest as u, number as v, InMemoryEventStore as w, url as x, object as y };
|
|
24818
|
-
//# sourceMappingURL=stdio-
|
|
24827
|
+
//# sourceMappingURL=stdio-DNR9B0BZ.mjs.map
|