import { handleOAuthRoutes, MCP_PATH } from "./oauth"; import { handleMcpEndpoint, handleTestEviction } from "./transport"; /** MCP endpoint and its OAuth 2.1 authorization server; runs before the cross-origin guard (token-only). */ export async function handleMcpRoutes(request: Request, url: URL): Promise { if (url.pathname === MCP_PATH || url.pathname === `${MCP_PATH}/`) return handleMcpEndpoint(request, url); if (url.pathname === `${MCP_PATH}/__test/evict`) return handleTestEviction(request, url); return handleOAuthRoutes(request, url); }