Back to MCP Catalog

Host CLI MCP Server

Developer ToolsGo
A CLI host application that enables LLMs to interact with external tools through the Model Context Protocol

MCPHost is a powerful CLI application that serves as a host in the Model Context Protocol (MCP) architecture, enabling Large Language Models to interact with external tools and services. It supports multiple AI models including Claude 3.5 Sonnet, Ollama models, Google Gemini, and OpenAI-compatible models, providing a unified interface for tool discovery and integration. With MCPHost, language models can access external tools and data sources, maintain consistent context across interactions, and execute commands safely. The application supports multiple concurrent MCP servers, dynamic tool discovery, and configurable message history for context management.

Getting Started with MCPHost

MCPHost is a command-line interface (CLI) application that enables Large Language Models (LLMs) to interact with external tools through the Model Context Protocol (MCP). It acts as a host in the MCP client-server architecture, managing connections between LLMs and tool servers.

Prerequisites

Before installing MCPHost, ensure you have:

  • Go 1.23 or later installed
  • Appropriate API keys for your chosen model:
    • Anthropic API key for Claude models
    • Google API key for Gemini models
    • OpenAI API key for OpenAI models
  • Ollama installed locally if you plan to use Ollama models

Installation

Install MCPHost using Go:

go install github.com/mark3labs/mcphost@latest

Environment Setup

Set up the necessary environment variables based on your chosen model:

  1. For Claude models:
export ANTHROPIC_API_KEY='your-api-key'
  1. For Google Gemini models:
export GOOGLE_API_KEY='your-api-key'
  1. For Ollama models:
  • Install Ollama from https://ollama.ai
  • Pull your desired model: ollama pull mistral
  • Ensure Ollama is running: ollama serve

Configuration

MCPHost automatically creates a configuration file at ~/.mcp.json if it doesn't exist. You can specify a custom location using the --config flag.

Configuring MCP Servers

MCPHost supports two types of MCP servers:

  1. STDIO Servers:
{
  "mcpServers": {
    "sqlite": {
      "command": "uvx",
      "args": [
        "mcp-server-sqlite",
        "--db-path",
        "/tmp/foo.db"
      ]
    },
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/tmp"
      ]
    }
  }
}
  1. Server Side Events (SSE):
{
  "mcpServers": {
    "server_name": {
      "url": "http://some_host:8000/sse",
      "headers": [
        "Authorization: Bearer my-token"
      ]
    }
  }
}

System Prompt Configuration

You can specify a custom system prompt using the --system-prompt flag. Create a JSON file with your instructions:

{
    "systemPrompt": "You're a helpful assistant specialized in data analysis."
}

Then use it with:

mcphost --system-prompt ./my-system-prompt.json

Usage Examples

MCPHost supports various models that can be specified using the --model (or -m) flag:

  • Anthropic Claude (default): anthropic:claude-3-5-sonnet-latest
  • OpenAI or OpenAI-compatible: openai:gpt-4
  • Ollama models: ollama:modelname
  • Google: google:gemini-2.0-flash

Example commands:

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

# Use OpenAI's GPT-4
mcphost -m openai:gpt-4

# Use OpenAI-compatible model
mcphost --model openai:<your-model-name> \
--openai-url <your-base-url> \
--openai-api-key <your-api-key>

Advanced Configuration

MCPHost offers several flags for advanced configuration:

  • --anthropic-url string: Base URL for Anthropic API (defaults to api.anthropic.com)
  • --anthropic-api-key string: Anthropic API key
  • --config string: Config file location (default is $HOME/.mcp.json)
  • --system-prompt string: System prompt file location
  • --debug: Enable debug mode for troubleshooting

Community Support

For questions or discussions about MCPHost, join the community on Discord.

Related MCPs

Apple Shortcuts
Developer ToolsJavaScript

Control Apple Shortcuts automations from AI assistants

Clojars Dependency Lookup
Developer ToolsJavaScript

Fetch dependency information from Clojars, the Clojure community's artifact repository

Simple Timeserver
Developer ToolsPython

Provides Claude with current time and timezone information

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.