mcp-server-clash-verge
MCP server for Clash Verge Rev that lets AI agents control your proxy — switch nodes, change modes, reload config, test latency — directly from conversation.
README
mcp-server-clash-verge
MCP (Model Context Protocol) server for Clash Verge Rev / Mihomo (Clash Meta). Lets Claude Code and other MCP-compatible AI agents control your proxy — switch nodes, change modes, reload config, test latency — directly from conversation.
One-Click Install
Tell Claude Code this one sentence:
Help me install https://raw.githubusercontent.com/IS5416/mcp-server-clash-verge/main/SETUP.md
Claude will auto-detect your platform, install the package, configure ~/.claude.json, and verify everything. No manual steps. No environment variables. Restart Claude Code and you're done.
Why
When Claude Code hits network errors behind a proxy, you don't want to switch to the Clash Verge GUI, find a faster node, then tell Claude "try again." You want Claude to fix it itself.
This MCP server gives Claude 7 tools to manage your Mihomo proxy autonomously.
Requirements
- Clash Verge Rev (or any Mihomo-based client) with External Controller enabled
- Python ≥ 3.10
Manual Install
1. Install the package
pip install mcp-server-clash-verge
Or from source:
git clone https://github.com/IS5416/mcp-server-clash-verge.git
cd mcp-server-clash-verge
pip install -e .
2. Configure Claude Code
Edit ~/.claude.json and add to the mcpServers object:
"clash-verge": {
"command": "python",
"args": ["-m", "mcp_server_clash_verge"],
"env": {},
"type": "stdio"
}
If you have uv installed:
"clash-verge": {
"command": "uvx",
"args": ["mcp-server-clash-verge"],
"env": {},
"type": "stdio"
}
No env block needed. The MCP server auto-detects Clash Verge Rev's configuration file on Windows, macOS, and Linux.
Restart Claude Code.
3. Try It
"List all my proxy nodes."
"Switch to HK-01."
"I'm getting network errors, find a fast node and switch to it."
Tools
| Tool | Description |
|---|---|
list_proxies |
All proxy groups, nodes, current selection, and delay |
switch_proxy |
Switch a proxy group to a specific node |
get_proxy_mode |
Current mode: rule / global / direct |
set_proxy_mode |
Set mode: rule / global / direct |
test_proxy_delay |
Test latency of a specific node (milliseconds) |
reload_config |
Force reload Mihomo configuration from disk |
list_rules |
Show active routing rules |
Configuration
Zero config by default. The server auto-detects Clash Verge Rev on all platforms:
| Platform | Config path |
|---|---|
| Windows | %APPDATA%\io.github.clash-verge-rev.clash-verge-rev\config.yaml |
| macOS | ~/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/config.yaml |
| Linux | ~/.config/io.github.clash-verge-rev.clash-verge-rev/config.yaml |
Override (optional)
Set environment variables in ~/.claude.json if you use a non-standard Clash client:
"clash-verge": {
"command": "python",
"args": ["-m", "mcp_server_clash_verge"],
"env": {
"MIHOMO_API_URL": "http://127.0.0.1:9097",
"MIHOMO_API_SECRET": "your-secret"
},
"type": "stdio"
}
| Variable | Default | Description |
|---|---|---|
MIHOMO_API_URL |
auto-detected | Mihomo external controller address |
MIHOMO_API_SECRET |
auto-detected | API secret from Clash Verge settings |
Use Cases
- Claude Code hits proxy timeout during web scraping/search → automatically switch to a low-latency node and retry
- Need temporary global proxy →
set_proxy_mode global, switch back to rule mode when done - After subscription update →
reload_configto refresh without touching the GUI - Debug routing issues →
list_rulesto check current rules match expectations
Security
- The MCP server communicates with Claude Code exclusively via
stdio— it opens no network ports - Mihomo API secret is read from your Clash Verge config file, never hardcoded or logged
- All operations are local to your Mihomo instance — no data is sent externally
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。