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

Function openSession

e2e/cloud/mcp-destroyed-session-envelope.test.ts:67–80  ·  view source on GitHub ↗
(mcpUrl: string, bearer: string)

Source from the content-addressed store, hash-verified

65 });
66
67const openSession = async (mcpUrl: string, bearer: string): Promise<string> => {
68 const initialize = await mcpPost(mcpUrl, { bearer, body: INITIALIZE_REQUEST });
69 const sessionId = initialize.headers.get("mcp-session-id");
70 await initialize.text();
71 if (initialize.status !== 200 || !sessionId) {
72 throw new Error(`openSession: initialize failed (${initialize.status})`);
73 }
74 const initialized = await mcpPost(mcpUrl, { bearer, sessionId, body: INITIALIZED_NOTIFICATION });
75 await initialized.text();
76 if (initialized.status !== 202) {
77 throw new Error(`openSession: notifications/initialized failed (${initialized.status})`);
78 }
79 return sessionId;
80};
81
82type Probe = {
83 readonly atMs: number;

Calls 3

mcpPostFunction · 0.70
getMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected