mcp-proxy 6.1.8 → 6.1.10
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 +15 -1
- package/dist/bin/mcp-proxy.mjs +20 -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 +33 -5
package/README.md
CHANGED
|
@@ -21,6 +21,16 @@ npm install mcp-proxy
|
|
|
21
21
|
|
|
22
22
|
### Command-line
|
|
23
23
|
|
|
24
|
+
MCP Proxy supports two invocation patterns:
|
|
25
|
+
|
|
26
|
+
**Simple usage (no mcp-proxy options):**
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx mcp-proxy npx -y @anthropic/mcp-server-filesystem /path
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**With mcp-proxy options:**
|
|
33
|
+
|
|
24
34
|
```bash
|
|
25
35
|
npx mcp-proxy --port 8080 --shell -- tsx server.js
|
|
26
36
|
```
|
|
@@ -28,7 +38,11 @@ npx mcp-proxy --port 8080 --shell -- tsx server.js
|
|
|
28
38
|
This starts a server and `stdio` server (`tsx server.js`). The server listens on port 8080 and `/mcp` (streamable HTTP) and `/sse` (SSE) endpoints, and forwards messages to the `stdio` server.
|
|
29
39
|
|
|
30
40
|
> [!NOTE]
|
|
31
|
-
>
|
|
41
|
+
> **About the `--` separator:**
|
|
42
|
+
> - The `--` separator is **optional** when you don't need to pass options to mcp-proxy
|
|
43
|
+
> - Use `--` when you need to pass options to mcp-proxy (like `--port`, `--shell`, etc.) to clearly separate them from the command
|
|
44
|
+
> - Without `--`, the first positional argument is treated as the command, and all subsequent arguments are passed to that command
|
|
45
|
+
> - The `--` separator is also useful when the command itself has flags that might conflict with mcp-proxy options
|
|
32
46
|
|
|
33
47
|
options:
|
|
34
48
|
|
package/dist/bin/mcp-proxy.mjs
CHANGED
|
@@ -5010,9 +5010,17 @@ 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").
|
|
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", {
|
|
5017
|
+
describe: "The command to run",
|
|
5018
|
+
type: "string"
|
|
5019
|
+
}).positional("args", {
|
|
5020
|
+
array: true,
|
|
5021
|
+
describe: "The arguments to pass to the command",
|
|
5022
|
+
type: "string"
|
|
5023
|
+
}).usage("$0 [options] -- <command> [args...]\n $0 <command> [args...]").env("MCP_PROXY").parserConfiguration({ "populate--": true }).options({
|
|
5016
5024
|
apiKey: {
|
|
5017
5025
|
describe: "API key for authenticating requests (uses X-API-Key header)",
|
|
5018
5026
|
type: "string"
|
|
@@ -5085,14 +5093,22 @@ const argv = await yargs_default(hideBin(process.argv)).scriptName("mcp-proxy").
|
|
|
5085
5093
|
}
|
|
5086
5094
|
}).help().parseAsync();
|
|
5087
5095
|
const dashDashArgs = argv["--"];
|
|
5088
|
-
|
|
5096
|
+
let finalCommand;
|
|
5097
|
+
let finalArgs;
|
|
5098
|
+
if (dashDashArgs && dashDashArgs.length > 0) [finalCommand, ...finalArgs] = dashDashArgs;
|
|
5099
|
+
else if (argv.command) {
|
|
5100
|
+
finalCommand = argv.command;
|
|
5101
|
+
finalArgs = argv.args || [];
|
|
5102
|
+
} else {
|
|
5089
5103
|
console.error("Error: No command specified.");
|
|
5090
5104
|
console.error("Usage: mcp-proxy [options] -- <command> [args...]");
|
|
5105
|
+
console.error(" or: mcp-proxy <command> [args...]");
|
|
5091
5106
|
console.error("");
|
|
5092
|
-
console.error("
|
|
5107
|
+
console.error("Examples:");
|
|
5108
|
+
console.error(" mcp-proxy --port 8080 -- node server.js --port 3000");
|
|
5109
|
+
console.error(" mcp-proxy node server.js");
|
|
5093
5110
|
process.exit(1);
|
|
5094
5111
|
}
|
|
5095
|
-
const [finalCommand, ...finalArgs] = dashDashArgs;
|
|
5096
5112
|
const connect = async (client) => {
|
|
5097
5113
|
const transport = new StdioClientTransport({
|
|
5098
5114
|
args: finalArgs,
|