From 9ce3356c335bca3d84b6ec038503cb78ee2e55c9 Mon Sep 17 00:00:00 2001 From: Yuming Hsieh Date: Mon, 29 Dec 2025 10:52:26 -0500 Subject: [PATCH 1/4] @W-20590941 updates for local dev process --- packages/b2c-dx-mcp/README.md | 35 +++++++++++++++++--------------- packages/b2c-dx-mcp/package.json | 1 + 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/packages/b2c-dx-mcp/README.md b/packages/b2c-dx-mcp/README.md index 95beb643..57fa2e8c 100644 --- a/packages/b2c-dx-mcp/README.md +++ b/packages/b2c-dx-mcp/README.md @@ -193,37 +193,40 @@ npx mcp-inspector --cli node bin/run.js --toolsets all --allow-non-ga-tools \ --tool-name sfnext_design_decorator ``` -#### 2. IDE Integration +#### 2. IDE Integration (Recommended) -Configure your IDE to use the local server. Choose development mode (no build required) or production mode (requires build). +For local development with IDE integration (e.g., Cursor, VS Code), use the **watch mode workflow**. This provides fast iteration without requiring global dependencies. -**Development Mode** (recommended for active development - uses TypeScript source directly): +**Step 1: Start TypeScript in watch mode** -```json -{ - "mcpServers": { - "b2c-dx-local": { - "command": "/full/path/to/packages/b2c-dx-mcp/bin/dev.js", - "args": ["--toolsets", "all", "--allow-non-ga-tools"] - } - } -} +In a terminal, run: + +```bash +cd packages/b2c-dx-mcp +pnpm run dev:watch ``` -**Production Mode** (uses compiled JavaScript - run `pnpm run build` first): +This watches for file changes and recompiles automatically (~1-2 seconds per change). + +**Step 2: Configure your IDE to use the production build** + +Add this to your IDE's MCP configuration: ```json { "mcpServers": { "b2c-dx-local": { - "command": "/full/path/to/packages/b2c-dx-mcp/bin/run.js", - "args": ["--toolsets", "all", "--allow-non-ga-tools"] + "command": "node", + "args": ["/full/path/to/packages/b2c-dx-mcp/bin/run.js", "--toolsets", "all", "--allow-non-ga-tools"] } } } ``` -> **Note:** For production mode, run `pnpm run build` after code changes and restart your IDE. Development mode picks up changes automatically. +**Development workflow:** +1. Edit source code +2. TypeScript auto-compiles (watch the terminal for confirmation) +3. Restart the MCP server in your IDE to pick up changes #### 3. JSON-RPC via stdin diff --git a/packages/b2c-dx-mcp/package.json b/packages/b2c-dx-mcp/package.json index 69324e68..17fb63ac 100644 --- a/packages/b2c-dx-mcp/package.json +++ b/packages/b2c-dx-mcp/package.json @@ -60,6 +60,7 @@ }, "scripts": { "build": "tsc", + "dev:watch": "tsc --watch", "clean": "shx rm -rf dist", "lint": "eslint", "format": "prettier --write src", From 99f9700aa870e9d2de4eda6147c52724fa2b693b Mon Sep 17 00:00:00 2001 From: Yuming Hsieh Date: Mon, 29 Dec 2025 15:02:11 -0500 Subject: [PATCH 2/4] update setup instruction and remove unneeded scripts --- packages/b2c-dx-mcp/README.md | 34 ++++++++------------------------ packages/b2c-dx-mcp/package.json | 4 +--- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/packages/b2c-dx-mcp/README.md b/packages/b2c-dx-mcp/README.md index 57fa2e8c..92f74a17 100644 --- a/packages/b2c-dx-mcp/README.md +++ b/packages/b2c-dx-mcp/README.md @@ -185,48 +185,30 @@ For CLI-based testing: ```bash # List all tools -npx mcp-inspector --cli node bin/run.js --toolsets all --allow-non-ga-tools --method tools/list +npx mcp-inspector --cli node bin/dev.js --toolsets all --allow-non-ga-tools --method tools/list # Call a specific tool -npx mcp-inspector --cli node bin/run.js --toolsets all --allow-non-ga-tools \ +npx mcp-inspector --cli node bin/dev.js --toolsets all --allow-non-ga-tools \ --method tools/call \ --tool-name sfnext_design_decorator ``` -#### 2. IDE Integration (Recommended) +#### 2. IDE Integration -For local development with IDE integration (e.g., Cursor, VS Code), use the **watch mode workflow**. This provides fast iteration without requiring global dependencies. - -**Step 1: Start TypeScript in watch mode** - -In a terminal, run: - -```bash -cd packages/b2c-dx-mcp -pnpm run dev:watch -``` - -This watches for file changes and recompiles automatically (~1-2 seconds per change). - -**Step 2: Configure your IDE to use the production build** - -Add this to your IDE's MCP configuration: +Configure your IDE to use the local MCP server. Add this to your IDE's MCP configuration: ```json { "mcpServers": { "b2c-dx-local": { "command": "node", - "args": ["/full/path/to/packages/b2c-dx-mcp/bin/run.js", "--toolsets", "all", "--allow-non-ga-tools"] + "args": ["/full/path/to/packages/b2c-dx-mcp/bin/dev.js", "--toolsets", "all", "--allow-non-ga-tools"] } } } ``` -**Development workflow:** -1. Edit source code -2. TypeScript auto-compiles (watch the terminal for confirmation) -3. Restart the MCP server in your IDE to pick up changes +> **Note:** Restart the MCP server in your IDE to pick up code changes. #### 3. JSON-RPC via stdin @@ -234,10 +216,10 @@ Send raw MCP protocol messages: ```bash # List all tools (--allow-non-ga-tools required for placeholder tools) -echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node bin/run.js --toolsets all --allow-non-ga-tools +echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | node bin/dev.js --toolsets all --allow-non-ga-tools # Call a specific tool -echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"cartridge_deploy","arguments":{}}}' | node bin/run.js --toolsets all --allow-non-ga-tools +echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"cartridge_deploy","arguments":{}}}' | node bin/dev.js --toolsets all --allow-non-ga-tools ``` ### Configuration diff --git a/packages/b2c-dx-mcp/package.json b/packages/b2c-dx-mcp/package.json index 17fb63ac..abff97e7 100644 --- a/packages/b2c-dx-mcp/package.json +++ b/packages/b2c-dx-mcp/package.json @@ -60,13 +60,11 @@ }, "scripts": { "build": "tsc", - "dev:watch": "tsc --watch", "clean": "shx rm -rf dist", "lint": "eslint", "format": "prettier --write src", "format:check": "prettier --check src", - "preinspect": "pnpm run build", - "inspect": "mcp-inspector node bin/run.js --toolsets all --allow-non-ga-tools", + "inspect": "mcp-inspector node bin/dev.js --toolsets all --allow-non-ga-tools", "pretest": "tsc --noEmit -p test", "test": "mocha --forbid-only \"test/**/*.test.ts\"", "posttest": "pnpm run lint", From 9cca885c8488c6fbe4d7549bf6c34bb51c381bec Mon Sep 17 00:00:00 2001 From: yhsieh1 Date: Mon, 29 Dec 2025 15:09:54 -0500 Subject: [PATCH 3/4] Update packages/b2c-dx-mcp/README.md Co-authored-by: Charles Lavery --- packages/b2c-dx-mcp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/b2c-dx-mcp/README.md b/packages/b2c-dx-mcp/README.md index 92f74a17..f41f1d29 100644 --- a/packages/b2c-dx-mcp/README.md +++ b/packages/b2c-dx-mcp/README.md @@ -202,7 +202,7 @@ Configure your IDE to use the local MCP server. Add this to your IDE's MCP confi "mcpServers": { "b2c-dx-local": { "command": "node", - "args": ["/full/path/to/packages/b2c-dx-mcp/bin/dev.js", "--toolsets", "all", "--allow-non-ga-tools"] + "args": ["--conditions", "development", "/full/path/to/packages/b2c-dx-mcp/bin/dev.js", "--toolsets", "all", "--allow-non-ga-tools"] } } } From 7c57038a86538fa2d4e4bdff441488965c5560e9 Mon Sep 17 00:00:00 2001 From: Yuming Hsieh Date: Mon, 29 Dec 2025 15:14:59 -0500 Subject: [PATCH 4/4] update script --- packages/b2c-dx-mcp/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/b2c-dx-mcp/package.json b/packages/b2c-dx-mcp/package.json index abff97e7..63915bf4 100644 --- a/packages/b2c-dx-mcp/package.json +++ b/packages/b2c-dx-mcp/package.json @@ -64,7 +64,9 @@ "lint": "eslint", "format": "prettier --write src", "format:check": "prettier --check src", - "inspect": "mcp-inspector node bin/dev.js --toolsets all --allow-non-ga-tools", + "preinspect": "pnpm run build", + "inspect": "mcp-inspector node bin/run.js --toolsets all --allow-non-ga-tools", + "inspect:dev": "mcp-inspector node --conditions development bin/dev.js --toolsets all --allow-non-ga-tools", "pretest": "tsc --noEmit -p test", "test": "mocha --forbid-only \"test/**/*.test.ts\"", "posttest": "pnpm run lint",