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

Function findMcpServerConnection

src/services/tools/toolExecution.ts:283–301  ·  view source on GitHub ↗
(
  toolName: string,
  mcpClients: MCPServerConnection[],
)

Source from the content-addressed store, hash-verified

281 | undefined
282
283function findMcpServerConnection(
284 toolName: string,
285 mcpClients: MCPServerConnection[],
286): MCPServerConnection | undefined {
287 if (!toolName.startsWith('mcp__')) {
288 return undefined
289 }
290
291 const mcpInfo = mcpInfoFromString(toolName)
292 if (!mcpInfo) {
293 return undefined
294 }
295
296 // mcpInfo.serverName is normalized (e.g., "claude_ai_Slack"), but client.name
297 // is the original name (e.g., "claude.ai Slack"). Normalize both for comparison.
298 return mcpClients.find(
299 client => normalizeNameForMCP(client.name) === mcpInfo.serverName,
300 )
301}
302
303/**
304 * Extracts the MCP server transport type from a tool name.

Callers 2

getMcpServerTypeFunction · 0.85

Calls 2

mcpInfoFromStringFunction · 0.85
normalizeNameForMCPFunction · 0.85

Tested by

no test coverage detected