MCP Host CLI

by VyacheslavVanin

132 downloads
Not rated
GitHub

About

Local http server that proxies requests o LLMs and uses mcp-servers if needed

Details

Author
VyacheslavVanin
Downloads
132
Categories
Developer Tools

- FastAPI server for chat interactions with LLMs
- Configurable via environment variables and CLI arguments
- Supports OpenAI-compatible providers (e.g., OpenRouter)
- Tool approval workflow with request/response endpoints
- Streaming mode and retry on LLM errors

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Host CLI
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Configure via environment variables (e.g., LLM_API_KEY, LLM_MODEL) or CLI arguments (e.g., --model, --port). Start the server using uv run main.py with desired options. Send requests to endpoints like POST /user_request and POST /approve.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp host cli": {
            "mcp-http-host": {
                "command": "uv",
                "args": [
                    "run",
                    "main.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-http-host": {
        "command": "uv",
        "args": [
            "run",
            "main.py"
        ]
    }
}

LLM Chat Server

FastAPI server for chat interactions with LLMs (OpenAI).

Configuration

Configuration is managed via environment variables and CLI arguments.

Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| LLM_API_KEY | API key for LLM provider (alternative to --api-key-file) | - |
| LLM_MODEL | Model name to use | qwen2.5-coder:latest |
| PORT | Port to run server on | 8000 |
| LLM_PROVIDER | LLM provider (openai) | openai |
| OPENAI_BASE_URL | Base URL for OpenAI-compatible API | https://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

| Argument | Description | Example |
|----------|-------------|---------|
| --model | LLM model to use | --model qwen2.5-coder:latest |
| --port | Port to run server on | --port 8000 |
| --provider | LLM provider (openai) | --provider openai |
| --openai-base-url | Base URL for OpenAI API | --openai-base-url https://api.openai.com/v1 |
| --api-key-file | Path to file containing the API key | --api-key-file /path/to/api.key |
| --servers-config | Path to servers config file | --servers-config config/servers.json |
| --current-directory | Working directory | --current-directory /projects |
| --context-window-size | Context window size | --context-window-size 2048 |
| --temperature | Temperature parameter | --temperature 0.7 |
| --stream | Enable streaming mode | --stream |
| --retries-on-llm-error | Number of retries on LLM error | --retries-on-llm-error 3 |
| --debug-messages | Enable 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

```python
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 })
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.