MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / loadMcpServers

Method loadMcpServers

packages/agent-core/src/session/index.ts:737–760  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

735 }
736
737 private async loadMcpServers(): Promise<void> {
738 const servers = this.options.mcpConfig?.servers;
739 if (servers === undefined || Object.keys(servers).length === 0) return;
740 await this.mcp.connectAll(servers);
741 const entries = this.mcp.list().filter((entry) => entry.status !== 'disabled');
742 const totalCount = entries.length;
743 if (totalCount === 0) return;
744
745 const connectedCount = entries.filter((entry) => entry.status === 'connected').length;
746 if (connectedCount > 0) {
747 this.telemetry.track('mcp_connected', {
748 server_count: connectedCount,
749 total_count: totalCount,
750 });
751 }
752
753 const failedCount = entries.filter((entry) => entry.status === 'failed').length;
754 if (failedCount > 0) {
755 this.telemetry.track('mcp_failed', {
756 failed_count: failedCount,
757 total_count: totalCount,
758 });
759 }
760 }
761
762 private emitInitialMcpLoadError(error: unknown): void {
763 const message = error instanceof Error ? error.message : String(error);

Callers 1

constructorMethod · 0.95

Calls 4

keysMethod · 0.80
connectAllMethod · 0.80
listMethod · 0.65
trackMethod · 0.65

Tested by

no test coverage detected