AutoDL MCP Server
by ygh11231
README.md
# AutoDL MCP Server
管理 AutoDL GPU 云实例的 MCP Server,支持实例生命周期管理、SSH 远程操作、文件传输和 GPU 监控。
## 功能
### 实例管理
- `autodl_list_instances` — 列出所有弹性部署
- `autodl_get_instance` — 获取实例详情
- `autodl_stop_instance` — 停止实例(释放 GPU)
- `autodl_start_instance` — 启动实例(分配 GPU)
- `autodl_delete_instance` — 删除实例
- `autodl_set_replicas` — 设置副本数(0=停止,>0=启动)
### 容器管理
- `autodl_list_containers` — 列出部署下的容器
- `autodl_stop_container` — 停止特定容器
- `autodl_get_container_events` — 查看容器事件日志
### GPU 库存与镜像
- `autodl_get_gpu_stock` — 查询区域 GPU 库存
- `autodl_list_images` — 列出私有镜像
- `autodl_get_regions` — 列出可用区域
### SSH 远程操作
- `autodl_ssh_connect` — SSH 连接远程实例
- `autodl_ssh_disconnect` — 断开 SSH 连接
- `autodl_run_command` — 远程执行命令
- `autodl_upload_file` — 上传文件(SCP)
- `autodl_download_file` — 下载文件(SCP)
- `autodl_check_gpu` — 查看 GPU 状态(nvidia-smi)
- `autodl_check_logs` — 查看日志文件
- `autodl_list_ssh_connections` — 列出活跃 SSH 连接
## 安装
### 1. 克隆仓库
```bash
git clone https://github.com/ygh11231/autodl-mcp-server.git
cd autodl-mcp-server
```
### 2. 安装依赖
```bash
pip install -r requirements.txt
```
### 3. 设置 API Token
从 [AutoDL 控制台](https://www.autodl.com) → 设置 → 开发者 Token 获取。
```bash
export AUTODL_API_TOKEN="your_token_here"
```
### 4. 测试运行
```bash
python server.py
```
正常启动后不会有输出,MCP 协议通过 stdin/stdout 通信。
## 在 Hermes 中配置
编辑 `~/.hermes/config.yaml`,添加:
```yaml
mcp_servers:
autodl:
command: "/path/to/your/python"
args: ["/path/to/autodl-mcp-server/server.py"]
env:
AUTODL_API_TOKEN: "your_token_here"
```
重启 Hermes 后,所有工具会自动注册为 `mcp_autodl_*`。
## 在 Claude Code 中配置
编辑 `~/.claude/.mcp.json`:
```json
{
"mcpServers": {
"autodl": {
"type": "stdio",
"command": "/path/to/venv/bin/python",
"args": ["/path/to/autodl-mcp-server/server.py"],
"env": {
"AUTODL_API_TOKEN": "your_token_here"
}
}
}
}
```
## 使用示例
```
> 列出我的所有实例
> 停止实例 xxxx-xxxx-xxxx
> 启动实例 xxxx-xxxx-xxxx,设置 2 个副本
> 查询西北企业区的 GPU 库存
> SSH 连接我的实例,查看 GPU 状态
> 把我的代码上传到远程实例
```
## 项目结构
```
autodl-mcp-server/
├── server.py # MCP 服务器入口
├── autodl_api.py # AutoDL REST API 客户端
├── ssh_manager.py # SSH 连接管理器
├── requirements.txt # Python 依赖
├── README.md # 本文件
└── LICENSE # MIT 许可证
```
## 许可证
MIT
This server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues