MCPcopy Create free account
hub / github.com/TanStack/ai / add

Function add

packages/ai-mcp/src/apps/call-handler.ts:127–150  ·  view source on GitHub ↗
(info: {
    transport: McpServerDescriptor['transport']
    prefix: string | undefined
  })

Source from the content-addressed store, hash-verified

125 let total = 0
126
127 const add = (info: {
128 transport: McpServerDescriptor['transport']
129 prefix: string | undefined
130 }) => {
131 const descriptor: McpServerDescriptor = {
132 transport: info.transport,
133 prefix: info.prefix,
134 }
135 total += 1
136 const key = info.prefix
137 if (key === undefined || key === '') {
138 if (fallback !== null) {
139 throw new Error(
140 'createMcpAppCallHandler: multiple clients without a prefix; serverId routing is ambiguous',
141 )
142 }
143 fallback = descriptor
144 return
145 }
146 if (key in byServerId) {
147 throw new Error(`createMcpAppCallHandler: duplicate serverId "${key}"`)
148 }
149 byServerId[key] = descriptor
150 }
151
152 for (const entry of entries) {
153 if (isPool(entry)) {

Callers 1

buildRegistryFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected