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

Function rawPost

e2e/cloud/repro-transport-brick.test.ts:62–82  ·  view source on GitHub ↗
(
  mcpUrl: string,
  bearer: string,
  sessionId: string,
  message: unknown,
)

Source from the content-addressed store, hash-verified

60
61/** A raw POST of a JSON-RPC request onto an existing session id. */
62const rawPost = async (
63 mcpUrl: string,
64 bearer: string,
65 sessionId: string,
66 message: unknown,
67): Promise<RawResult> => {
68 const res = await fetch(mcpUrl, {
69 method: "POST",
70 headers: {
71 authorization: `Bearer ${bearer}`,
72 "content-type": "application/json",
73 // The streamable-http transport requires the client accept both.
74 accept: "application/json, text/event-stream",
75 "mcp-session-id": sessionId,
76 "mcp-protocol-version": "2025-06-18",
77 },
78 body: JSON.stringify(message),
79 });
80 const body = await res.text().catch(() => "");
81 return { status: res.status, body };
82};
83
84/** A raw SSE GET (the "listen" stream) on an existing session id. We only need
85 * the response head — status + start of body — to see whether it 500s. */

Callers 1

Calls 2

textMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected