MCPcopy Index your code
hub / github.com/codeaashu/claude-code / doInitialize

Method doInitialize

web/lib/api/files.ts:47–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 }
46
47 private async doInitialize(): Promise<void> {
48 const res = await fetch(`${getBaseUrl()}/mcp`, {
49 method: "POST",
50 headers: this.buildHeaders(),
51 body: JSON.stringify({
52 jsonrpc: "2.0",
53 id: "init",
54 method: "initialize",
55 params: {
56 protocolVersion: "2024-11-05",
57 capabilities: {},
58 clientInfo: { name: "claude-code-web", version: "1.0.0" },
59 },
60 } satisfies McpRequest),
61 });
62
63 if (!res.ok) {
64 this.initPromise = null;
65 throw new ApiError(res.status, "MCP session initialization failed");
66 }
67
68 this.sessionId = res.headers.get("mcp-session-id");
69
70 // Send "initialized" notification (fire-and-forget)
71 if (this.sessionId) {
72 fetch(`${getBaseUrl()}/mcp`, {
73 method: "POST",
74 headers: this.buildHeaders(),
75 body: JSON.stringify({
76 jsonrpc: "2.0",
77 method: "notifications/initialized",
78 }),
79 }).catch(() => {
80 // non-critical
81 });
82 }
83 }
84
85 private initialize(): Promise<void> {
86 if (!this.initPromise) {

Callers 1

initializeMethod · 0.95

Calls 3

buildHeadersMethod · 0.95
getBaseUrlFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected