public
anord
read
Ledger
Why work hard when you can work easier?
Languages
Repository composition by tracked source files.
TypeScript
86%
CSS
10%
SQL
3%
Shell
1%
HTML
0%
Trace
apps/web/src/lib/mcp.ts
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
function getOrigin(value: string | undefined | null) {
2
if (!value) return null;
4
try {
5
return new URL(value, typeof window !== "undefined" ? window.location.origin : "http://localhost").origin;
6
} catch {
7
return null;
8
}
9
}
11
export function resolveDisplayedMcpEndpoint(fallbackEndpoint?: string) {
12
const browserOrigin = typeof window !== "undefined" ? window.location.origin : null;
13
const fallbackOrigin = getOrigin(fallbackEndpoint);
14
const origin = browserOrigin ?? fallbackOrigin;
15
return origin ? `${origin}/mcp` : "/mcp";
16
}