mcp-proxy 5.12.4 → 6.1.8

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/index.d.mts CHANGED
@@ -119,6 +119,9 @@ declare const startHTTPServer: <T extends ServerLike>({
119
119
  onUnhandledRequest,
120
120
  port,
121
121
  sseEndpoint,
122
+ sslCa,
123
+ sslCert,
124
+ sslKey,
122
125
  stateless,
123
126
  streamEndpoint
124
127
  }: {
@@ -135,6 +138,9 @@ declare const startHTTPServer: <T extends ServerLike>({
135
138
  onUnhandledRequest?: (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
136
139
  port: number;
137
140
  sseEndpoint?: null | string;
141
+ sslCa?: null | string;
142
+ sslCert?: null | string;
143
+ sslKey?: null | string;
138
144
  stateless?: boolean;
139
145
  streamEndpoint?: null | string;
140
146
  }) => Promise<SSEServer>;
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-DBuYn6eo.mjs";
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-BArgKxoc.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
@@ -1,7 +1,9 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { URL as URL$1 } from "node:url";
4
+ import fs from "fs";
4
5
  import http from "http";
6
+ import https from "https";
5
7
 
6
8
  //#region rolldown:runtime
7
9
  var __create = Object.create;
@@ -15568,7 +15570,7 @@ const handleSSERequest = async ({ activeTransports, createServer, endpoint, onCl
15568
15570
  }
15569
15571
  return false;
15570
15572
  };
15571
- const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enableJsonResponse, eventStore, host = "::", oauth, onClose, onConnect, onUnhandledRequest, port, sseEndpoint = "/sse", stateless, streamEndpoint = "/mcp" }) => {
15573
+ const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enableJsonResponse, eventStore, host = "::", oauth, onClose, onConnect, onUnhandledRequest, port, sseEndpoint = "/sse", sslCa, sslCert, sslKey, stateless, streamEndpoint = "/mcp" }) => {
15572
15574
  const activeSSETransports = {};
15573
15575
  const activeStreamTransports = {};
15574
15576
  const authMiddleware = new AuthenticationMiddleware({
@@ -15578,7 +15580,7 @@ const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enabl
15578
15580
  /**
15579
15581
  * @author https://dev.classmethod.jp/articles/mcp-sse/
15580
15582
  */
15581
- const httpServer = http.createServer(async (req, res) => {
15583
+ const requestListener = async (req, res) => {
15582
15584
  applyCorsHeaders(req, res, cors);
15583
15585
  if (req.method === "OPTIONS") {
15584
15586
  res.writeHead(204);
@@ -15621,7 +15623,27 @@ const startHTTPServer = async ({ apiKey, authenticate, cors, createServer, enabl
15621
15623
  })) return;
15622
15624
  if (onUnhandledRequest) await onUnhandledRequest(req, res);
15623
15625
  else res.writeHead(404).end();
15624
- });
15626
+ };
15627
+ let httpServer;
15628
+ if (sslCa || sslCert || sslKey) {
15629
+ const options = {};
15630
+ if (sslCa) try {
15631
+ options.ca = fs.readFileSync(sslCa);
15632
+ } catch (error$1) {
15633
+ throw new Error(`Failed to read CA file '${sslCa}': ${error$1.message}`);
15634
+ }
15635
+ if (sslCert) try {
15636
+ options.cert = fs.readFileSync(sslCert);
15637
+ } catch (error$1) {
15638
+ throw new Error(`Failed to read certificate file '${sslCert}': ${error$1.message}`);
15639
+ }
15640
+ if (sslKey) try {
15641
+ options.key = fs.readFileSync(sslKey);
15642
+ } catch (error$1) {
15643
+ throw new Error(`Failed to read key file '${sslKey}': ${error$1.message}`);
15644
+ }
15645
+ httpServer = https.createServer(options, requestListener);
15646
+ } else httpServer = http.createServer(requestListener);
15625
15647
  await new Promise((resolve$2) => {
15626
15648
  httpServer.listen(port, host, () => {
15627
15649
  resolve$2(void 0);
@@ -19739,7 +19761,7 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19739
19761
  parse: httpParse,
19740
19762
  serialize: httpSerialize
19741
19763
  };
19742
- const https = {
19764
+ const https$1 = {
19743
19765
  scheme: "https",
19744
19766
  domainHost: http$1.domainHost,
19745
19767
  parse: httpParse,
@@ -19771,7 +19793,7 @@ var require_schemes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19771
19793
  };
19772
19794
  const SCHEMES$1 = {
19773
19795
  http: http$1,
19774
- https,
19796
+ https: https$1,
19775
19797
  ws,
19776
19798
  wss,
19777
19799
  urn,
@@ -22742,11 +22764,11 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
22742
22764
  if (!f) throw new Error(`Unknown format "${name}"`);
22743
22765
  return f;
22744
22766
  };
22745
- function addFormats(ajv, list, fs, exportName) {
22767
+ function addFormats(ajv, list, fs$1, exportName) {
22746
22768
  var _a;
22747
22769
  var _b;
22748
22770
  (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
22749
- for (const f of list) ajv.addFormat(f, fs[f]);
22771
+ for (const f of list) ajv.addFormat(f, fs$1[f]);
22750
22772
  }
22751
22773
  module.exports = exports = formatsPlugin;
22752
22774
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -23975,4 +23997,4 @@ function serializeMessage(message) {
23975
23997
 
23976
23998
  //#endregion
23977
23999
  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 };
23978
- //# sourceMappingURL=stdio-DBuYn6eo.mjs.map
24000
+ //# sourceMappingURL=stdio-BArgKxoc.mjs.map