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/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.8"
6
+ "version": "6.1.9"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-proxy",
3
- "version": "6.1.8",
3
+ "version": "6.1.9",
4
4
  "main": "dist/index.mjs",
5
5
  "scripts": {
6
6
  "build": "tsdown",
@@ -22,7 +22,17 @@ if (!("EventSource" in global)) {
22
22
 
23
23
  const argv = await yargs(hideBin(process.argv))
24
24
  .scriptName("mcp-proxy")
25
- .usage("$0 [options] -- <command> [args...]")
25
+ .command("$0 [command] [args...]", "Proxy an MCP stdio server over HTTP")
26
+ .positional("command", {
27
+ describe: "The command to run",
28
+ type: "string",
29
+ })
30
+ .positional("args", {
31
+ array: true,
32
+ describe: "The arguments to pass to the command",
33
+ type: "string",
34
+ })
35
+ .usage("$0 [options] -- <command> [args...]\n $0 <command> [args...]")
26
36
  .env("MCP_PROXY")
27
37
  .parserConfiguration({
28
38
  "populate--": true,
@@ -105,16 +115,29 @@ const argv = await yargs(hideBin(process.argv))
105
115
  .help()
106
116
  .parseAsync();
107
117
 
108
- // Determine the final command and args from -- separator
118
+ // If -- separator was used, everything after -- is the command and its args
109
119
  const dashDashArgs = argv["--"] as string[] | undefined;
110
- if (!dashDashArgs || dashDashArgs.length === 0) {
120
+
121
+ let finalCommand: string;
122
+ let finalArgs: string[];
123
+
124
+ if (dashDashArgs && dashDashArgs.length > 0) {
125
+ // -- was used: first item after -- is command, rest are args
126
+ [finalCommand, ...finalArgs] = dashDashArgs;
127
+ } else if (argv.command) {
128
+ // No -- used: use positional command and args
129
+ finalCommand = argv.command as string;
130
+ finalArgs = (argv.args as string[]) || [];
131
+ } else {
111
132
  console.error("Error: No command specified.");
112
133
  console.error("Usage: mcp-proxy [options] -- <command> [args...]");
134
+ console.error(" or: mcp-proxy <command> [args...]");
113
135
  console.error("");
114
- console.error("Example: mcp-proxy --port 8080 -- node server.js --port 3000");
136
+ console.error("Examples:");
137
+ console.error(" mcp-proxy --port 8080 -- node server.js --port 3000");
138
+ console.error(" mcp-proxy node server.js");
115
139
  process.exit(1);
116
140
  }
117
- const [finalCommand, ...finalArgs] = dashDashArgs;
118
141
 
119
142
  const connect = async (client: Client) => {
120
143
  const transport = new StdioClientTransport({