Mihomo MCP Server
Allows listing available Mihomo versions from GitHub releases, and performing upgrades/rollbacks using the GitHub API.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mihomo MCP ServerShow me the current proxy groups and their nodes"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mihomo MCP Server
基于 MCP (Model Context Protocol) 的 Mihomo/Clash Meta 代理管理服务。
让 AI 助手能自动管理系统代理、工具代理、订阅、规则与内核版本。
✨ 功能一览
⚡ Mihomo 管理(12 工具)
工具 | 说明 |
| 查看 Mihomo 服务状态(版本、API 可达性) |
| 启动/停止 Mihomo 服务 |
| 查看当前版本与更新状态 |
| 列出所有可用版本 |
| 升级/降级到指定版本 |
| 回滚到备份版本 |
| 列出订阅详情(节点数、流量、到期时间) |
| 刷新订阅节点列表 |
| 添加新订阅(自动重启 Mihomo) |
| 修改订阅参数 |
| 删除订阅(清理引用 + 本地文件) |
🌐 系统代理(11 工具)
工具 | 说明 |
| 列出所有代理组及当前节点 |
| 列出指定组的节点详情与延迟(并发测试) |
| 切换代理组节点 |
| 测试单个节点延迟 |
| 测试目标网站可达性 |
| 遍历节点,自动推荐最快节点 |
| 列出所有路由规则 |
| 添加路由规则(DOMAIN/IP-CIDR/GEOIP 等) |
| 删除路由规则 |
| 快捷添加直连规则 |
| 快捷添加代理规则 |
🔧 工具代理(7 工具)
独立 Mihomo 实例(端口 7893),与系统代理完全隔离。
工具 | 说明 |
| 查看工具代理运行状态 |
| 初始化工具代理配置 |
| 启动/停止工具代理 |
| 切换工具代理节点 |
| 列出工具代理可用节点 |
| 在指定节点下执行命令,不影响系统代理,5 分钟空闲自动关闭 |
Related MCP server: dida365-agent
🚀 快速开始
# 正常启动 MCP 服务器
python3 main.py
# 一键部署(自动安装 Mihomo + 启动 MCP)
python3 main.py --install
# 仅启动 MCP(Mihomo 已就绪时)
python3 main.py --mcp-only环境要求
Python ≥ 3.10
sudo 权限(管理 systemd 服务)
systemd(Mihomo 服务管理)
screen(MCP 服务守护)
依赖安装
pip install pyyaml>=6.0🏗 项目结构
mcp_nodes/
├── main.py # 入口(3 模式)
├── server.py # MCP HTTP 服务器(SSE 协议,工具注册)
├── config.py # 配置常量 + 结构化响应类
├── mihomo_api.py # Mihomo REST API 封装(含 API Secret 支持)
├── config_manager.py # YAML 原子读写 + systemctl 管理
├── tools_nodes.py # 🌐 节点管理工具(并发测试)
├── tools_rules.py # 📋 规则管理工具
├── tools_subscriptions.py # 📡 订阅管理工具
├── tools_versions.py # 🛠 服务控制 + 版本管理
├── tools_toolproxy.py # 🔧 工具代理(独立 Mihomo 实例,空闲自动停止)
├── install.py # 📦 一键部署脚本
├── push.py # Git 推送脚本(环境变量读取 Token)
├── pyproject.toml # 项目元数据
├── LICENSE # MIT 协议
└── README.md # 本文档🔌 MCP 协议
服务使用 SSE 协议,绑定 127.0.0.1(仅本地访问):
SSE 端点: http://127.0.0.1:9010/mcp/sse
消息端点: http://127.0.0.1:9010/mcp/message
健康检查: http://127.0.0.1:9010/health调用示例
curl -X POST http://127.0.0.1:9010/mcp/message \
-H "Content-Type: application/json" \
-d '{"tool": "list_groups", "parameters": {}}'响应格式
所有工具返回统一结构化响应:
{
"success": true,
"data": { ... },
"message": "操作成功",
"error": null
}错误时:
{
"success": false,
"data": null,
"message": "错误描述",
"error": {
"code": "ERROR_CODE",
"details": "详细信息",
"suggestions": ["建议1", "建议2"]
}
}⚙ 配置
通过环境变量配置:
变量 | 默认值 | 说明 |
|
| 系统 Mihomo 外部控制器地址 |
|
| 系统 Mihomo 配置文件路径 |
|
| GitHub API Token(版本管理用) |
工具代理端口
端口 | 说明 |
7893 | 工具代理 HTTP/SOCKS5 混合端口 |
9092 | 工具代理外部控制器 API |
🔐 安全说明
MCP 服务器 绑定
127.0.0.1:9010,仅本地访问工具代理 仅本地端口 7893/9092
系统 Mihomo API 自动读取
config.yaml中的secret配置,如果设置了 secret 则所有 API 请求自动带上 Bearer Tokenpush.py 从环境变量
GITHUB_TOKEN读取 Token,不硬编码
📦 一键部署(install.py)
python3 install.py # 完整部署
python3 install.py --dry-run # 仅检测,不操作
python3 install.py --mcp-only # 仅启动 MCP部署流程:
[1/7] 检测 confiug → 检查 Mihomo 安装状态
[2/7] 下载 → GitHub 获取最新内核
[3/7] 安装 → 备份旧版 + 安装新版
[4/7] 配置 → 创建基础 config.yaml
[5/7] 服务 → 创建 systemd 服务
[6/7] 启动 → 启动 + 验证 API
[7/7] MCP → 启动 MCP 服务器🧪 测试
# 健康检查
curl http://127.0.0.1:9010/health
# 列出代理组
curl -X POST http://127.0.0.1:9010/mcp/message \
-H "Content-Type: application/json" \
-d '{"tool": "list_groups", "parameters": {}}'
# 工具代理运行状态
curl -X POST http://127.0.0.1:9010/mcp/message \
-H "Content-Type: application/json" \
-d '{"tool": "toolproxy_status", "parameters": {}}'📄 许可证
MIT © 2026 星之游
🙏 致谢
MetaCubeX/mihomo — Mihomo/Clash Meta 内核
MCP Protocol — Model Context Protocol
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityFmaintenance基于 DrissionPage 的模型上下文协议 (MCP) 服务,为 AI 助手提供强大的浏览器自动化能力。Last updated24MIT
- Alicense-qualityBmaintenanceMCP server that enables AI agents to manage Dida365/TickTick tasks, projects, tags, and habits through natural language, with full CRUD, search, and advanced V2 capabilities.Last updated2MIT
- AlicenseBqualityBmaintenance基于MCP协议的聊天桥接服务器,允许多个AI Agent接入同一个聊天室进行对话协作。Last updated426MIT
- Alicense-qualityAmaintenance混合推理 MCP 服务器,在本地 AI Agent 和大模型之间智能路由,优先使用 DeepSeek Web 和智谱 GLM 实现零成本调用。Last updated3MIT
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for AI dialogue using various LLM models via AceDataCloud
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/xingzhiyou/mihomo-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server