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

Function openSession

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

Source from the content-addressed store, hash-verified

54 });
55
56const openSession = async (mcpUrl: string, bearer: string): Promise<string> => {
57 const initialized = await postJson(mcpUrl, bearer, initializeBody);
58 const sessionId = initialized.headers.get("mcp-session-id");
59 await initialized.text();
60 if (initialized.status !== 200 || !sessionId) {
61 throw new Error(`openSession: initialize failed (${initialized.status})`);
62 }
63
64 const notification = await postJson(mcpUrl, bearer, initializedNotification, sessionId);
65 await notification.text();
66 expect(notification.status, "notifications/initialized is accepted").toBe(202);
67 return sessionId;
68};
69
70type JsonRpcMessage = {
71 readonly id?: unknown;

Callers 1

Calls 3

postJsonFunction · 0.70
getMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected