How jonigl/mcp-client-for-ollama works
Project Type and Purpose
• This is an open-source Python CLI tool (monolithic, modular design) that mediates between:
• The end user (terminal)
• Local Ollama LLM runtime (via HTTP API)
• One or more external MCP-compliant tool servers (via STDIO, SSE, or HTTP)
1. User → CLI: command/input
2. CLI → Core Client: parsed parameters
3. Core Client → Config Manager & Model Manager: load settings & available models
4. Core Client → Ollama: send user query + tool definitions
5. Ollama → Core Client: streaming response chunks or tool-call request
6. Core Client → Tool Manager: on function call in response
7. Tool Manager → Server Discovery / Connector: invoke MCP server call
8. MCP Server → Tool Manager: return tool output
9. Tool Manager → Core Client → Ollama: send tool output back to model
10. Ollama → Core Client → CLI: final response display
11. Config Manager → File System: save/load user configurations
Architectural Patterns & Principles
• Layered modular design (UI → orchestration → domain modules → external interfaces)
• Dependency injection of transports (connector abstraction)
• Single-responsibility modules (config, models, tools, streaming)
• Streaming I/O for real-time feedback
Technologies & Frameworks
• Python 3.10+
• Rich (for terminal UI)
• uv / uvx (optional for invocation)
• HTTP & SSE protocols
• Process STDIO for external tools