@ruifung/codemode-bridge 1.0.4 → 1.0.6

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.
@@ -136,7 +136,7 @@ export function addServerCommand(name, options, configPath) {
136
136
  };
137
137
  if (options.type === "stdio") {
138
138
  if (!options.command) {
139
- console.error(chalk.red("✗") + ' Missing --command for stdio server');
139
+ console.error(chalk.red("✗") + " Missing command for stdio server");
140
140
  process.exit(1);
141
141
  }
142
142
  entry.command = options.command;
@@ -146,7 +146,7 @@ export function addServerCommand(name, options, configPath) {
146
146
  }
147
147
  else if (options.type === "http") {
148
148
  if (!options.url) {
149
- console.error(chalk.red("✗") + ' Missing --url for http server');
149
+ console.error(chalk.red("✗") + " Missing --url for http server");
150
150
  process.exit(1);
151
151
  }
152
152
  entry.url = options.url;
package/dist/cli/index.js CHANGED
@@ -18,15 +18,20 @@
18
18
  */
19
19
  import { Command } from "commander";
20
20
  import { runServer, listServersCommand, showServerCommand, addServerCommand, removeServerCommand, editServerCommand, configInfoCommand, authLoginCommand, authLogoutCommand, authListCommand, } from "./commands.js";
21
+ import { getConfigFilePath } from "./config-manager.js";
21
22
  import * as fs from "fs";
22
23
  const pkg = JSON.parse(fs.readFileSync(new URL("../../package.json", import.meta.url), "utf-8"));
24
+ const defaultConfigPath = getConfigFilePath();
23
25
  const program = new Command();
24
- program.name("codemode-bridge").description("Code Mode Bridge CLI").version(pkg.version);
26
+ program
27
+ .name("codemode-bridge")
28
+ .description("Code Mode Bridge CLI - Connects to multiple MCP servers and exposes them as a single tool")
29
+ .version(pkg.version);
25
30
  // Main 'run' command
26
31
  program
27
- .command("run")
32
+ .command("run", { isDefault: true })
28
33
  .description("Start the bridge MCP server (default command)")
29
- .option("-c, --config <path>", "Path to mcp.json configuration file (default: ~/.config/codemode-bridge/mcp.json)")
34
+ .option("-c, --config <path>", `Path to mcp.json configuration file (default: ${defaultConfigPath})`)
30
35
  .option("-s, --servers <names>", "Comma-separated list of servers to connect to")
31
36
  .option("-d, --debug", "Enable debug logging")
32
37
  .action(async (options) => {
@@ -43,20 +48,27 @@ config
43
48
  listServersCommand(options.config);
44
49
  });
45
50
  config
46
- .command("show <name>")
51
+ .command("show <server-name>")
47
52
  .description("Show a server configuration")
48
53
  .option("-c, --config <path>", "Path to mcp.json configuration file")
49
54
  .action((name, options) => {
50
55
  showServerCommand(name, options.config);
51
56
  });
52
57
  config
53
- .command("add <name> [commandAndArgs...]")
58
+ .command("add <server-name> [commandAndArgs...]")
54
59
  .description("Add a new server configuration (use -- before commands with flags, e.g. -- npx -y @some/pkg)")
55
60
  .passThroughOptions()
56
61
  .requiredOption("-t, --type <type>", "Server type (stdio or http)")
57
62
  .option("--url <url>", "Server URL (required for http servers)")
58
63
  .option("--env <env...>", 'Environment variables as KEY=VALUE pairs')
59
64
  .option("-c, --config <path>", "Path to mcp.json configuration file")
65
+ .addHelpText("after", `
66
+ Examples:
67
+ $ codemode-bridge config add my-server --type stdio node /path/to/server.js
68
+ $ codemode-bridge config add remote-server --type http --url https://api.example.com/mcp
69
+ $ codemode-bridge config add secure-server --type stdio --env API_KEY=secret python server.py
70
+ $ codemode-bridge config add npx-server --type stdio -- npx -y @modelcontextprotocol/server-everything
71
+ `)
60
72
  .action((name, commandAndArgs, options) => {
61
73
  let command;
62
74
  let args;
@@ -85,19 +97,25 @@ config
85
97
  }, options.config);
86
98
  });
87
99
  config
88
- .command("remove <name>")
100
+ .command("remove <server-name>")
89
101
  .description("Remove a server configuration")
90
102
  .option("-c, --config <path>", "Path to mcp.json configuration file")
91
103
  .action((name, options) => {
92
104
  removeServerCommand(name, options.config);
93
105
  });
94
106
  config
95
- .command("edit <name> [commandAndArgs...]")
107
+ .command("edit <server-name> [commandAndArgs...]")
96
108
  .description("Edit a server configuration")
97
109
  .option("-t, --type <type>", "Server type (stdio or http)")
98
110
  .option("--url <url>", "Server URL (for http servers)")
99
111
  .option("--env <env...>", 'Environment variables as KEY=VALUE pairs')
100
112
  .option("-c, --config <path>", "Path to mcp.json configuration file")
113
+ .addHelpText("after", `
114
+ Examples:
115
+ $ codemode-bridge config edit my-server node /new/path/to/server.js
116
+ $ codemode-bridge config edit remote-server --url https://new-api.example.com/mcp
117
+ $ codemode-bridge config edit secure-server --env API_KEY=new-secret
118
+ `)
101
119
  .action((name, commandAndArgs, options) => {
102
120
  let command;
103
121
  let args;
@@ -155,12 +173,4 @@ auth
155
173
  .action((serverName, options) => {
156
174
  authLogoutCommand(serverName, options.config);
157
175
  });
158
- // Default command: run if no command specified
159
- program.action(async () => {
160
- // If no command is specified, run the bridge
161
- const args = process.argv.slice(2);
162
- if (args.length === 0) {
163
- await runServer(undefined, undefined, false);
164
- }
165
- });
166
176
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruifung/codemode-bridge",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "MCP bridge that connects to upstream MCP servers and exposes tools via a single codemode tool for orchestration",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -38,7 +38,6 @@
38
38
  "acorn": "^8.16.0",
39
39
  "chalk": "^5.6.2",
40
40
  "commander": "^12.1.0",
41
- "isolated-vm": "^6.0.2",
42
41
  "open": "^10.1.0",
43
42
  "uuid": "^13.0.0",
44
43
  "vm2": "^3.10.5",
@@ -51,5 +50,8 @@
51
50
  "tsx": "^4.21.0",
52
51
  "typescript": "^5.9.3",
53
52
  "vitest": "^4.0.18"
53
+ },
54
+ "optionalDependencies": {
55
+ "isolated-vm": "^6.0.2"
54
56
  }
55
57
  }