migrate to monorepo?

This commit is contained in:
2025-12-13 20:20:48 -05:00
parent 7da6408d7a
commit a66b5b2362
29 changed files with 849 additions and 817 deletions

View File

@@ -0,0 +1,33 @@
import { handleMcpRequest } from "./protocol/handler";
import { serverCard } from "./protocol/metadata";
const PORT = process.env.MCP_PORT || 4006;
const server = Bun.serve({
port: PORT as number | string,
idleTimeout: 0,
routes: {
// MCP metadata discovery endpoint
"/.well-known/mcp/server-card.json": new Response(JSON.stringify(serverCard), {
headers: { "Content-Type": "application/json" },
}),
// MCP JSON-RPC 2.0 protocol endpoint
"/mcp": async (req: Request) => {
if (req.method === "POST") {
return await handleMcpRequest(req);
}
return Response.json(
{ message: "MCP endpoint requires POST request" },
{ status: 405 }
);
},
},
// Fallback for all other routes
fetch(req: Request) {
return new Response("Not Found", { status: 404 });
},
});
console.log(`MCP Server running on ${server.hostname}:${server.port}`);