MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / ensureConnected

Method ensureConnected

deepwiki/deepwiki.ts:404–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402 }
403
404 private async ensureConnected(): Promise<void> {
405 if (this.closed) throw new Error("DeepWiki MCP client is closed");
406 if (this.client) return;
407 if (this.connecting) return await this.connecting;
408
409 this.connecting = (async () => {
410 const transport = new StreamableHTTPClientTransport(new URL("https://mcp.deepwiki.com/mcp"));
411 const client = new Client({ name: "telebox-deepwiki", version: "1.0.0" });
412 try {
413 await client.connect(transport as any);
414 } catch (error) {
415 await client.close().catch(() => undefined);
416 throw error;
417 }
418 if (this.closed) {
419 await client.close();
420 return;
421 }
422 this.client = client;
423 })();
424
425 try {
426 await this.connecting;
427 } finally {
428 this.connecting = null;
429 }
430 }
431
432 async ask(repo: string, question: string): Promise<string> {
433 if (this.closed) throw new Error("DeepWiki MCP client is closed");

Callers 1

askMethod · 0.95

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected