(mcpBaseUrl: string)
| 14 | * Returns null if server doesn't support OAuth |
| 15 | */ |
| 16 | export async function fetchOAuthMetadata(mcpBaseUrl: string): Promise<OAuthMetadata | null> { |
| 17 | try { |
| 18 | const origin = new URL(mcpBaseUrl).origin; |
| 19 | const metadataUrl = `${origin}/.well-known/oauth-authorization-server`; |
| 20 | const response = await fetch(metadataUrl); |
| 21 | if (response.ok) { |
| 22 | return await response.json() as OAuthMetadata; |
| 23 | } |
| 24 | return null; |
| 25 | } catch { |
| 26 | return null; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | export interface OAuthConfig { |
| 31 | mcpBaseUrl: string; // e.g., http://localhost:3000/v1/links/abc123 |
no outgoing calls
no test coverage detected