Make root package installable/executable
This commit is contained in:
36
bin/cli.js
Executable file
36
bin/cli.js
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { join, dirname } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import concurrently from "concurrently";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
// Paths to the server and client entry points
|
||||
const serverPath = join(__dirname, "../server/build/index.js");
|
||||
const clientPath = join(__dirname, "../client/bin/cli.js");
|
||||
|
||||
console.log("Starting MCP inspector...");
|
||||
|
||||
const { result } = concurrently(
|
||||
[
|
||||
{
|
||||
command: `node ${serverPath}`,
|
||||
name: "server",
|
||||
},
|
||||
{
|
||||
command: `node ${clientPath}`,
|
||||
name: "client",
|
||||
},
|
||||
],
|
||||
{
|
||||
prefix: "name",
|
||||
killOthers: ["failure", "success"],
|
||||
restartTries: 3,
|
||||
},
|
||||
);
|
||||
|
||||
result.catch((err) => {
|
||||
console.error("An error occurred:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
14
package.json
14
package.json
@@ -7,6 +7,14 @@
|
||||
"homepage": "https://modelcontextprotocol.github.io",
|
||||
"bugs": "https://github.com/modelcontextprotocol/inspector/issues",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"mcp-inspector": "./bin/cli.js"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"client/dist",
|
||||
"server/build"
|
||||
],
|
||||
"workspaces": [
|
||||
"client",
|
||||
"server"
|
||||
@@ -18,11 +26,13 @@
|
||||
"build": "npm run build-server && npm run build-client",
|
||||
"start-server": "cd server && npm run start",
|
||||
"start-client": "cd client && npm run preview",
|
||||
"start": "concurrently \"npm run start-server\" \"npm run start-client\"",
|
||||
"start": "./bin/cli.js",
|
||||
"prepare": "npm run build",
|
||||
"prettier-fix": "prettier --write ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^9.0.1",
|
||||
"prettier": "3.3.3"
|
||||
"prettier": "3.3.3",
|
||||
"@types/node": "^22.7.5"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user