@bike4mind/cli 0.2.5-feat-server-side-tool-execution.17093 → 0.2.5-feat-cli-docker-mcp-support.17095

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.
Files changed (3) hide show
  1. package/README.md +50 -4
  2. package/dist/index.js +56 -39
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -172,13 +172,15 @@ export SERPER_API_KEY="your-key-here"
172
172
 
173
173
  MCP (Model Context Protocol) servers provide additional tools and capabilities. Configure them in `~/.bike4mind/config.json`:
174
174
 
175
+ #### Internal MCP Servers (Node.js)
176
+
177
+ For MCP servers bundled with the monorepo, you can omit `command` and `args` - the CLI will automatically discover them:
178
+
175
179
  ```json
176
180
  {
177
181
  "mcpServers": [
178
182
  {
179
183
  "name": "github",
180
- "command": "node",
181
- "args": ["path/to/mcp/server.js"],
182
184
  "env": {
183
185
  "GITHUB_ACCESS_TOKEN": "ghp_..."
184
186
  },
@@ -188,12 +190,56 @@ MCP (Model Context Protocol) servers provide additional tools and capabilities.
188
190
  }
189
191
  ```
190
192
 
191
- **Available MCP Servers:**
193
+ #### External MCP Servers (Docker)
194
+
195
+ You can run MCP servers in Docker containers for isolation and portability:
196
+
197
+ ```json
198
+ {
199
+ "mcpServers": [
200
+ {
201
+ "name": "github",
202
+ "command": "docker",
203
+ "args": ["run", "-i", "--rm", "-e", "GITHUB_TOKEN", "ghcr.io/github/github-mcp-server"],
204
+ "env": {
205
+ "GITHUB_TOKEN": "ghp_..."
206
+ },
207
+ "enabled": true
208
+ }
209
+ ]
210
+ }
211
+ ```
212
+
213
+ **Docker Configuration Notes:**
214
+ - The `-i` flag is required for stdin communication with the MCP server
215
+ - Use `-e VAR_NAME` (without value) to pass environment variables from the host
216
+ - The `--rm` flag ensures containers are cleaned up after use
217
+ - Requires Docker to be installed and running
218
+
219
+ #### External MCP Servers (npx/Custom Commands)
220
+
221
+ You can also run any MCP server via npx or custom executables:
222
+
223
+ ```json
224
+ {
225
+ "mcpServers": [
226
+ {
227
+ "name": "filesystem",
228
+ "command": "npx",
229
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"],
230
+ "env": {},
231
+ "enabled": true
232
+ }
233
+ ]
234
+ }
235
+ ```
236
+
237
+ **Available Built-in MCP Servers:**
192
238
  - 🔧 **GitHub** - Repository management, issues, PRs (requires `GITHUB_ACCESS_TOKEN`)
193
239
  - 🔧 **LinkedIn** - Post management, analytics (requires `LINKEDIN_ACCESS_TOKEN`, `COMPANY_NAME`)
194
240
  - 🔧 **Atlassian** - Jira/Confluence integration (requires `ATLASSIAN_ACCESS_TOKEN`, `ATLASSIAN_CLOUD_ID`, `ATLASSIAN_SITE_URL`)
195
241
 
196
- **Note:** MCP servers must be built and available in the `b4m-core/packages/mcp/dist/src/` directory. The CLI will automatically find them if you're running from the monorepo.
242
+ **Note:** Internal MCP servers must be built and available in the `b4m-core/packages/mcp/dist/src/` directory. The CLI will automatically find them if you're running from the monorepo. For Docker-based servers, ensure Docker is installed and the image is accessible.
197
243
 
198
244
  ## Session Storage
199
245
 
