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

Function openSession

e2e/cloud/mcp-sse-replay.test.ts:63–75  ·  view source on GitHub ↗
(mcpUrl: string, bearer: string)

Source from the content-addressed store, hash-verified

61 });
62
63const openSession = async (mcpUrl: string, bearer: string): Promise<string> => {
64 const initialized = await postJson(mcpUrl, bearer, initializeBody);
65 const sessionId = initialized.headers.get("mcp-session-id");
66 await initialized.text();
67 if (initialized.status !== 200 || !sessionId) {
68 throw new Error(`openSession: initialize failed (${initialized.status})`);
69 }
70
71 const notification = await postJson(mcpUrl, bearer, initializedNotification, sessionId);
72 await notification.text();
73 expect(notification.status, "notifications/initialized is accepted").toBe(202);
74 return sessionId;
75};
76
77type JsonRpcId = string | number;
78

Callers 1

Calls 3

postJsonFunction · 0.70
getMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected