()
| 47 | * actually set BASE_URL to something valid is still authoritative. |
| 48 | */ |
| 49 | export function resolveMCPServerURL(): string { |
| 50 | const raw = process.env.BASE_URL; |
| 51 | if (typeof raw === 'string') { |
| 52 | const trimmed = raw.replace(/\/$/, '').trim(); |
| 53 | if (trimmed) { |
| 54 | try { |
| 55 | new URL(trimmed); |
| 56 | return trimmed; |
| 57 | } catch { |
| 58 | logger.warn( |
| 59 | { baseUrl: raw }, |
| 60 | 'BASE_URL is set but does not parse as a URL — falling back to the development default', |
| 61 | ); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | const port = process.env.PORT || process.env.CONDUCTOR_PORT || '3000'; |
| 66 | return `http://localhost:${port}`; |
| 67 | } |
| 68 | |
| 69 | const MCP_SERVER_URL = resolveMCPServerURL(); |
| 70 |
no test coverage detected