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