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

Function fetch

packages/hosts/mcp/src/in-memory-session-store.test.ts:124–141  ·  view source on GitHub ↗
(input: string | URL | Request, init?: RequestInit)

Source from the content-addressed store, hash-verified

122 }).pipe(Effect.map((mcpServer) => ({ mcpServer, engine }))),
123 );
124 const fetch = async (input: string | URL | Request, init?: RequestInit): Promise<Response> => {
125 const request =
126 input instanceof Request ? new Request(input, init) : new Request(input.toString(), init);
127 const result = await Effect.runPromise(
128 sessions.store.dispatch({
129 request,
130 principal: TEST_PRINCIPAL,
131 resource: defaultMcpResource,
132 sessionId: request.headers.get("mcp-session-id"),
133 method: request.method,
134 }),
135 );
136 return result instanceof Response
137 ? result
138 : new Response(result === "forbidden" ? "Forbidden" : "Not found", {
139 status: result === "forbidden" ? 403 : 404,
140 });
141 };
142 const transport = new StreamableHTTPClientTransport(
143 new URL("https://executor.test/mcp?elicitation_mode=native"),
144 { fetch },

Callers 1

Calls 2

toStringMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected