MCPcopy
hub / github.com/codeaashu/claude-code / ensureConnectedClient

Function ensureConnectedClient

src/services/mcp/client.ts:1688–1704  ·  view source on GitHub ↗
(
  client: ConnectedMCPServer,
)

Source from the content-addressed store, hash-verified

1686 * @throws Error if server cannot be connected
1687 */
1688export 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.

Callers 4

callFunction · 0.85
callFunction · 0.85
callFunction · 0.85
getPromptForCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected