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/README.md +1 -0
- package/dist/bin/mcp-proxy.mjs +10 -4
- package/dist/bin/mcp-proxy.mjs.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/bin/mcp-proxy.ts +14 -3
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ options:
|
|
|
52
52
|
- `--streamEndpoint`: Set the streamable HTTP endpoint path (default: `/mcp`). Overrides `--endpoint` if `server` is set to `stream`.
|
|
53
53
|
- `--stateless`: Enable stateless mode for HTTP streamable transport (no session management). In this mode, each request creates a new server instance instead of maintaining persistent sessions.
|
|
54
54
|
- `--port`: Specify the port to listen on (default: 8080)
|
|
55
|
+
- `--connectionTimeout`: Timeout in milliseconds for the initial connection to the MCP server (default: 60000, which is 60 seconds)
|
|
55
56
|
- `--requestTimeout`: Timeout in milliseconds for requests to the MCP server (default: 300000, which is 5 minutes)
|
|
56
57
|
- `--debug`: Enable debug logging
|
|
57
58
|
- `--shell`: Spawn the server via the user's shell
|
package/dist/bin/mcp-proxy.mjs
CHANGED
|
@@ -5010,9 +5010,10 @@ var StdioClientTransport = class {
|
|
|
5010
5010
|
|
|
5011
5011
|
//#endregion
|
|
5012
5012
|
//#region src/bin/mcp-proxy.ts
|
|
5013
|
+
const packageJson = createRequire(import.meta.url)("../../package.json");
|
|
5013
5014
|
util.inspect.defaultOptions.depth = 8;
|
|
5014
5015
|
if (!("EventSource" in global)) global.EventSource = EventSource;
|
|
5015
|
-
const argv = await yargs_default(hideBin(process.argv)).scriptName("mcp-proxy").command("$0 [command] [args...]", "Proxy an MCP stdio server over HTTP").positional("command", {
|
|
5016
|
+
const argv = await yargs_default(hideBin(process.argv)).scriptName("mcp-proxy").version(packageJson.version).command("$0 [command] [args...]", "Proxy an MCP stdio server over HTTP").positional("command", {
|
|
5016
5017
|
describe: "The command to run",
|
|
5017
5018
|
type: "string"
|
|
5018
5019
|
}).positional("args", {
|
|
@@ -5024,6 +5025,11 @@ const argv = await yargs_default(hideBin(process.argv)).scriptName("mcp-proxy").
|
|
|
5024
5025
|
describe: "API key for authenticating requests (uses X-API-Key header)",
|
|
5025
5026
|
type: "string"
|
|
5026
5027
|
},
|
|
5028
|
+
connectionTimeout: {
|
|
5029
|
+
default: 6e4,
|
|
5030
|
+
describe: "The timeout (in milliseconds) for initial connection to the MCP server (default: 60 seconds)",
|
|
5031
|
+
type: "number"
|
|
5032
|
+
},
|
|
5027
5033
|
debug: {
|
|
5028
5034
|
default: false,
|
|
5029
5035
|
describe: "Enable debug logging",
|
|
@@ -5108,7 +5114,7 @@ else if (argv.command) {
|
|
|
5108
5114
|
console.error(" mcp-proxy node server.js");
|
|
5109
5115
|
process.exit(1);
|
|
5110
5116
|
}
|
|
5111
|
-
const connect = async (client) => {
|
|
5117
|
+
const connect = async (client, connectionTimeout) => {
|
|
5112
5118
|
const transport = new StdioClientTransport({
|
|
5113
5119
|
args: finalArgs,
|
|
5114
5120
|
command: finalCommand,
|
|
@@ -5119,14 +5125,14 @@ const connect = async (client) => {
|
|
|
5119
5125
|
shell: argv.shell,
|
|
5120
5126
|
stderr: "inherit"
|
|
5121
5127
|
});
|
|
5122
|
-
await client.connect(transport);
|
|
5128
|
+
await client.connect(transport, { timeout: connectionTimeout });
|
|
5123
5129
|
};
|
|
5124
5130
|
const proxy = async () => {
|
|
5125
5131
|
const client = new Client({
|
|
5126
5132
|
name: "mcp-proxy",
|
|
5127
5133
|
version: "1.0.0"
|
|
5128
5134
|
}, { capabilities: {} });
|
|
5129
|
-
await connect(client);
|
|
5135
|
+
await connect(client, argv.connectionTimeout);
|
|
5130
5136
|
const serverVersion = client.getServerVersion();
|
|
5131
5137
|
const serverCapabilities = client.getServerCapabilities();
|
|
5132
5138
|
console.info("starting server on port %d", argv.port);
|