import type { FastifyInstance } from "fastify";
import {
  enabledMcpTools,
  loadMcpServers,
  toPublicMcpServer,
  toPublicMcpTool,
} from "./config.js";

export const registerMcpRoutes = async (app: FastifyInstance) => {
  app.get("/api/mcp/tools", async () => {
    const items = enabledMcpTools().map(toPublicMcpTool);
    return { items };
  });

  app.get("/api/mcp/servers", async () => {
    const items = loadMcpServers().map(toPublicMcpServer);
    return { items };
  });
};
