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

Function mcpPost

e2e/cloud/mcp-destroyed-session-envelope.test.ts:52–65  ·  view source on GitHub ↗
(
  url: string | URL,
  init: { readonly bearer: string; readonly sessionId?: string; readonly body: unknown },
)

Source from the content-addressed store, hash-verified

50const emailOf = (identity: Identity): string => identity.credentials?.email ?? identity.label;
51
52const mcpPost = (
53 url: string | URL,
54 init: { readonly bearer: string; readonly sessionId?: string; readonly body: unknown },
55): Promise<Response> =>
56 fetch(url, {
57 method: "POST",
58 headers: {
59 accept: JSON_AND_SSE,
60 "content-type": "application/json",
61 authorization: `Bearer ${init.bearer}`,
62 ...(init.sessionId ? { "mcp-session-id": init.sessionId } : {}),
63 },
64 body: JSON.stringify(init.body),
65 });
66
67const openSession = async (mcpUrl: string, bearer: string): Promise<string> => {
68 const initialize = await mcpPost(mcpUrl, { bearer, body: INITIALIZE_REQUEST });

Callers 3

openSessionFunction · 0.70
probeOnceFunction · 0.70

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected