MCPcopy Create free account
hub / github.com/Noumena-Network/code / findMcpServerConnection

Function findMcpServerConnection

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

Source from the content-addressed store, hash-verified

282 | undefined
283
284function findMcpServerConnection(
285 toolName: string,
286 mcpClients: MCPServerConnection[],
287): MCPServerConnection | undefined {
288 if (!toolName.startsWith('mcp__')) {
289 return undefined
290 }
291
292 const mcpInfo = mcpInfoFromString(toolName)
293 if (!mcpInfo) {
294 return undefined
295 }
296
297 // mcpInfo.serverName is normalized (e.g., "claude_ai_Slack"), but client.name
298 // is the original name (e.g., "managed Slack"). Normalize both for comparison.
299 return mcpClients.find(
300 client => normalizeNameForMCP(client.name) === mcpInfo.serverName,
301 )
302}
303
304/**
305 * 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