victor's picture
victor HF Staff
mcp: switch HF MCP login to https://hf.co/mcp?login and accept hf.co in strict checks
cb738c8
raw
history blame
498 Bytes
// Client-safe HF utilities used in UI components
export function isStrictHfMcpLogin(urlString: string): boolean {
try {
const u = new URL(urlString);
const host = u.hostname.toLowerCase();
const allowedHosts = new Set(["hf.co", "huggingface.co"]);
return (
u.protocol === "https:" &&
allowedHosts.has(host) &&
u.pathname === "/mcp" &&
u.search === "?login"
);
} catch {
return false;
}
}