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 +15 -1
- package/dist/bin/mcp-proxy.mjs +19 -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 +28 -5
package/jsr.json
CHANGED
package/package.json
CHANGED
package/src/bin/mcp-proxy.ts
CHANGED
|
@@ -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
|
-
.
|
|
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
|
-
//
|
|
118
|
+
// If -- separator was used, everything after -- is the command and its args
|
|
109
119
|
const dashDashArgs = argv["--"] as string[] | undefined;
|
|
110
|
-
|
|
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("
|
|
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({
|