How mozilla-ai/mcpd works
Project type and purpose
• This is a Go-based CLI tool with a long-running “daemon” component that manages Model Context Protocol (MCP) servers as subprocesses and exposes them over HTTP.
• Purpose: provide a unified, declarative way (.mcpd.toml) to configure, launch, and proxy MCP servers locally or in containers, with built-in secrets management, runtime arguments, and plugin support.
File structure
• Top-level directories:
• cmd/ → CLI commands (add, config, daemon, init, etc.)
• internal/ → Core application logic organized by concern (api, cmd, config, context, daemon, domain, plugin, provider, registry, runtime, etc.)
• tools/ → Utility programs (docs generator, registry validator)
• docs/ → MkDocs-powered documentation
• Configuration & build: Dockerfile, Makefile, mkdocs.yaml, GitHub workflows
• Patterns:
• Hexagonal (Ports & Adapters): internal/domain services, external adapters for CLI, HTTP API, file I/O, subprocess orchestration
• Subsystems for plugin management, providers (e.g., mcpm, mozilla_ai), registries, runtime loaders
README for additional insights
• Core components: CLI front-end, “mcpd daemon” HTTP proxy, subprocess-based MCP servers over STDIO
• Key features: declarative .mcpd.toml, plugin protocol buffers, secrets isolation, local→prod parity
Additional notes
• Plugin subsystem prominently (internal/plugin), as the latest main branch enhances plugin capabilities.
• STDIO-based communication channel between the daemon and MCP servers as a separate interface.
• Critical paths (e.g., config export, health tracking, runtime argument injection).
• Reflects the hexagonal layering
• Highlights the CLI vs. daemon boundary
• Shows plugin and provider integrations
• Illustrates subprocess orchestration and HTTP proxying
• Captures configuration and secrets management flows