fix(mcp): bundle build with esbuild so plugin cache never needs node_modules
Claude Code spawns plugin MCP servers straight from the read-only git-content plugin cache, which never gets an npm install for mcp/. The old tsc-multi-file build imported bare specifiers that only resolved via mcp/node_modules, so every fresh plugin install/update produced a -32000 reconnect failure. Bundle mcp/src into a single dependency-free build/index.js instead; the one CJS-heavy import (express, only used by --transport=http) is now dynamic so the stdio path never evaluates it.
This commit is contained in:
+2
-1
@@ -10,7 +10,7 @@
|
||||
"scripts": {
|
||||
"clean": "node -e \"require('node:fs').rmSync('build',{recursive:true,force:true})\"",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
"build": "npm run clean && tsc -p tsconfig.json",
|
||||
"build": "npm run clean && npm run typecheck && esbuild src/index.ts --bundle --platform=node --format=esm --target=node18 --outfile=build/index.js",
|
||||
"start": "node build/index.js",
|
||||
"start:http": "node build/index.js --transport=http",
|
||||
"start:repl": "node build/index.js --transport=repl",
|
||||
@@ -29,6 +29,7 @@
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/node": "^22.18.0",
|
||||
"esbuild": "^0.24.0",
|
||||
"tsx": "^4.20.5",
|
||||
"typescript": "^5.9.2"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user