How chi-n-nguyen/any-mcp works
Project type and purpose
• Any-MCP is a full-stack, production-ready client framework written in Python.
• It exposes both a rich CLI (under any_mcp/cli) and a Web API (any_mcp/api/web_mcp.py) for orchestrating “Model Context Protocol” (MCP) servers.
• Its goal is to let developers discover, install, manage, and call tools on multiple MCP servers (e.g., Notion, Discord, custom scripts) without building each integration from scratch.
File structure
Top-level directories:
• any_mcp/ – core framework
– cli/ # Command-line interface modules
– api/ # REST Web API modules
– core/ # Client logic, LLM integrations (claude.py, gemini.py), error handling
– managers/ # MCP lifecycle & plugin management (installer.py, manager.py)
– integration/ # Message bridging & protocol adapters
– servers/ # Helpers to connect & talk to MCP servers
• all_mcp_servers/ – Official reference server implementations (Notion, Discord)
• mcps/ – Local example servers (demo_calculator.py, notion-official.py)
• config/ – YAML config for installed MCPs (mcp_config.yaml)
• tools_for_mcp_server/ – Test fixtures & JSON payloads for server tooling
• examples/, llmgine-mcp-integration/, universal_mcp_adapter/ – Extension and packaging modules
• tests/ – Unit and integration tests
Notice:
– CLI and WebAPI are two entry points into the same application layer.
– Managers handle discovery, installation, start/stop, health checks.
– Core contains the MCPClient which orchestrates calls to external LLM-backed servers.
– Integration modules bridge events & protocol mappings.
README for additional insights
User → CLI/WebAPI → MCPManager → MCPClient → LLM Services & MCP Servers
• It also outlines six logical layers: UI, Application, LLM Services, MCP Management, MCP Core, Server Ecosystem.
a. Main components
1. User Interface Layer
– CLI Interface (any_mcp/cli)
– Web API (any_mcp/api)
2. Application Layer
– MCP Manager & Installer (any_mcp/managers)
– Integration & Event Handlers (any_mcp/integration)
– Command orchestration & Core client logic (any_mcp/core)
3. LLM Services
– Cloud LLMs (Claude, Gemini) via core/claude.py & core/gemini.py
4. MCP Core
– MCPClient & ProtocolAdapter abstractions (any_mcp/core/client.py, integration/tool_adapter.py)
5. Server Ecosystem
– Official Servers (all_mcp_servers/notion_mcp_server, discord_mcp_server)
– Local Script Servers (mcps/demo_calculator.py)
– Third-Party or Custom Servers (loaded via config/mcp_config.yaml)
6. Configuration
– YAML store (config/mcp_config.yaml) & .env variables
7. Test & Tooling
– tools_for_mcp_server for load testing & contract validation
b. Relationships & interactions
User → CLI / WebAPI
CLI/WebAPI → MCP Manager → MCPClient
MCPClient → LLM Services (Claude, Gemini)
MCPClient → MCP Servers (Official, Local, Third-Party)
MCPManager → Installer / Lifecycle manager → OS / Docker
MCPClient ↔ Integration / MessageBridge for protocol conversion
MCPClient reads config from config/mcp_config.yaml
• Bidirectional flows where appropriate (e.g., health checks, message replies).
c. Architectural patterns & design principles
• Layered architecture (UI → Application → Core → External)
• Plugin-based extensibility (protocol adapters, custom servers, custom clients)
• Adapter pattern for MCP protocol abstractions
• CLI commands implemented via Click or argparse (any_mcp/cli/main.py)
• Declarative server configuration (YAML + env vars)
d. Technologies & frameworks
• Python 3.x
• Click or built-in CLI library (any_mcp/cli)
• FastAPI or Flask (if used in any_mcp/api/web_mcp.py)
• PyYAML for configuration
• Asyncio / aiohttp for HTTP & WebSocket calls
• Docker integration (manager invokes docker:// sources)