autodl-mcp
Manage ordinary AutoDL container instances: power them on/off, query status/hardware, switch GPU/non-GPU modes, and track/cancel background power jobs.
Power on GPU instances asynchronously; returns a job ID and retries in background when capacity is unavailable.
Power on in no-GPU mode for pay-as-you-go instances.
Power off instances, interrupting running tasks and cancelling pending power retries.
Query one instance or batch-query 1–100 instances for status, GPU model, per-GPU memory, and CPU cores; no credentials returned.
Switch between GPU and non-GPU modes via an orchestrated background shutdown/start job.
Check job phase, attempts, elapsed time, retry timing, and errors.
Wait briefly for a job, optionally waiting through out-of-capacity periods, without cancelling it.
Cancel a job's later steps without rolling back accepted power requests or automatically shutting down.
Click on "Deploy 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., "@autodl-mcp 帮我把 AutoDL 实例开机,GPU 缺货就后台慢慢重试"
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.
autodl-mcp
管理普通 AutoDL 容器实例的 MCP 服务,可作为 Antigravity、Claude Code 和 Codex 插件安装:开机(含无卡模式)、关机、查询实例与后台开机任务状态。缺货时在后台按指数退避自动重试,不用你盯着。
不适用于 AutoDL Pro(专业版)。
仓库根目录本身就是插件根目录。三种宿主共用技能(skills/autodl/SKILL.md)和 MCP 服务代码,各自的插件清单负责加载;插件安装同时提供技能和 autodl MCP 工具。
需要手动注册 MCP 服务时,可参考 mcp-config.example.json;Codex 手动注册使用自己的 TOML 配置格式。完整插件安装方法见 INSTALL.md。
快速开始
git clone https://github.com/Long-Holiday/autodl-mcp
cd autodl-mcp
uv run autodl-mcp-install --list # 查看三种宿主 CLI 的安装情况
uv run autodl-mcp-install --agent antigravity # 装进 Antigravity(默认)
uv run autodl-mcp-install --agent claude # 装进 Claude Code
uv run autodl-mcp-install --agent codex # 装进 Codex
uv run autodl-mcp-install --agent claude --dry-run # 只看命令,不执行--from-git 用远端仓库装,不依赖本地检出;--source <路径或 git URL> 指定别的安装源。
装完在所选宿主中应该能看到 autodl 服务的这些工具(宿主可能添加插件命名空间前缀):
工具 | 作用 |
| 查实例状态及 GPU 型号、单卡显存、分配的 CPU 核心数(不返回凭证) |
| 批量查询 1–100 个 UUID 的状态和硬件,共享分页;价格未验证时明确返回未知 |
| 一个后台任务完成关机、确认关机、按目标模式开机;会中断工作且重新计费 |
| 申请 GPU 开机,立即返回 |
| 无卡模式开机(仅按量计费实例) |
| 关机,会中断实例上正在运行的任务 |
| 查后台开机任务的 phase / 重试时间 / 错误 |
| 短等待任务完成(默认最多 15 秒),缺货立即返回进度;不取消任务 |
| 只取消后续尝试,不会关机;返回取消后的物理状态 |
配套的技能文件会告诉 agent:开机前要先确认(会计费)、不要在 confirming 阶段重复发起、cancel_job 不等于关机、不同 error.kind 分别该怎么处理。
硬件规格与等待任务
instance_status(instance_uuid) 新增 gpu_name、gpu_memory_gb、cpu_cores。
规格来自控制台「规格详情」的配置快照,关机时也可查询;缺失或无效的可选值为 null。
gpu_memory_gb 是单卡显存,按 1024³ 字节换算(与控制台 GB 显示一致);
cpu_cores 是分配的 vCPU 数,不是宿主机总核数。无卡模式下返回的 GPU 配置不代表当前已挂载 GPU。
开机或切换得到 job_id 后,可调用 wait_for_job(job_id):默认最多等 15 秒,
任务结束或发现缺货(waiting_capacity)时立即返回。即使显式传入 timeout_seconds=120,
默认也不会在已知缺货时继续静默等待。快照包含 attempts、elapsed_seconds、suggested_next_poll_seconds。
suggested_next_poll_seconds 是建议下次拉取状态前等待的秒数,基于单调时钟计算、向上取整且不小于 0;
缺货/网络退避时等于最近一次尝试间隔加当前倒计时(约跨过两次尝试窗口),其余等待阶段就是当前倒计时;
无待定等待时为 null。它避免调用方用本地时钟计算时间差,但仍有传输和处理延迟,不代表资源可用倒计时。
elapsed_seconds 是任务累计耗时(终态固定),不是平台承诺的排队时长或排位。
收到缺货快照后,先向用户报告尝试次数、已等待时间和建议的下次拉取间隔,不要紧密重复调用。
按 suggested_next_poll_seconds 用宿主定时调度器登记一次性唤醒(Antigravity CLI 为 schedule),
到点再用 job_status 复核;不要用 shell sleep 盲等,也不要设置高频循环唤醒。
宿主没有定时能力时,需要继续短等待才用 wait_for_job(job_id, timeout_seconds=15, return_on_capacity=False);
显式长等待仍可使用 timeout_seconds=120, return_on_capacity=False。
秒数范围为 0–300,0 立即返回;活动 phase 表示尚未完成。等待超时或中断不会取消后台任务,
也不会增加上游查询或开机请求。即时进度仍可用 job_status 查询。
任务只保存在当前 MCP 进程中,不跨服务重启恢复。
批量查询
list_instances(instance_uuids=["uuid-a", "uuid-b"]) 共用一次列表分页,再以最多 5 路并发读取硬件快照。
1–100 个 UUID 全部通过格式/白名单校验后才发请求;重复 UUID 去重,结果按输入顺序排列。
返回 instances 与 errors:单个实例找不到或硬件获取失败不会抹掉其他成功结果;
硬件失败时保留状态,规格为 null,错误在 errors 中。列表整体鉴权/协议错误则整次调用失败。
价格尚未提供准确报价:现有接口资料未验证价格字段、币种及计费单位,
所以每项返回 price: null 和 price_unavailable_reason,不代表免费。
接入真实报价需要经过验证的接口资料或脱敏响应样例,不根据 charge_type 猜金额。
无卡 / GPU 模式切换
确认中断任务与重新计费后,调用 switch_mode(instance_uuid, target_mode="gpu"),
或 target_mode="non_gpu"(无卡,仅按量计费)。工具立即返回 job_id,后台顺序完成:
检查 → 关机 → 确认关机 → 按目标模式开机 → 确认运行;GPU 缺货沿用自动退避。
已按目标模式运行时不关机;已经关机则直接开机;已经关机中则只等待。
同一实例相同切换复用活动任务,其他活动操作冲突需先取消并确认实例状态。
这是编排而非可回滚事务。失败、取消或服务退出可能留下运行中、关机中或已关机的实例,
不会自动回滚;取消不会撤销已经接受的电源请求。
cancel_job 会返回取消后立即查询的物理状态 resulting_status(以及 resulting_start_mode)。
例如关机完成后在 waiting_capacity 等 GPU 时取消,会直接得到 resulting_status: "shutdown",
不必再调 instance_status;过渡态(如 starting / shutting_down)或查询失败(resulting_status 为 null,
原因见 resulting_status_error)时仍需复查。
power_off 会先取消切换,防止其后续自动拉起。
stopping 表示正在请求/确认关机,未观察到关机状态绝不开机。
关机确认受 stop_timeout 限制,超时或结果不确定时停止切换,请查询实际状态再决定。
Related MCP server: MCP-AWS
Token 怎么给
仓库和插件清单里不存任何密钥。 服务从环境变量 AUTODL_TOKEN 读取,需要你自己设置:
export AUTODL_TOKEN='控制台登录 Token 原文(不要加 Bearer 前缀)'Token 从浏览器 DevTools → Network → 任意实例请求的
Authorization头里取原文。从设置好环境变量的终端启动宿主;各宿主的环境变量传递方式见 INSTALL.md。
从桌面图标启动的 GUI 应用可能不继承 shell 环境;需要在本机的宿主环境或 MCP 配置中设置 Token,不能修改仓库内的清单来保存密钥。JSON MCP 配置示例见 mcp-config.example.json。
设置完自检:
uv run autodl-mcp --check自检只验证配置能否加载,不访问网络;Token 是否有效要等第一次真实请求才能确认。
配置
非敏感配置随代码提交在 config.yaml,每一项都能被同名环境变量覆盖:
配置项 | 默认值 | 说明 |
|
| 允许操作的实例 UUID;空表示允许全部自有实例 |
|
| 额外视为「无空闲 GPU」的上游返回码 |
|
| 缺货重试的起止间隔(秒) |
|
| 网络类错误的退避起止间隔(秒) |
|
| 单次开机等待上限, |
|
| 开机状态轮询间隔(秒) |
|
| 模式切换的关机确认上限(秒),可用 |
|
| 单次开机请求的确认上限(秒) |
|
| 单次 HTTP 请求超时(秒) |
用 AUTODL_CONFIG=/path/to/config.yaml 可以指向别处的配置文件。
详细的安装、排查与卸载步骤见 INSTALL.md。
开发
uv run pytest -q
uv run ruff check .
agy plugin validate .
claude plugin validate .claude-plugin/plugin.json
claude plugin validate .claude-plugin/marketplace.json仓库约定见 AGENTS.md。
许可证
Available Tools
9 toolscancel_jobAIdempotent
取消开机/切换任务的后续步骤,不撤销已接受的电源请求,不自动关机或恢复。
Inputs: job_id (required). Returns: object
instance_statusARead-only
查询指定 UUID 的实例状态与配置规格:GPU 型号、单卡显存 GB(1024³ 字节)、分配的 CPU 核心数;无卡模式不代表 GPU 已挂载。不返回密码或 SSH 凭证。
Inputs: instance_uuid (required). Returns: object
job_statusBRead-only
查询当前进程中的开机/切换任务、尝试次数、累计耗时、重试时间和错误。next_retry_in_seconds 为快照时距下次重试的剩余秒数(向上取整,无重试时为 null)。
Inputs: job_id (required). Returns: object
list_instancesARead-only
批量查询 1–100 个实例 UUID 的状态和硬件规格,共享一次列表分页。返回 instances 与逐项 errors;价格来源未验证时 price 为 null,不代表免费。不会返回密码或 SSH 凭证。
Inputs: instance_uuids (required). Returns: object
power_offADestructiveIdempotent
关机(中断实例上的运行任务);先取消开机重试,返回接受结果而非最终状态。
Inputs: instance_uuid (required). Returns: object
power_onAIdempotent
为指定 UUID 开机(会计费);缺货后台持续重试,立即返回任务 ID。
Inputs: instance_uuid (required). Returns: object
power_on_no_gpuAIdempotent
无卡模式开机(仍会计费,无 GPU);仅支持按量计费实例,立即返回后台任务 ID。不会自动将已运行的 GPU 实例切换为无卡模式,请先关机并确认状态。
Inputs: instance_uuid (required). Returns: object
switch_modeADestructiveIdempotent
切换 GPU/无卡模式,立即返回后台任务 ID:关机、确认关机、按目标模式重新开机。会中断运行任务,重新开机会计费;执行前必须确认。无卡目标仅支持按量计费。不是可回滚事务;失败或取消可能停在关机状态,不自动恢复。任务不跨服务重启恢复。
Inputs: instance_uuid (required), target_mode. Returns: object
wait_for_jobARead-only
只读等待当前进程任务结束、缺货或超时后返回快照;默认缺货立即返回。timeout_seconds 为 0–300 秒(默认 15,0 立即返回)。return_on_capacity=False 可等待穿过缺货阶段;活动 phase 表示尚未结束。缺货返回后先汇报 attempts/elapsed_seconds/next_retry_in_seconds,不要紧密重复查询。next_retry_in_seconds 为快照时距下次重试的剩余秒数(向上取整,无重试时为 null)。本次等待超时或断开不会取消后台开机任务;任务不跨服务重启恢复。
Inputs: job_id (required), timeout_seconds, return_on_capacity. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Tools target mostly distinct actions, but power_on, power_on_no_gpu, and switch_mode all involve powering on or cycling instances and could be misselected without reading details. The descriptions clarify scope (e.g., no-card vs GPU, mode switching).
Names are mostly snake_case with recognizable verb/noun components, but conventions vary (power_on, job_status, wait_for_job, instance_status). Still predictable and readable overall.
9 tools is well within the ideal range for a focused power and status management server. Each tool covers a specific operation without obvious redundancy.
Covers power on/off, no-GPU mode, mode switching, task control, and single/batch status. Broader lifecycle operations (create/delete instance) are missing, but those may be outside the server's apparent scope.
Maintenance
Related MCP Connectors
AI cloud for agents: launch GPUs, run jobs that stop their own billing, schedule runs.
On-demand GPU nodes for agents: create nodes, run commands, and submit jobs, billed by the minute.
GPU compute for agents: run commands on an L4/A100/H100, watch logs, billed per second.
Provides capabilities that let LLM agents perform a range of infrastructure management tasks.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Hyperbolic's GPU cloud, allowing users to view available GPUs, rent instances, establish SSH connections, and run GPU-powered workloads through natural language commands.17MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to provision and terminate AWS EC2 instances using natural language commands.1-
- AlicenseNot gradedqualityNot gradedmaintenanceManages AutoDL GPU cloud instances, including lifecycle management, SSH operations, file transfer, and GPU monitoring.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents and MCP clients to manage AutoDL GPU instances programmatically, including creating, listing, powering on/off, executing commands, transferring files, and enforcing automatic shutdown.36 npm4MIT