MCP-CLI-HOST

by vincent-pli

MCP Client
  • agent-framework

A CLI host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP).

About

What is MCP-CLI-HOST?

MCP-CLI-HOST is a command-line host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP). It runs in the terminal and supports models from OpenAI, Azure OpenAI, Deepseek, and Ollama, making it suitable for developers and LLM users who want to extend AI capabilities with external tools.

How to use MCP-CLI-HOST?

Install via pip install mcp-cli-host. Set environment variables for API keys (e.g., OPENAI_API_KEY) or for Azure OpenAI (e.g., AZURE_OPENAI_DEPLOYMENT). For Ollama, install and run the Ollama service. Configure MCP servers in ~/.mcp.json or a custom path using the --config flag, then run mcpclihost -m <provider:model> to start an interactive session.

Key features of MCP-CLI-HOST

- Interactive conversations with multiple LLM models
- Support for multiple concurrent MCP servers
- Dynamic tool discovery and integration
- Configurable message history window for context management
- Tool calling capabilities for both model types
- Monitor and trace errors from server side

Use cases of MCP-CLI-HOST

- Querying a SQLite database through an LLM-powered chat interface
- Managing filesystem operations via a conversational AI assistant
- Combining multiple MCP servers (e.g., database and web scraping) in one session
- Experimenting with different LLMs (OpenAI, Deepseek, Ollama) while retaining the same tooling environment

FAQ from MCP-CLI-HOST

Which LLM models does MCP-CLI-HOST support?

It supports OpenAI, Azure OpenAI, Deepseek, and Ollama models. Use the -m flag with the format provider:model, for example deepseek:deepseek-chat or ollama:qwen2.5:3b.

How do I configure MCP servers?

Create a JSON configuration file (default ~/.mcp.json) with entries for each server, specifying the command and arguments. Use the --config flag to point to a custom location.

Does MCP-CLI-HOST work with any MCP server?

Yes, it can work with any MCP-compliant server. The README references the official MCP Servers Repository for examples.

What is the license for MCP-CLI-HOST?

This project is licensed under the Apache 2.0 License.

Details

Author
vincent-pli
Category
agent-framework
Repository
vincent-pli/mcp-cli-host

MCPCLIHost 🤖

A CLI host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP). Currently supports Openai, Azure Openai, Deepseek and Ollama models.

English | 简体中文

What it looks like: 🤠

https://github.com/vincent-pli/mcp-cli-host/blob/main/mcp-cli-host.png

Features ✨

- Interactive conversations with multipe LLM models
- Support for multiple concurrent MCP servers
- Dynamic tool discovery and integration
- Tool calling capabilities for both model types
- Configurable MCP server locations and arguments
- Consistent command interface across model types
- Configurable message history window for context management
- Monitor/trace error from server side
- Support sampling
- Support Roots

Environment Setup 🔧

1. For Openai and Deepseek:

export OPENAI_API_KEY='your-api-key'

By default for Openai the base_url is "https://api.openai.com/v1"
For deepseek it's "https://api.deepseek.com", you can change it by --base-url

2. For Ollama, need setup firstly:
- Install Ollama from https://ollama.ai
- Pull your desired model:

ollama pull mistral

- Ensure Ollama is running:
ollama serve

3. For Azure Openai:
export AZURE_OPENAI_DEPLOYMENT='your-azure-deployment'
export AZURE_OPENAI_API_KEY='your-azure-openai-api-key'
export AZURE_OPENAI_API_VERSION='your-azure-openai-api-version'
export AZURE_OPENAI_ENDPOINT='your-azure-openai-endpoint'

Installation 📦

pip install mcp-cli-host

Configuration ⚙️

MCPCLIHost will automatically find configuration file at ~/.mcp.json. You can also specify a custom location using the --config flag:

{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/tmp/foo.db"
      ]
    },
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/tmp"
      ]
    }
  }
}

Each MCP server entry requires:
- command: The command to run (e.g., uvx, npx)
- args: Array of arguments for the command:
- For SQLite server: mcp-server-sqlite with database path
- For filesystem server: @modelcontextprotocol/server-filesystem with directory path

Usage 🚀

MCPCLIHost is a CLI tool that allows you to interact with various AI models through a unified interface. It supports various tools through MCP servers.

Available Models

Models can be specified using the --model (-m) flag: - Deepseek: deepseek:deepseek-chat - OpenAI: openai:gpt-4 - Ollama models: ollama:modelname - Azure Openai: azure:gpt-4-0613

Examples

# Use Ollama with Qwen model
mcpclihost -m ollama:qwen2.5:3b

Use Deepseek

mcpclihost -m deepseek:deepseek-chat

Flags

- --config string: Config file location (default is $HOME/mcp.json) - --debug: Enable debug logging - --message-window int: Number of messages to keep in context (default: 10) - -m, --model string: Model to use (format: provider:model) (default "anthropic:claude-3-5-sonnet-latest") - --base-url string: Base URL for OpenAI API (defaults to api.openai.com)

Interactive Commands

While chatting, you can use:
- /help: Show available commands
- /tools: List all available tools
- /servers: List configured MCP servers
- /history: Display conversation history
- Ctrl+C: Exit at any time

MCP Server Compatibility 🔌

MCPCliHost can work with any MCP-compliant server. For examples and reference implementations, see the MCP Servers Repository.

License 📄

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.