CloudGPU MCP server: let your AI assistant rent the GPU

Tell your coding assistant “fine-tune this on a 4090 and bring me the adapter”, and it does the rest. It quotes a price, rents the GPU once you say yes, uploads your code and data, runs the job, downloads the results and shuts the GPU down. It works with any client that speaks the Model Context Protocol (MCP), including Cursor, Cline, opencode, Claude Code, Continue, Windsurf and VS Code.

The server runs on your own computer, so the assistant can reach the repository and datasets you already have open. CloudGPU’s servers enforce the budget and time limit on every instance it rents, so a GPU still shuts down if the chat ends or your laptop goes to sleep.

Install

  1. Create an API key at cloudgpu.app/api. The same key and balance cover GPUs and the model API.
  2. Add the server to your client. You need Node.js 18 or newer.

Cursor (~/.cursor/mcp.json), Windsurf, Cline (MCP Servers → Configure), Claude Desktop:

{
  "mcpServers": {
    "cloudgpu": {
      "command": "npx",
      "args": ["-y", "https://cloudgpu.app/mcp/cloudgpu-mcp-0.1.0.tgz"],
      "env": { "CLOUDGPU_API_KEY": "cgw-sk-..." }
    }
  }
}

Claude Code:

claude mcp add cloudgpu --env CLOUDGPU_API_KEY=cgw-sk-... -- npx -y https://cloudgpu.app/mcp/cloudgpu-mcp-0.1.0.tgz

opencode (opencode.json):

{
  "mcp": {
    "cloudgpu": {
      "type": "local",
      "command": ["npx", "-y", "https://cloudgpu.app/mcp/cloudgpu-mcp-0.1.0.tgz"],
      "environment": { "CLOUDGPU_API_KEY": "cgw-sk-..." }
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "cloudgpu": {
      "command": "npx",
      "args": ["-y", "https://cloudgpu.app/mcp/cloudgpu-mcp-0.1.0.tgz"],
      "env": { "CLOUDGPU_API_KEY": "cgw-sk-..." }
    }
  }
}
  1. Optional: copy the agent rules file into your project as AGENTS.md, .cursor/rules/cloudgpu.md or CLAUDE.md. It tells the assistant to quote before renting, download before shutting down, and never leave a GPU running.

What the assistant can do

Tool What it does
get_account Balance, and how many instances the account may run at once
list_gpus GPU models with VRAM, live price per GPU-hour and availability
list_templates Ready-made images such as JupyterLab, Ollama, ComfyUI and LLaMA-Factory
estimate_cost Live quote for a GPU and a number of hours, plus your balance afterwards
create_instance Rents the GPU from a quote the user approved, with a budget and a time limit
get_status / list_instances Status, minutes run, cost so far, auto-shutdown limits
run_command Runs a command on the instance; long jobs run in the background
tail_logs Latest log lines, whether the job finished, GPU utilisation
upload / download Copies files and folders between your computer and the instance
stop_instance Destroys the instance and stops billing
list_models Models on the OpenAI-compatible API, for when you only need inference

Guardrails

  • A quote first. create_instance only accepts a quote_id from estimate_cost, plus confirmation that the user approved it. The assistant sees the live price, the estimate and the balance after the job before anything is rented.
  • Limits our servers enforce. Every instance the MCP server rents carries max_spend_usd, max_hours and, by default, a 60-minute idle limit. CloudGPU checks them every minute and destroys the instance when one is reached, whether or not your client is still connected.
  • Your own ceiling. CLOUDGPU_MAX_SPEND_USD (default 50) and CLOUDGPU_MAX_HOURS (default 24) cap what the assistant may set. CLOUDGPU_READ_ONLY=1 leaves only the look-up tools.
  • Results before shutdown. If commands were run and nothing was downloaded, stop_instance refuses until the assistant downloads the results or you confirm.
  • Secrets stay out of the chat. The server uses the instance’s SSH login itself and never returns it to the model. Output is scrubbed of the API key and login details, and uploading .ssh, .env or key files needs explicit permission.
  • The instance stays manageable. Commands that change the root password, the SSH configuration, the firewall or the platform’s monitoring agent are refused. Instances must stay reachable for monitoring, as stated in the acceptable use policy.

The REST API underneath

The MCP server is a thin wrapper around the public GPU API (/v1/gpu/offers, /v1/gpu/instances and so on), which every account can use with the same key. Agents and scripts that don’t speak MCP can call it directly, and the auto-shutdown fields max_minutes, max_spend_usd and idle_minutes work the same way there.

FAQ

Do I need a separate account or key for the MCP server?

No. It uses a normal CloudGPU API key, and GPU time comes out of the same prepaid balance as the model API.

What happens if my laptop sleeps during a long training run?

The job keeps running on the instance. The budget and time limit you approved still apply, because CloudGPU’s servers enforce them. When you come back, the assistant can check the logs and download the results.

Can the assistant spend more than I approved?

No. Each instance has a budget that CloudGPU’s servers enforce, and the MCP server refuses any budget above your CLOUDGPU_MAX_SPEND_USD. The account balance is a hard limit too: when it runs out, instances are destroyed.

Which clients work?

Any MCP client that can start a local command-line server, including Cursor, Cline, opencode, Claude Code, Continue, Windsurf, VS Code and Claude Desktop.

Is the source available?

Yes. It is MIT-licensed at github.com/mrhy7176/cloudgpu-examples/tree/main/mcp-server.