diff --git a/bin/cli.js b/bin/cli.js new file mode 100755 index 0000000..0de8616 --- /dev/null +++ b/bin/cli.js @@ -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); +}); diff --git a/package.json b/package.json index dbdb611..d7dfb4d 100644 --- a/package.json +++ b/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" } }