|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function getMcpServerFaviconUrl(serverUrl: string, size: number = 64): string { |
|
|
try { |
|
|
const parsed = new URL(serverUrl); |
|
|
|
|
|
|
|
|
const hostnameParts = parsed.hostname.split("."); |
|
|
const rootDomain = |
|
|
hostnameParts.length >= 2 ? hostnameParts.slice(-2).join(".") : parsed.hostname; |
|
|
const domain = `${parsed.protocol}//${rootDomain}`; |
|
|
return `https://www.google.com/s2/favicons?sz=${size}&domain_url=${encodeURIComponent(domain)}`; |
|
|
} catch { |
|
|
|
|
|
return `https://www.google.com/s2/favicons?sz=${size}&domain_url=${encodeURIComponent(serverUrl)}`; |
|
|
} |
|
|
} |
|
|
|