style: fix formatting in MCP server
This commit is contained in:
@@ -4,30 +4,33 @@ 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" },
|
||||
}),
|
||||
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 }
|
||||
);
|
||||
},
|
||||
},
|
||||
// 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 });
|
||||
},
|
||||
// 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}`);
|
||||
|
||||
Reference in New Issue
Block a user