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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。