Skip to main content
Glama
21st-dev

Magic Component Platform (MCP)

by 21st-dev
config.ts1.21 kB
export interface Config { apiKey?: string; canvas?: boolean; github?: boolean; } const parseArguments = (): Config => { const config: Config = {}; // Command line arguments override environment variables process.argv.forEach((arg) => { // Check for --canvas flag if (arg === "--canvas") { config.canvas = true; return; } // Check for --github flag if (arg === "--github") { config.github = true; return; } 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();

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

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