package/dist/index.js CHANGED
@@ -1421,8 +1421,8 @@ var CliConfigSchema = z.object({
1421
1421
  mcpServers: z.array(
1422
1422
  z.object({
1423
1423
  name: z.string(),
1424
- command: z.string(),
1425
- args: z.array(z.string()),
1424
+ command: z.string().optional(),
1425
+ args: z.array(z.string()).optional(),
1426
1426
  env: z.record(z.string()),
1427
1427
  enabled: z.boolean()
1428
1428
  })
@@ -8790,12 +8790,16 @@ var MCPClient = class {
8790
8790
  mcp;
8791
8791
  transport = null;
8792
8792
  envVariables;
8793
+ customCommand;
8794
+ customArgs;
8793
8795
  tools = [];
8794
8796
  serverName;
8795
- constructor({ envVariables, name, selectedRepositories }) {
8797
+ constructor({ envVariables, name, selectedRepositories, command, args }) {
8796
8798
  this.mcp = new Client2({ name: "mcp-client-cli", version: "1.0.0" });
8797
8799
  this.envVariables = [...envVariables];
8798
8800
  this.serverName = name;
8801
+ this.customCommand = command;
8802
+ this.customArgs = args;
8799
8803
  if (name === "github" && selectedRepositories) {
8800
8804
  const reposJson = JSON.stringify(selectedRepositories);
8801
8805
  this.envVariables.push({
@@ -8806,37 +8810,48 @@ var MCPClient = class {
8806
8810
  }
8807
8811
  async connectToServer() {
8808
8812
  try {
8809
- const root = process.env.INIT_CWD || process.cwd();
8810
- const candidatePaths = [
8811
- // When running from SST Lambda with node_modules structure (copyFiles)
8812
- path12.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
8813
- // When running from SST Lambda deployed environment (/var/task)
8814
- path12.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8815
- // When running from SST Lambda (.sst/artifacts/mcpHandler-dev), navigate to monorepo root (3 levels up)
8816
- path12.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8817
- // When running from packages/client (Next.js app), navigate to monorepo root (2 levels up)
8818
- path12.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8819
- // Original paths (backward compatibility)
8820
- path12.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8821
- path12.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
8822
- ];
8823
- const serverScriptPath = candidatePaths.find((p) => existsSync6(p));
8824
- if (!serverScriptPath) {
8825
- const getDirectories = (source) => readdirSync3(source, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
8826
- console.error(`[MCP] Server script not found. Tried paths:`, candidatePaths);
8827
- console.error(`[MCP] Available directories in ${root}:`, getDirectories(root));
8828
- throw new Error(`MCP Server script path not found for ${this.serverName}. Root: ${root}, Available dirs: ${getDirectories(root).join(", ")}`);
8829
- }
8830
- console.log(`[MCP] Using server: ${this.serverName} at ${serverScriptPath}`);
8813
+ const envVarsObject = this.envVariables.reduce((acc, env) => ({
8814
+ ...acc,
8815
+ [env.key]: env.value
8816
+ }), {});
8817
+ let command;
8818
+ let args;
8819
+ if (this.customCommand && this.customCommand.trim() !== "") {
8820
+ command = this.customCommand;
8821
+ args = this.customArgs ?? [];
8822
+ console.log(`[MCP] Using external command for ${this.serverName}: ${command} ${args.join(" ")}`);
8823
+ } else {
8824
+ const root = process.env.INIT_CWD || process.cwd();
8825
+ const candidatePaths = [
8826
+ // When running from SST Lambda with node_modules structure (copyFiles)
8827
+ path12.join(root, `node_modules/@bike4mind/mcp/dist/src/${this.serverName}/index.js`),
8828
+ // When running from SST Lambda deployed environment (/var/task)
8829
+ path12.join(root, `b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8830
+ // When running from SST Lambda (.sst/artifacts/mcpHandler-dev), navigate to monorepo root (3 levels up)
8831
+ path12.join(root, `../../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8832
+ // When running from packages/client (Next.js app), navigate to monorepo root (2 levels up)
8833
+ path12.join(root, `../../b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8834
+ // Original paths (backward compatibility)
8835
+ path12.join(root, `/b4m-core/packages/mcp/dist/src/${this.serverName}/index.js`),
8836
+ path12.join(root, "core", "mcp", "servers", this.serverName, "dist", "index.js")
8837
+ ];
8838
+ const serverScriptPath = candidatePaths.find((p) => existsSync6(p));
8839
+ if (!serverScriptPath) {
8840
+ const getDirectories = (source) => readdirSync3(source, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
8841
+ console.error(`[MCP] Server script not found. Tried paths:`, candidatePaths);
8842
+ console.error(`[MCP] Available directories in ${root}:`, getDirectories(root));
8843
+ throw new Error(`MCP Server script path not found for ${this.serverName}. Root: ${root}, Available dirs: ${getDirectories(root).join(", ")}`);
8844
+ }
8845
+ command = process.execPath;
8846
+ args = [serverScriptPath];
8847
+ console.log(`[MCP] Using server: ${this.serverName} at ${serverScriptPath}`);
8848
+ }
8831
8849
  this.transport = new StdioClientTransport({
8832
- command: process.execPath,
8833
- args: [serverScriptPath],
8850
+ command,
8851
+ args,
8834
8852
  env: {
8835
- ...process.env,
8836
- ...this.envVariables.reduce((acc, env) => ({
8837
- ...acc,
8838
- [env.key]: env.value
8839
- }), {})
8853
+ ...Object.fromEntries(Object.entries(process.env).filter((entry) => entry[1] !== void 0)),
8854
+ ...envVarsObject
8840
8855
  }
8841
8856
  });
8842
8857
  this.transport.onerror = (error) => {
@@ -8944,7 +8959,9 @@ var McpManager = class {
8944
8959
  }));
8945
8960
  const client = new MCPClient({
8946
8961
  envVariables,
8947
- name: serverConfig.name
8962
+ name: serverConfig.name,
8963
+ command: serverConfig.command,
8964
+ args: serverConfig.args
8948
8965
  });
8949
8966
  await client.connectToServer();
8950
8967
  const mcpData = {
@@ -9402,7 +9419,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
9402
9419
  // package.json
9403
9420
  var package_default = {
9404
9421
  name: "@bike4mind/cli",
9405
- version: "0.2.5-feat-server-side-tool-execution.17093+db1662b89",
9422
+ version: "0.2.5-feat-cli-docker-mcp-support.17095+1671ebc5f",
9406
9423
  type: "module",
9407
9424
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9408
9425
  license: "UNLICENSED",
@@ -9504,10 +9521,10 @@ var package_default = {
9504
9521
  },
9505
9522
  devDependencies: {
9506
9523
  "@bike4mind/agents": "0.1.0",
9507
- "@bike4mind/common": "2.37.1-feat-server-side-tool-execution.17093+db1662b89",
9508
- "@bike4mind/mcp": "1.19.6-feat-server-side-tool-execution.17093+db1662b89",
9509
- "@bike4mind/services": "2.32.2-feat-server-side-tool-execution.17093+db1662b89",
9510
- "@bike4mind/utils": "2.1.1-feat-server-side-tool-execution.17093+db1662b89",
9524
+ "@bike4mind/common": "2.37.1-feat-cli-docker-mcp-support.17095+1671ebc5f",
9525
+ "@bike4mind/mcp": "1.19.6-feat-cli-docker-mcp-support.17095+1671ebc5f",
9526
+ "@bike4mind/services": "2.32.2-feat-cli-docker-mcp-support.17095+1671ebc5f",
9527
+ "@bike4mind/utils": "2.1.1-feat-cli-docker-mcp-support.17095+1671ebc5f",
9511
9528
  "@types/diff": "^5.0.9",
9512
9529
  "@types/jsonwebtoken": "^9.0.4",
9513
9530
  "@types/node": "^22.9.0",
@@ -9519,7 +9536,7 @@ var package_default = {
9519
9536
  typescript: "^5.9.3",
9520
9537
  vitest: "^3.2.4"
9521
9538
  },
9522
- gitHead: "db1662b8926451c7fdba8eb99245b75f6fae6693"
9539
+ gitHead: "1671ebc5f5250ee3a79c12b4c549b2c256e71f4d"
9523
9540
  };
9524
9541
 
9525
9542
  // src/config/constants.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.5-feat-server-side-tool-execution.17093+db1662b89",
3
+ "version": "0.2.5-feat-cli-docker-mcp-support.17095+1671ebc5f",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "devDependencies": {
104
104
  "@bike4mind/agents": "0.1.0",
105
- "@bike4mind/common": "2.37.1-feat-server-side-tool-execution.17093+db1662b89",
106
- "@bike4mind/mcp": "1.19.6-feat-server-side-tool-execution.17093+db1662b89",
107
- "@bike4mind/services": "2.32.2-feat-server-side-tool-execution.17093+db1662b89",
108
- "@bike4mind/utils": "2.1.1-feat-server-side-tool-execution.17093+db1662b89",
105
+ "@bike4mind/common": "2.37.1-feat-cli-docker-mcp-support.17095+1671ebc5f",
106
+ "@bike4mind/mcp": "1.19.6-feat-cli-docker-mcp-support.17095+1671ebc5f",
107
+ "@bike4mind/services": "2.32.2-feat-cli-docker-mcp-support.17095+1671ebc5f",
108
+ "@bike4mind/utils": "2.1.1-feat-cli-docker-mcp-support.17095+1671ebc5f",
109
109
  "@types/diff": "^5.0.9",
110
110
  "@types/jsonwebtoken": "^9.0.4",
111
111
  "@types/node": "^22.9.0",
@@ -117,5 +117,5 @@
117
117
  "typescript": "^5.9.3",
118
118
  "vitest": "^3.2.4"
119
119
  },
120
- "gitHead": "db1662b8926451c7fdba8eb99245b75f6fae6693"
120
+ "gitHead": "1671ebc5f5250ee3a79c12b4c549b2c256e71f4d"
121
121
  }