Skip to main content
Glama
helpers.ts758 B
/** * Resource helper functions */ import { getPluggedinMCPApiKey, getPluggedinMCPApiBaseUrl } from '../utils.js'; export interface AuthResult { key: string | undefined; base: string | undefined; } /** * Ensures authentication for resources that require it * @param uri - Resource URI * @param requiresAuth - Whether the resource requires authentication * @returns API key and base URL * @throws Error if authentication is required but not provided */ export function ensureAuth(uri: string, requiresAuth: boolean): AuthResult { const key = getPluggedinMCPApiKey(); const base = getPluggedinMCPApiBaseUrl(); if (requiresAuth && (!key || !base)) { throw new Error(`API key required to access ${uri}`); } return { key, base }; }

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/VeriTeknik/pluggedin-mcp'

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