Use serve to create npm package for the client

This commit is contained in:
Justin Spahr-Summers
2024-11-11 11:04:42 +00:00
parent a0d8ec1e7e
commit 196f2f801d
3 changed files with 130 additions and 15 deletions

18
client/bin/cli.js Executable file
View File

@@ -0,0 +1,18 @@
#!/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 });
});
const port = process.env.PORT || 3000;
server.listen(port, () => {
console.log(`MCP inspector client running at http://localhost:${port}`);
});