mihomo-mcp
Bridges the mihomo (Clash Meta) RESTful API to the Model Context Protocol, enabling AI clients to switch proxies, test latency, refresh subscriptions, set operating modes, and monitor connections.
README
mihomo-mcp
Bridge mihomo (clash meta) RESTful API to Model Context Protocol. Switch proxies, refresh subscriptions, monitor traffic — directly from your AI client.
Status: v0.1.0 (public) — 9 tools, 17 tests, verified on mihomo v1.19.24
What is mihomo-mcp?
mihomo exposes a powerful RESTful API on 127.0.0.1:9090 (external-controller). This package wraps that API as MCP tools, so an AI client (Claude Code, OpenClaw, Cursor, etc.) can:
- List and switch proxy groups
- Test proxy latency
- Refresh provider subscriptions
- Update provider subscription URL (without restart in many cases)
- Set operating mode (rule / global / direct)
- Inspect active connections
Requirements
- Python 3.10+
- mihomo running with
external-controllerenabled - An MCP-compatible client (OpenClaw, Claude Code, Claude Desktop, etc.)
Not affiliated with mihomo. This is a community project.
Installation
# Recommended (uv)
uv tool install mihomo-mcp
# Or pip
pip install mihomo-mcp
# Or from source
git clone https://github.com/Aris-qin/mihomo-mcp.git
cd mihomo-mcp
pip install -e .
Configuration
# ~/.config/mihomo-mcp/config.yaml
mihomo:
host: 127.0.0.1
port: 9090
secret: "" # if mihomo has external-controller-secret
timeout: 10
Environment variables override file values:
| Var | Default |
|---|---|
MIHOMO_HOST |
127.0.0.1 |
MIHOMO_PORT |
9090 |
MIHOMO_SECRET |
(empty) |
MIHOMO_TIMEOUT |
10 |
Register with OpenClaw
In openclaw.json:
{
"mcp": {
"servers": {
"mihomo": {
"type": "stdio",
"command": "mihomo-mcp",
"env": {
"MIHOMO_HOST": "127.0.0.1",
"MIHOMO_PORT": "9090"
}
}
}
}
}
Register with Claude Desktop
Edit claude_desktop_config.json:
{
"mcpServers": {
"mihomo": {
"command": "mihomo-mcp",
"env": {
"MIHOMO_HOST": "127.0.0.1",
"MIHOMO_PORT": "9090"
}
}
}
}
Tools
| Tool | Description |
|---|---|
proxy_list |
List all proxy groups and their current selection |
proxy_select |
Switch a selector group to a specific proxy |
proxy_test |
Test latency of a single proxy |
proxy_test_group |
Test all proxies in a group, sorted by latency |
provider_list |
List providers (subscriptions) and node counts |
provider_healthcheck |
Trigger health check on a provider |
provider_update_url |
Update provider's subscription URL and refresh |
mode_set |
Switch operating mode (rule / global / direct) |
connections_list |
List active connections |
Security & Privacy
- No subscription URL is persisted. The
provider_update_urltool receives a URL via MCP, forwards it to mihomo, and discards it. Nothing is logged or written to disk. - Default host is
127.0.0.1. Overriding host to a public IP is not recommended and may be rejected in future versions. - No credentials stored. If your mihomo has
external-controller-secret, pass it viaMIHOMO_SECRETenv var — never in config files checked into version control. - No traffic proxying. This package only manages mihomo state — it does not forward your traffic.
- Not affiliated with mihomo. Community project, MIT licensed.
License
MIT — see LICENSE.
Contributing
PRs welcome after the initial public release. Please open an issue first for major changes.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.