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

Function mcpPost

e2e/cloud/mcp-protocol.test.ts:63–76  ·  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

61};
62
63const mcpPost = (
64 url: string | URL,
65 init: { readonly bearer?: string; readonly sessionId?: string; readonly body: unknown },
66): Promise<Response> =>
67 fetch(url, {
68 method: "POST",
69 headers: {
70 accept: JSON_AND_SSE,
71 "content-type": "application/json",
72 ...(init.bearer ? { authorization: `Bearer ${init.bearer}` } : {}),
73 ...(init.sessionId ? { "mcp-session-id": init.sessionId } : {}),
74 },
75 body: JSON.stringify(init.body),
76 });
77
78/** initialize → session id (asserted present) → notifications/initialized. */
79const openSession = async (mcpUrl: string, bearer: string): Promise<string> => {

Callers 3

openSessionFunction · 0.70
callExecuteFunction · 0.70

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected