mcp-proxy 6.1.9 → 6.2.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.1.9"
6
+ "version": "6.2.0"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-proxy",
3
- "version": "6.1.9",
3
+ "version": "6.2.0",
4
4
  "main": "dist/index.mjs",
5
5
  "scripts": {
6
6
  "build": "tsdown",
@@ -3,11 +3,15 @@
3
3
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
4
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
5
  import { EventSource } from "eventsource";
6
+ import { createRequire } from "node:module";
6
7
  import { setTimeout } from "node:timers";
7
8
  import util from "node:util";
8
9
  import yargs from "yargs";
9
10
  import { hideBin } from "yargs/helpers";
10
11
 
12
+ const require = createRequire(import.meta.url);
13
+ const packageJson = require("../../package.json") as { version: string };
14
+
11
15
  import { InMemoryEventStore } from "../InMemoryEventStore.js";
12
16
  import { proxyServer } from "../proxyServer.js";
13
17
  import { SSEServer, startHTTPServer } from "../startHTTPServer.js";
@@ -22,6 +26,7 @@ if (!("EventSource" in global)) {
22
26
 
23
27
  const argv = await yargs(hideBin(process.argv))
24
28
  .scriptName("mcp-proxy")
29
+ .version(packageJson.version)
25
30
  .command("$0 [command] [args...]", "Proxy an MCP stdio server over HTTP")
26
31
  .positional("command", {
27
32
  describe: "The command to run",
@@ -42,6 +47,12 @@ const argv = await yargs(hideBin(process.argv))
42
47
  describe: "API key for authenticating requests (uses X-API-Key header)",
43
48
  type: "string",
44
49
  },
50
+ connectionTimeout: {
51
+ default: 60000,
52
+ describe:
53
+ "The timeout (in milliseconds) for initial connection to the MCP server (default: 60 seconds)",
54
+ type: "number",
55
+ },
45
56
  debug: {
46
57
  default: false,
47
58
  describe: "Enable debug logging",
@@ -139,7 +150,7 @@ if (dashDashArgs && dashDashArgs.length > 0) {
139
150
  process.exit(1);
140
151
  }
141
152
 
142
- const connect = async (client: Client) => {
153
+ const connect = async (client: Client, connectionTimeout: number) => {
143
154
  const transport = new StdioClientTransport({
144
155
  args: finalArgs,
145
156
  command: finalCommand,
@@ -154,7 +165,7 @@ const connect = async (client: Client) => {
154
165
  stderr: "inherit",
155
166
  });
156
167
 
157
- await client.connect(transport);
168
+ await client.connect(transport, { timeout: connectionTimeout });
158
169
  };
159
170
 
160
171
  const proxy = async () => {
@@ -168,7 +179,7 @@ const proxy = async () => {
168
179
  },
169
180
  );
170
181
 
171
- await connect(client);
182
+ await connect(client, argv.connectionTimeout);
172
183
 
173
184
  const serverVersion = client.getServerVersion() as {
174
185
  name: string;