mcp-proxy 6.1.8 → 6.1.9

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 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
- > The `--` separator is required to separate mcp-proxy options from the command being proxied.
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
 
@@ -5012,7 +5012,14 @@ var StdioClientTransport = class {
5012
5012
  //#region src/bin/mcp-proxy.ts
5013
5013
  util.inspect.defaultOptions.depth = 8;
5014
5014
  if (!("EventSource" in global)) global.EventSource = EventSource;
5015
- const argv = await yargs_default(hideBin(process.argv)).scriptName("mcp-proxy").usage("$0 [options] -- <command> [args...]").env("MCP_PROXY").parserConfiguration({ "populate--": true }).options({
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
+ describe: "The command to run",
5017
+ type: "string"
5018
+ }).positional("args", {
5019
+ array: true,
5020
+ describe: "The arguments to pass to the command",
5021
+ type: "string"
5022
+ }).usage("$0 [options] -- <command> [args...]\n $0 <command> [args...]").env("MCP_PROXY").parserConfiguration({ "populate--": true }).options({
5016
5023
  apiKey: {
5017
5024
  describe: "API key for authenticating requests (uses X-API-Key header)",
5018
5025
  type: "string"
@@ -5085,14 +5092,22 @@ const argv = await yargs_default(hideBin(process.argv)).scriptName("mcp-proxy").
5085
5092
  }
5086
5093
  }).help().parseAsync();
5087
5094
  const dashDashArgs = argv["--"];
5088
- if (!dashDashArgs || dashDashArgs.length === 0) {
5095
+ let finalCommand;
5096
+ let finalArgs;
5097
+ if (dashDashArgs && dashDashArgs.length > 0) [finalCommand, ...finalArgs] = dashDashArgs;
5098
+ else if (argv.command) {
5099
+ finalCommand = argv.command;
5100
+ finalArgs = argv.args || [];
5101
+ } else {
5089
5102
  console.error("Error: No command specified.");
5090
5103
  console.error("Usage: mcp-proxy [options] -- <command> [args...]");
5104
+ console.error(" or: mcp-proxy <command> [args...]");
5091
5105
  console.error("");
5092
- console.error("Example: mcp-proxy --port 8080 -- node server.js --port 3000");
5106
+ console.error("Examples:");
5107
+ console.error(" mcp-proxy --port 8080 -- node server.js --port 3000");
5108
+ console.error(" mcp-proxy node server.js");
5093
5109
  process.exit(1);
5094
5110
  }
5095
- const [finalCommand, ...finalArgs] = dashDashArgs;
5096
5111
  const connect = async (client) => {
5097
5112
  const transport = new StdioClientTransport({
5098
5113
  args: finalArgs,