mcpField
M
MCP Host CLI

MCP Host CLI

Local
github.com/VyacheslavVaninDeveloper Tools0Updated 30w ago

About MCP Host CLI

MCP Host CLI is a FastAPI chat server that sends requests to OpenAI-compatible LLM APIs and supports configurable MCP server settings. It provides session, chat, and tool-approval endpoints for local use.

Key features

  1. 01FastAPI chat endpoints
  2. 02Configurable LLM provider and model
  3. 03Environment and CLI configuration
  4. 04Tool approval and session endpoints
  5. 05Optional streaming and error retries

Use cases

  1. 01Hosting a local LLM chat API
  2. 02Managing chat sessions over HTTP
  3. 03Reviewing tool calls before approval

MCP support

The server accepts an MCP servers configuration file through `--servers-config` and can handle tool approvals. The README does not specify its MCP server connection protocol.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

LLM Chat Server

FastAPI server for chat interactions with LLMs (OpenAI).

Configuration

Configuration is managed via environment variables and CLI arguments.

Environment Variables
VariableDescriptionDefault
LLM_API_KEYAPI key for LLM provider (alternative to --api-key-file)-
LLM_MODELModel name to useqwen2.5-coder:latest
PORTPort to run server on8000
LLM_PROVIDERLLM provider (openai)openai
OPENAI_BASE_URLBase URL for OpenAI-compatible APIhttps://openrouter.ai/api/v1

Example .env file:

LLM_API_KEY=your-api-key
LLM_MODEL=qwen2.5-coder:latest
PORT=8000
LLM_PROVIDER=openai
CLI Arguments
ArgumentDescriptionExample
--modelLLM model to use--model qwen2.5-coder:latest
--portPort to run server on--port 8000
--providerLLM provider (openai)--provider openai
--openai-base-urlBase URL for OpenAI API--openai-base-url https://api.openai.com/v1
--api-key-filePath to file containing the API key--api-key-file /path/to/api.key
--servers-configPath to servers config file--servers-config config/servers.json
--current-directoryWorking directory--current-directory /projects
--context-window-sizeContext window size--context-window-size 2048
--temperatureTemperature parameter--temperature 0.7
--streamEnable streaming mode--stream
--retries-on-llm-errorNumber of retries on LLM error--retries-on-llm-error 3
--debug-messagesEnable debug messages logging to /tmp/llm-requester.messages.log--debug-messages

Example CLI usage:

# Using environment variable
export LLM_API_KEY=your-api-key
uv run main.py --model qwen2.5-coder:latest --port 8000

# Using API key file
uv run main.py --model qwen2.5-coder:latest --port 8000 --api-key-file /path/to/api.key

API Endpoints

  • POST /user_request - Handle user chat requests
  • POST /approve - Handle tool approval/denial
  • GET /session_state - Get current session state
  • POST /start_session - Create new session

Request/Response Format

Request (POST /user_request)
{
    "input": "user message"
}
Response
{
    "request_id": "uuid",
    "requires_approval": true,
    "tool": {
        "name": "tool-name",
        "arguments": {
            "arg1": "value1",
            "arg2": "value2"
        }
    },
    "message": "response content",
    "model": "model-name",
    "role": "assistant"
}
Tool Approval (POST /approve)
{
    "request_id": "uuid",
    "approve": true
}

Example Usage

import requests

# Start session
response = requests.post("http://localhost:8000/start_session", json={
    "current_directory": "/projects",
    "model": "qwen2.5-coder:latest"
})

# Send message
response = requests.post("http://localhost:8000/user_request", json={
    "input": "Hello, how are you?"
})

# Approve tool call
response = requests.post("http://localhost:8000/approve", json={
    "request_id": "12345",
    "approve": true
})

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.