Skip to main content
Glama
MIT License
27,120
19,746
  • Linux
  • Apple
patternUtils.ts•1.05 kB
/** * Splits comma-separated glob patterns while preserving brace expansion patterns. * This ensures patterns with braces are treated as a single pattern, * rather than being split at commas inside the braces. * Whitespace around patterns is also trimmed. */ export const splitPatterns = (patterns?: string): string[] => { if (!patterns) return []; const result: string[] = []; let currentPattern = ''; let braceLevel = 0; for (let i = 0; i < patterns.length; i++) { const char = patterns[i]; if (char === '{') { braceLevel++; currentPattern += char; } else if (char === '}') { braceLevel--; currentPattern += char; } else if (char === ',' && braceLevel === 0) { // Only split on commas when not inside braces if (currentPattern) { result.push(currentPattern.trim()); currentPattern = ''; } } else { currentPattern += char; } } // Add the last pattern if (currentPattern) { result.push(currentPattern.trim()); } return result; };

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/yamadashy/repomix'

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