UNPKG

mcp-orchestrator

Version:

MCP Orchestrator - Discover and install MCPs with automatic OAuth support. Uses Claude CLI for OAuth MCPs (Canva, Asana, etc). 34 trusted MCPs from Claude Partners.

78 lines (77 loc) 2.4 kB
/** * MCP Registry * Loads MCP servers from the semantic search index */ import * as fs from 'fs'; import * as path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); /** * Load MCP index from file */ function loadMCPIndex() { const indexPath = path.join(__dirname, '../data/mcp-index.json'); try { const data = fs.readFileSync(indexPath, 'utf-8'); return JSON.parse(data); } catch (error) { console.error('❌ Failed to load MCP index:', error); return { version: '1.0.0', created: new Date().toISOString(), totalMCPs: 0, embeddingModel: 'none', embeddingDimensions: 0, mcps: [] }; } } /** * Convert indexed MCP to MCPServerConfig format */ function convertToConfig(indexed) { const isRemote = indexed.command?.startsWith('remote:'); const runtime = indexed.metadata?.runtime === 'node' || indexed.metadata?.runtime === 'python' ? indexed.metadata.runtime : undefined; return { id: indexed.id, name: indexed.name, description: indexed.description, command: indexed.command || indexed.packageName, packageName: indexed.packageName, runtime, installTime: indexed.metadata?.installTime, args: [], useCases: indexed.useCases || [], // Note: pros/cons are not in the index, could be added later pros: [], cons: [], // Include auth information env: indexed.authType ? { authType: indexed.authType, authProvider: indexed.authProvider } : undefined }; } // Load registry on startup const index = loadMCPIndex(); export const MCP_REGISTRY = index.mcps.map(convertToConfig); console.error(`📚 Loaded ${MCP_REGISTRY.length} MCPs from index`); /** * Find an MCP server config by ID */ export function findMCPById(id) { return MCP_REGISTRY.find(mcp => mcp.id === id); } /** * Search MCP servers by keyword */ export function searchMCPs(query) { const lowerQuery = query.toLowerCase(); return MCP_REGISTRY.filter(mcp => mcp.name.toLowerCase().includes(lowerQuery) || mcp.description.toLowerCase().includes(lowerQuery) || mcp.id.toLowerCase().includes(lowerQuery)); }