Architecture

System Design

Loading diagram...

Component Breakdown

ComponentFileResponsibility
Serversrc/server.tsMCP server exposing 4 tools to the AI client
Registrysrc/registry.tsLoads servers.json, interpolates env vars, watches for changes, scored keyword matching
Poolsrc/pool.tsConnection lifecycle — lazy connect, reuse, disconnect, auto-retry on failure
Keyword Extractorsrc/keyword-extractor.tsExtracts keywords from tool names/descriptions for auto-tagging servers
Reaper(inside pool)Per-connection idle timer — kills unused connections
Tool Catalogsrc/tool-catalog.tsPersists discovered tool schemas in ~/.mux/tool-catalog.json (1h TTL)
Tool Discoverysrc/tool-discovery.tsSearches tool catalog across servers, resolves server by tool name
Env Loadersrc/env.tsExtracts env vars from shell profiles (.zshrc/.bashrc) on startup
Stdio Transportsrc/transport/stdio.tsSpawns downstream processes, communicates via stdin/stdout
HTTP Transportsrc/transport/http.tsConnects to HTTP/SSE endpoints with MCP OAuth provider
OAuth Providersrc/auth/mcp-oauth-provider.tsBrowser-based OAuth (same flow as Kiro IDE/CLI)
Token Storesrc/auth/token-store.tsReads/writes encrypted ~/.mux/tokens.json, checks expiry
Loggersrc/logger.tsStructured stderr logging with levels

Data Flow

Loading diagram...

Lifecycle States

Loading diagram...