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

Function resourceFromRequest

apps/local/src/mcp.ts:110–116  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

108const toolkitPathPattern = /^\/mcp\/toolkits\/([^/?#]+)\/?$/;
109
110const resourceFromRequest = (request: Request): McpResource | null => {
111 const pathname = new URL(request.url).pathname;
112 if (pathname === "/mcp" || pathname === "/mcp/") return defaultMcpResource;
113 const match = toolkitPathPattern.exec(pathname);
114 if (!match) return null;
115 return { kind: "toolkit", slug: decodeURIComponent(match[1]) };
116};
117
118const engineFromConfig = (config: ExecutorMcpServerConfig): AnyExecutionEngine | null =>
119 "engine" in config ? config.engine : null;

Callers 1

createMcpRequestHandlerFunction · 0.85

Calls 1

execMethod · 0.80

Tested by

no test coverage detected