MCPcopy
hub / github.com/21st-dev/1code / fetchOAuthMetadata

Function fetchOAuthMetadata

src/main/lib/oauth.ts:16–28  ·  view source on GitHub ↗
(mcpBaseUrl: string)

Source from the content-addressed store, hash-verified

14 * Returns null if server doesn't support OAuth
15 */
16export 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
30export interface OAuthConfig {
31 mcpBaseUrl: string; // e.g., http://localhost:3000/v1/links/abc123

Callers 3

fetchMcpOAuthMetadataFunction · 0.90
convertServersFunction · 0.90
getAllMcpConfigHandlerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected