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
Metadata
Release files for mcp-server-clash-verge 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_server_clash_verge-0.1.4.tar.gz | 10.6 kB | Without provenance | Details for mcp_server_clash_verge-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_server_clash_verge-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for mcp_server_clash_verge-0.1.4-py3-none-any.whl |
Total release size: 20.3 kB
Release files / mcp_server_clash_verge-0.1.4.tar.gz
| Download URL | mcp_server_clash_verge-0.1.4.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db812040bc6ca2f862fd7aec50a19a65389c9701b665b59d3776e93f4dcef02f
|
|
BLAKE2b-256 checksum How to use checksums |
52546c99063a8e01d116a0a83dfac92a9c05106752b380e63951aa81556a8e47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / mcp_server_clash_verge-0.1.4-py3-none-any.whl
| Download URL | mcp_server_clash_verge-0.1.4-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
46a5d82613e99e4cd5fd1aedb8a533099086c9ddb81df0f30e33b7215845a2fa
|
|
BLAKE2b-256 checksum How to use checksums |
57ae5fbb095d9b09ab12a795dccdddfb93440b63b7ff1756444d48bb62fb05ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Security for mcp-server-clash-verge 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.