Skip to main content
Glama
useDomainIcon.ts2.03 kB
import { useMemo } from "react"; const serverNameIcons = new Set([ "airtable", "appDynamics", "asana", "atlassian", "aws", "azureDevOps", "basecamp", "bitbucket", "blueJeans", "brave", "circleCI", "clickUp", "context7", "copper", "datadog", "discord", "docker", "elastic", "freshsales", "gitHub", "gitLab", "goToMeeting", "googleMeet", "grafana", "hashicorpVault", "honeycomb", "hubspot", "insightly", "jenkins", "jira", "kubernetes", "launchdarkly", "linear", "loadmill", "microsoftDynamics", "microsoftTeams", "monday", "newRelic", "notion", "pipedrive", "playwright", "postgres", "prometheus", "redis", "ringCentral", "rollbar", "salesforce", "sentry", "slack", "smartsheet", "snowflake", "sourceForge", "splunk", "sugarCRM", "terraform", "travisCI", "trello", "webex", "wrike", "zoho", "zoom", ]); export function getIconKey(name: string): string | null { // search for exact match O(1) if (serverNameIcons.has(name)) return name; // search for the lower version of the name in O(1) const lowerName = name.toLowerCase(); if (serverNameIcons.has(lowerName)) return lowerName; // didn't found the original or lower version - lower also the keys and search the set for (const key of serverNameIcons) { if (key.toLowerCase() === lowerName) return key; } // handle partial matches (e.g., "brave-search" -> "brave", "aws-docs" -> "aws") for (const key of serverNameIcons) { const lowerKey = key.toLowerCase(); if ( lowerName.startsWith(lowerKey + "-") || lowerName.startsWith(lowerKey + "_") ) { return key; } } // no match at all - return null return null; } export const useDomainIcon = (name: string | null) => { const iconUrl = useMemo(() => { if (!name) return ""; const domainKey = getIconKey(name); if (!domainKey) { return ""; } return `/icons/${domainKey}.png`; }, [name]); return iconUrl; };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheLunarCompany/lunar'

If you have feedback or need assistance with the MCP directory API, please join our Discord server