Skip to main content

Add your description here

Project description

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: 🤠

snapshot

Features ✨

  • Interactive conversations with multipe LLM models
  • Support for multiple concurrent MCP servers
  • Dynamic tool discovery and integration
  • Configurable MCP server locations and arguments
  • Configurable message history window for context management
  • Monitor/trace error from server side
  • Support Sampling, Roots, Elicitation, retrievling Resource, Prompts
  • Support runtime exclude specific tool
  • Show MCP server card when connected

Latest Update 💌

  • [2025-07-18] Support Streamable HTTP mcp server, OAuth process not support yet
  • [2025-07-02] Support Elicitation
  • [2025-06-27] Deal with Prompts in MCP server: Link
  • [2025-06-20] Deal with Resources in MCP server: Link

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

  1. For Ollama, need setup firstly:
ollama pull mistral
  • Ensure Ollama is running:
ollama serve
  1. 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:

STDIO mcp server

{
  "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

Remote mcp server(only support Streamable HTTP)

{
  "mcpServers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": {"Authorization": "Bearer <your PAT>"}
    }
  }
}

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 --sys-prompt 'You are a slightly playful assistant, please answer questions in a cute tone!'

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)
  • --roots string: MCP clients to expose filesystem “roots” to servers
  • --sys-prompt string: System prompt

Interactive Commands

While chatting, you can use:

  • /help: Show available commands
  • /tools: List all available tools
  • /exclude_tool tool_name: Exclude specific tool from the conversation
  • /resources: List all available resources
  • /get_resource: Get specific resources by uri, example: /get_resource resource_uri
  • /prompts: List all available prompts
  • /get_prompt: Get specific prompt by name, example: /get_prompt prompt_name
  • /servers: List configured MCP servers
  • /history: Display conversation history
  • /quit: 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.

Known issues 🐛

  • In scenario of Sampling and Elicitation, when typing "Ctrl+c", the process will crash with something like asyncio.exceptions.CancelledError, will be resolved later.

License 📄

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_cli_host-0.1.12.tar.gz (30.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_cli_host-0.1.12-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

Details for the file mcp_cli_host-0.1.12.tar.gz.

File metadata

  • Download URL: mcp_cli_host-0.1.12.tar.gz
  • Upload date:
  • Size: 30.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for mcp_cli_host-0.1.12.tar.gz
Algorithm Hash digest
SHA256 acd7a2bdb74918174463885a6982c40b111c5b8b6069a06514148cb2b285b4c6
MD5 9e02cc6e6aaf996d65b3f3ef6a0b1444
BLAKE2b-256 78b6cf226a470007cb55f2d84fc9be63d0ac9d30bee30097d8794720d71f83e3

See more details on using hashes here.

File details

Details for the file mcp_cli_host-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_cli_host-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 866a913e428f07c3f764a12737e443451a6683f969d2f58afcbd5b9c8306bfc8
MD5 507bd6c8a053ba3ab8cff6109f1d2c2b
BLAKE2b-256 5848a479daf7d01aa8b116196859c56980c868244f8e35d3cc3640141847037d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page