mcp-proxy 6.4.6 → 6.5.0

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/jsr.json CHANGED
@@ -3,5 +3,5 @@
3
3
  "include": ["src/index.ts", "src/bin/mcp-proxy.ts"],
4
4
  "license": "MIT",
5
5
  "name": "@punkpeye/mcp-proxy",
6
- "version": "6.4.6"
6
+ "version": "6.5.0"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-proxy",
3
- "version": "6.4.6",
3
+ "version": "6.5.0",
4
4
  "main": "dist/index.mjs",
5
5
  "scripts": {
6
6
  "build": "tsdown",
@@ -55,6 +55,12 @@ const argv = await yargs(hideBin(process.argv))
55
55
  "The timeout (in milliseconds) for initial connection to the MCP server (default: 60 seconds)",
56
56
  type: "number",
57
57
  },
58
+ corsAddAllowedHeader: {
59
+ array: true,
60
+ describe:
61
+ "Add a header name to Access-Control-Allow-Headers (defaults preserved). Repeat to add multiple, e.g. `--corsAddAllowedHeader X-API-Key`.",
62
+ type: "string",
63
+ },
58
64
  debug: {
59
65
  default: false,
60
66
  describe: "Enable debug logging",
@@ -137,6 +143,22 @@ const argv = await yargs(hideBin(process.argv))
137
143
  .help()
138
144
  .parseAsync();
139
145
 
146
+ // Default Access-Control-Allow-Headers list — must stay in sync with
147
+ // `defaultCorsOptions.allowedHeaders` in src/startHTTPServer.ts.
148
+ const DEFAULT_ALLOWED_HEADERS = [
149
+ "Content-Type",
150
+ "Authorization",
151
+ "Accept",
152
+ "Mcp-Session-Id",
153
+ "Mcp-Protocol-Version",
154
+ "Last-Event-Id",
155
+ ];
156
+
157
+ const corsOption =
158
+ argv.corsAddAllowedHeader && argv.corsAddAllowedHeader.length > 0
159
+ ? { allowedHeaders: [...DEFAULT_ALLOWED_HEADERS, ...argv.corsAddAllowedHeader] }
160
+ : undefined;
161
+
140
162
  // If -- separator was used, everything after -- is the command and its args
141
163
  const dashDashArgs = argv["--"] as string[] | undefined;
142
164
 
@@ -218,6 +240,7 @@ const proxy = async () => {
218
240
 
219
241
  const server = await startHTTPServer({
220
242
  apiKey: argv.apiKey,
243
+ cors: corsOption,
221
244
  createServer,
222
245
  eventStore: new InMemoryEventStore(),
223
246
  host: argv.host,