Skip to content

Commit bce3a7b

Browse files
committed
Make root package installable/executable
1 parent 196f2f8 commit bce3a7b

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

bin/cli.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
3+
import { join, dirname } from "path";
4+
import { fileURLToPath } from "url";
5+
import concurrently from "concurrently";
6+
7+
const __dirname = dirname(fileURLToPath(import.meta.url));
8+
9+
// Paths to the server and client entry points
10+
const serverPath = join(__dirname, "../server/build/index.js");
11+
const clientPath = join(__dirname, "../client/bin/cli.js");
12+
13+
console.log("Starting MCP inspector...");
14+
15+
const { result } = concurrently(
16+
[
17+
{
18+
command: `node ${serverPath}`,
19+
name: "server",
20+
},
21+
{
22+
command: `node ${clientPath}`,
23+
name: "client",
24+
},
25+
],
26+
{
27+
prefix: "name",
28+
killOthers: ["failure", "success"],
29+
restartTries: 3,
30+
},
31+
);
32+
33+
result.catch((err) => {
34+
console.error("An error occurred:", err);
35+
process.exit(1);
36+
});

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
"homepage": "https://modelcontextprotocol.github.io",
88
"bugs": "https://github.com/modelcontextprotocol/inspector/issues",
99
"type": "module",
10+
"bin": {
11+
"mcp-inspector": "./bin/cli.js"
12+
},
13+
"files": [
14+
"bin",
15+
"client/dist",
16+
"server/build"
17+
],
1018
"workspaces": [
1119
"client",
1220
"server"
@@ -18,11 +26,13 @@
1826
"build": "npm run build-server && npm run build-client",
1927
"start-server": "cd server && npm run start",
2028
"start-client": "cd client && npm run preview",
21-
"start": "concurrently \"npm run start-server\" \"npm run start-client\"",
29+
"start": "./bin/cli.js",
30+
"prepare": "npm run build",
2231
"prettier-fix": "prettier --write ."
2332
},
2433
"devDependencies": {
2534
"concurrently": "^9.0.1",
26-
"prettier": "3.3.3"
35+
"prettier": "3.3.3",
36+
"@types/node": "^22.7.5"
2737
}
2838
}

0 commit comments

Comments
 (0)