MCPcopy Index your code
hub / github.com/modelcontextprotocol/inspector / validateRedirectUrl

Function validateRedirectUrl

client/src/utils/urlValidation.ts:8–24  ·  view source on GitHub ↗
(url: string | URL)

Source from the content-addressed store, hash-verified

6 * @throws Error if the URL has an unsafe protocol
7 */
8export function validateRedirectUrl(url: string | URL): void {
9 try {
10 const parsedUrl = new URL(url);
11 if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") {
12 throw new Error("Authorization URL must be HTTP or HTTPS");
13 }
14 } catch (error) {
15 if (
16 error instanceof Error &&
17 error.message === "Authorization URL must be HTTP or HTTPS"
18 ) {
19 throw error;
20 }
21 // If URL parsing fails, it's also invalid
22 throw new Error(`Invalid URL: ${url}`);
23 }
24}

Callers 5

AuthDebuggerFunction · 0.90
OAuthFlowProgressFunction · 0.90
SidebarFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…