mcp-proxy 6.3.0 → 6.4.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.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{stdio-BArgKxoc.mjs → stdio-vt8L9uwX.mjs} +7 -5
- package/dist/stdio-vt8L9uwX.mjs.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/startHTTPServer.test.ts +7 -6
- package/src/startHTTPServer.ts +25 -7
- package/dist/stdio-BArgKxoc.mjs.map +0 -1
package/dist/bin/mcp-proxy.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as __toESM, E as __commonJSMin, a as startHTTPServer, i as Client, n as serializeMessage, o as proxyServer, r as Server, t as ReadBuffer, w as InMemoryEventStore } from "../stdio-
|
|
2
|
+
import { D as __toESM, E as __commonJSMin, a as startHTTPServer, i as Client, n as serializeMessage, o as proxyServer, r as Server, t as ReadBuffer, w as InMemoryEventStore } from "../stdio-vt8L9uwX.mjs";
|
|
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.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 isJSONRPCResponse, 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 isJSONRPCResponse, 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-vt8L9uwX.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
|
|
@@ -15271,7 +15271,7 @@ const cleanupServer = async (server, onClose) => {
|
|
|
15271
15271
|
const applyCorsHeaders = (req, res, corsOptions) => {
|
|
15272
15272
|
if (!req.headers.origin) return;
|
|
15273
15273
|
const defaultCorsOptions = {
|
|
15274
|
-
allowedHeaders: "Content-Type, Authorization, Accept, Mcp-Session-Id, Last-Event-Id",
|
|
15274
|
+
allowedHeaders: "Content-Type, Authorization, Accept, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-Id",
|
|
15275
15275
|
credentials: true,
|
|
15276
15276
|
exposedHeaders: ["Mcp-Session-Id"],
|
|
15277
15277
|
methods: [
|
|
@@ -15313,12 +15313,13 @@ const handleStreamRequest = async ({ activeTransports, authenticate, authMiddlew
|
|
|
15313
15313
|
if (req.method === "POST" && new URL(req.url, "http://localhost").pathname === endpoint) {
|
|
15314
15314
|
let body;
|
|
15315
15315
|
try {
|
|
15316
|
-
const sessionId = Array.isArray(req.headers["mcp-session-id"]) ? req.headers["mcp-session-id"][0] : req.headers["mcp-session-id"];
|
|
15316
|
+
const sessionId = stateless ? void 0 : Array.isArray(req.headers["mcp-session-id"]) ? req.headers["mcp-session-id"][0] : req.headers["mcp-session-id"];
|
|
15317
15317
|
let transport;
|
|
15318
15318
|
let server;
|
|
15319
15319
|
body = await getBody(req);
|
|
15320
|
-
|
|
15321
|
-
|
|
15320
|
+
let authResult;
|
|
15321
|
+
if (authenticate) try {
|
|
15322
|
+
authResult = await authenticate(req);
|
|
15322
15323
|
if (!authResult || typeof authResult === "object" && "authenticated" in authResult && !authResult.authenticated) {
|
|
15323
15324
|
const errorMessage = authResult && typeof authResult === "object" && "error" in authResult && typeof authResult.error === "string" ? authResult.error : "Unauthorized: Authentication failed";
|
|
15324
15325
|
res.setHeader("Content-Type", "application/json");
|
|
@@ -15366,6 +15367,7 @@ const handleStreamRequest = async ({ activeTransports, authenticate, authMiddlew
|
|
|
15366
15367
|
}
|
|
15367
15368
|
transport = activeTransport.transport;
|
|
15368
15369
|
server = activeTransport.server;
|
|
15370
|
+
if (authResult && typeof server === "object" && server !== null && "updateAuth" in server && typeof server.updateAuth === "function") server.updateAuth(authResult);
|
|
15369
15371
|
} else if (!sessionId && isInitializeRequest(body)) {
|
|
15370
15372
|
transport = new StreamableHTTPServerTransport({
|
|
15371
15373
|
enableJsonResponse,
|
|
@@ -23997,4 +23999,4 @@ function serializeMessage(message) {
|
|
|
23997
23999
|
|
|
23998
24000
|
//#endregion
|
|
23999
24001
|
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, isJSONRPCResponse 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 };
|
|
24000
|
-
//# sourceMappingURL=stdio-
|
|
24002
|
+
//# sourceMappingURL=stdio-vt8L9uwX.mjs.map
|