* Remove bin folder, leaving cli, server, and client * This fixes #315 * In .gitignore, - add .idea - remove bin/build * Remove bin and bin/cli.js * Remove bin/scripts/copy-cli.js * Refactor/move bin/scripts to cli/scripts * Refactor/move bin/src/index.ts to cli/src/cli.ts * Refactor/renamed client/bin/cli.js to client/bin/client.js * In .github/workflows/main.yml, - add run of cli tests * In cli/pacakge.json - change main and bin/mcp-inspector-cli properties to build/cli.js * In client/package.json, - change bin/mcp-inspector-client properties to build/start.js * In pacakge.json - change bin/mcp-inspector property to ./cli/build/cli.js - removed bin and cli/bin from files list - removed @modelcontextprotocol/inspector-bin dependency - rearranged and corrected scripts
34 lines
858 B
JavaScript
Executable File
34 lines
858 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { join, dirname } from "path";
|
|
import { fileURLToPath } from "url";
|
|
import handler from "serve-handler";
|
|
import http from "http";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const distPath = join(__dirname, "../dist");
|
|
|
|
const server = http.createServer((request, response) => {
|
|
return handler(request, response, {
|
|
public: distPath,
|
|
rewrites: [{ source: "/**", destination: "/index.html" }],
|
|
});
|
|
});
|
|
|
|
const port = process.env.PORT || 6274;
|
|
server.on("listening", () => {
|
|
console.log(
|
|
`🔍 MCP Inspector is up and running at http://127.0.0.1:${port} 🚀`,
|
|
);
|
|
});
|
|
server.on("error", (err) => {
|
|
if (err.message.includes(`EADDRINUSE`)) {
|
|
console.error(
|
|
`❌ MCP Inspector PORT IS IN USE at http://127.0.0.1:${port} ❌ `,
|
|
);
|
|
} else {
|
|
throw err;
|
|
}
|
|
});
|
|
server.listen(port);
|