File size: 417 Bytes
e67ab0e
 
 
d70276d
 
 
 
 
 
 
 
 
 
 
 
 
e67ab0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 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;
	}
}