Skip to main content
Glama
createConfigValueProvider.jsโ€ข1.84 kB
export const createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => { const configProvider = async () => { const configValue = config[configKey] ?? config[canonicalEndpointParamKey]; if (typeof configValue === "function") { return configValue(); } return configValue; }; if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { return async () => { const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; const configValue = credentials?.credentialScope ?? credentials?.CredentialScope; return configValue; }; } if (configKey === "accountId" || canonicalEndpointParamKey === "AccountId") { return async () => { const credentials = typeof config.credentials === "function" ? await config.credentials() : config.credentials; const configValue = credentials?.accountId ?? credentials?.AccountId; return configValue; }; } if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { return async () => { if (config.isCustomEndpoint === false) { return undefined; } const endpoint = await configProvider(); if (endpoint && typeof endpoint === "object") { if ("url" in endpoint) { return endpoint.url.href; } if ("hostname" in endpoint) { const { protocol, hostname, port, path } = endpoint; return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; } } return endpoint; }; } return configProvider; };

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/consigcody94/office-whisperer'

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