A CLI host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP).
A CLI host application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP). Currently supports both Claude 3.5 Sonnet and Ollama models.
MCPHost acts as a host in the MCP client-server architecture, where:
This architecture allows language models to:
Currently supports:
export ANTHROPIC_API_KEY='your-api-key'
ollama pull mistral
ollama serve
go install github.com/mark3labs/mcphost@latest
MCPHost will automatically create a configuration file at ~/.mcp.json
if it doesn't exist. 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:
mcp-server-sqlite
with database path@modelcontextprotocol/server-filesystem
with directory pathMCPHost is a CLI tool that allows you to interact with various AI models through a unified interface. It supports various tools through MCP servers.
Models can be specified using the --model
(-m
) flag:
anthropic:claude-3-5-sonnet-latest
openai:gpt-4
ollama:modelname
# Use Ollama with Qwen model
mcphost -m ollama:qwen2.5:3b
# Use OpenAI's GPT-4
mcphost -m openai:gpt-4
--anthropic-url string
: Base URL for Anthropic API (defaults to api.anthropic.com)--anthropic-api-key string
: Anthropic API key (can also be set via ANTHROPIC_API_KEY environment variable)--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")--openai-url string
: Base URL for OpenAI API (defaults to api.openai.com)--openai-api-key string
: OpenAI API key (can also be set via OPENAI_API_KEY environment variable)While chatting, you can use:
/help
: Show available commands/tools
: List all available tools/servers
: List configured MCP servers/history
: Display conversation history/quit
: Exit the applicationCtrl+C
: Exit at any time--config
: Specify custom config file location--message-window
: Set number of messages to keep in context (default: 10)MCPHost can work with any MCP-compliant server. For examples and reference implementations, see the MCP Servers Repository.
Contributions are welcome! Feel free to:
Please ensure your contributions follow good coding practices and include appropriate tests.
This project is licensed under the MIT License - see the LICENSE file for details.