( client: ConnectedMCPServer, )
| 1686 | * @throws Error if server cannot be connected |
| 1687 | */ |
| 1688 | export async function ensureConnectedClient( |
| 1689 | client: ConnectedMCPServer, |
| 1690 | ): Promise<ConnectedMCPServer> { |
| 1691 | // SDK MCP servers run in-process and are handled separately via setupSdkMcpClients |
| 1692 | if (client.config.type === 'sdk') { |
| 1693 | return client |
| 1694 | } |
| 1695 | |
| 1696 | const connectedClient = await connectToServer(client.name, client.config) |
| 1697 | if (connectedClient.type !== 'connected') { |
| 1698 | throw new TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS( |
| 1699 | `MCP server "${client.name}" is not connected`, |
| 1700 | 'MCP server not connected', |
| 1701 | ) |
| 1702 | } |
| 1703 | return connectedClient |
| 1704 | } |
| 1705 | |
| 1706 | /** |
| 1707 | * Compares two MCP server configurations to determine if they are equivalent. |
no outgoing calls
no test coverage detected