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

Function initSession

apps/host-selfhost/src/mcp/mcp.test.ts:48–65  ·  view source on GitHub ↗
(token: string)

Source from the content-addressed store, hash-verified

46 );
47
48const initSession = async (token: string): Promise<string> => {
49 const res = await mcp(token, {
50 jsonrpc: "2.0",
51 id: 1,
52 method: "initialize",
53 params: {
54 protocolVersion: "2025-03-26",
55 capabilities: {},
56 clientInfo: { name: "t", version: "1" },
57 },
58 });
59 expect(res.status).toBe(200);
60 const sessionId = res.headers.get("mcp-session-id") ?? "";
61 expect(sessionId).not.toBe("");
62 await res.text();
63 await mcp(token, { jsonrpc: "2.0", method: "notifications/initialized" }, sessionId);
64 return sessionId;
65};
66
67test("an authenticated MCP client initializes, lists tools, and executes code", async () => {
68 const token = await signUp("alice@mcp.test");

Callers 1

mcp.test.tsFile · 0.85

Calls 3

mcpFunction · 0.70
getMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected