Skip to main content
Glama

Magic Component Platform (MCP)

by 21st-dev
config.ts947 B
export interface Config { apiKey?: string; } const parseArguments = (): Config => { const config: Config = {}; // Command line arguments override environment variables process.argv.forEach((arg) => { const keyValuePatterns = [ /^([A-Z_]+)=(.+)$/, // API_KEY=value format /^--([A-Z_]+)=(.+)$/, // --API_KEY=value format /^\/([A-Z_]+):(.+)$/, // /API_KEY:value format (Windows style) /^-([A-Z_]+)[ =](.+)$/, // -API_KEY value or -API_KEY=value format ]; for (const pattern of keyValuePatterns) { const match = arg.match(pattern); if (match) { const [, key, value] = match; if (key === "API_KEY") { // Strip surrounding quotes from the value const cleanValue = value.replaceAll('"', "").replaceAll("'", ""); config.apiKey = cleanValue; break; } } } }); return config; }; export const config = parseArguments();

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/21st-dev/magic-mcp'

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