MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / handleRequest

Function handleRequest

packages/core/test-servers/src/worker.ts:355–375  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

353};
354
355const handleRequest = async (request: Request): Promise<Response> => {
356 const url = new URL(request.url);
357 if (url.pathname === "/health") return json({ ok: true });
358 if (
359 url.pathname === "/.well-known/oauth-authorization-server" ||
360 url.pathname === "/.well-known/openid-configuration"
361 ) {
362 return oauthMetadata(request);
363 }
364 if (url.pathname.startsWith("/.well-known/oauth-protected-resource")) {
365 return protectedResourceMetadata(request);
366 }
367 if (url.pathname === "/register" && request.method === "POST") return handleRegister(request);
368 if (url.pathname === "/authorize" && request.method === "GET") return handleAuthorize(request);
369 if (url.pathname === "/login") return handleLogin(request);
370 if (url.pathname === "/token" && request.method === "POST") return handleToken(request);
371 if (url.pathname.startsWith("/openapi/")) return handleOpenApi(request);
372 if (url.pathname === "/graphql") return handleGraphql(request);
373 if (url.pathname === "/mcp") return handleMcp(request);
374 return json({ error: "not_found" }, { status: 404 });
375};
376
377export default {
378 fetch: handleRequest,

Callers

nothing calls this directly

Calls 10

oauthMetadataFunction · 0.85
handleRegisterFunction · 0.85
handleAuthorizeFunction · 0.85
handleLoginFunction · 0.85
handleTokenFunction · 0.85
handleOpenApiFunction · 0.85
handleGraphqlFunction · 0.85
handleMcpFunction · 0.85
jsonFunction · 0.70

Tested by

no test coverage detected