()
| 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); |
no test coverage detected