How adhikasp/mcp-client-cli works
Main components of the system and include the relevant filenames
a. CLI “Entry Point” Layer:
• Component: Command Line Interface
• Key File: src/mcp_client_cli/cli.py
• Description: Acts as the user-facing entry point where commands are received, and it passes them on for processing.
b. Configuration Management:
• Component: Config Manager / Settings Loader
• Key File: src/mcp_client_cli/config.py
• Description: Loads and parses the MCP and LLM configuration details (as shown in the README and mcp-server-config-example.json).
c. Prompt Handling and Interpretation:
• Components: Prompt Builder and Input Parser
• Key Files: src/mcp_client_cli/prompt.py and src/mcp_client_cli/input.py
• Description: These modules handle user input, parse commands (including CLI flags like --list-prompts or tool calls), and map them into equivalent prompt actions.
d. I/O Processing:
• Components: Output Engine and Clipboard / Image Support
• Key Files: src/mcp_client_cli/output.py
• Description: Manages the response output (text/image), interfacing with the terminal, and formatting results.
e. Memory and Context Management:
• Component: Memory Manager
• Key File: src/mcp_client_cli/memory.py
• Description: Maintains and retrieves context continuity (e.g., when using continuation “c ” commands).
f. Tool/Command Invocation:
• Components: Tool Invoker and Storage
• Key Files: src/mcp_client_cli/tool.py and src/mcp_client_cli/storage.py
• Description: Coordinates triggering of external MCP tools (e.g., fetching from Brave Search, YouTube), managing parameters (like confirmation flags) and handling tool-specific protocols.
g. Constant Definitions:
• Component: Type & Command Constants
• Key File: src/mcp_client_cli/const.py
• Description: Stores constants to maintain consistency throughout the client logic.
Mapping External and Deployment Components
a. LLM Providers and External MCP Servers:
• These external services interact with the CLI via network/API calls defined by the configuration (as described in the README’s JSON sample) and correspond to invoked command-line tools.
b. Local File Configuration:
• Also reference CONFIG.md (documentation for configuration) and mcp-server-config-example.json as examples of the expected configuration schema.
c. Build and Integration Tools:
• Mention supporting files in the root like pyproject.toml, .github workflows (release.yml, test.yml) which indicate CI/CD processes, even though they are more supportive than central to the runtime architecture.
• We can show these on the periphery if desired.
Relationships and Data Flow
• From “User Terminal” → “CLI (cli.py)” indicating command input.
• From “CLI” → “Config Manager (config.py)” for loading settings.
• From “CLI” → “Prompt/Input Parser (prompt.py, input.py)” to transform the user command into application logic.
• From “CLI” and its sub-components (memory.py, tool.py) → “LLM Provider/MCP Servers” indicating requests that go out to external services.
• Finally, responses are routed back from external services into “Output Handler (output.py)” and then to the terminal.
• The CLI calling the tool handler in tool.py after processing via the prompt and input parsers.
• The configuration manager reading and interpreting data from ~.llm/config.json (as well as from repomix.config.json/CONFIG.md) to inform both tool behavior and LLM settings.
Architectural Patterns and Design Principles
a. Modularity: The directory structure in src/mcp_client_cli shows a modular approach, with separate modules for CLI logic, config management, input/output handling, and tool invocation.
c. Extensibility: The integration of multiple MCP servers (as seen in the configuration example) demonstrates that the architecture is designed to be extensible. Make clear extension points where new tool modules could be plugged in.
d. External Dependencies: Highlight that external API calls and third-party services are decoupled from the internal logic.