Connect one MCP server, returning null (with a warning) if it's unreachable.
( url: string, prefix: string, )
| 34 | |
| 35 | /** Connect one MCP server, returning null (with a warning) if it's unreachable. */ |
| 36 | async function tryConnect( |
| 37 | url: string, |
| 38 | prefix: string, |
| 39 | ): Promise<MCPClient | null> { |
| 40 | try { |
| 41 | return await createMCPClient({ transport: { type: 'http', url }, prefix }) |
| 42 | } catch (error) { |
| 43 | console.warn( |
| 44 | `[api.mcp-apps-chat] could not connect MCP server "${prefix}" at ${url}:`, |
| 45 | error instanceof Error ? error.message : error, |
| 46 | ) |
| 47 | return null |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | export const Route = createFileRoute('/api/mcp-apps-chat')({ |
| 52 | server: { |
no test coverage detected