vastai-mcp
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., "@vastai-mcp find me a cheap GPU with at least 24GB VRAM"
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.
vastai-mcp
Vast.ai GPU cloud marketplace and instance management MCP server.
Wraps the Vast.ai REST API (https://console.vast.ai/api/v0) so an LLM agent can search the GPU marketplace, rent machines, manage lifecycle, run commands, and inspect billing.
Table of contents
Related MCP server: quads-mcp
Tools
Tool | Parameters | Description |
|
| Search the GPU marketplace (POST /bundles/) |
|
| GPU benchmark data (GET /benchmarks/) |
|
| Search user and public templates (GET /template/) |
|
| Current supply/demand/pricing snapshot |
|
| Historical price/supply time-series |
|
| List user's instances (GET /instances/) |
|
| Instance details (GET /instances/{id}/) |
|
| Rent a GPU (PUT /asks/{offer_id}/) |
|
| start/stop/label/reboot/recycle |
|
| Permanently destroy (DELETE /instances/{id}/) |
|
| Change spot bid price |
|
| Request instance logs |
|
| Run a remote command |
| none | Current account + credit balance |
|
| Escape hatch for any other endpoint |
|
| Register a local public key on the Vast.ai account (POST /ssh/) |
| none | List registered SSH keys (GET /ssh/) |
|
| Resolve |
|
| Run a command over SSH (paramiko) |
|
| SFTP upload/download between local disk and instance |
The query body for search_offers follows the Vast.ai filter operator convention: each field maps to {eq, neq, gt, lt, gte, lte, in, notin}. Example:
{
"gpu_name": {"in": ["RTX 4090"]},
"num_gpus": {"gte": 1},
"reliability": {"gte": 0.99},
"verified": {"eq": true},
"rentable": {"eq": true},
"type": "ondemand",
"limit": 5
}Environment variables
Variable | Required | Description |
| yes | Vast.ai API key (https://cloud.vast.ai/manage-keys/) |
| no | Default path to your SSH private key, used by |
Wiring it up
Only requirement: uv (https://docs.astral.sh/uv/). Nothing else to install.
Claude Code
claude mcp add vastai-mcp -e VASTAI_MCP_API_KEY=<value> -- uvx --from git+https://github.com/dam2452/vastai-mcp.git vastai-mcpClaude Desktop / other MCP client
{
"mcpServers": {
"vastai-mcp": {
"command": "uvx",
"args": ["--from", "git+https://github.com/dam2452/vastai-mcp.git", "vastai-mcp"],
"env": { "VASTAI_MCP_API_KEY": "<value>" }
}
}
}After pushing a new version: uv cache clean and restart the client.
Local run
uv run --directory . vastai-mcpTests (manual):
uv run --directory . --with pytest pytest test/Available Tools
20 toolschange_bidA
Change the bid price of an interruptible instance (PUT /instances/bid_price/{id}/).
Examples: change_bid(instance_id=12345, price=0.25)
Inputs: price (required), instance_id (required). Returns: object
create_instanceA
Rent a GPU by accepting offer_id (PUT /asks/{offer_id}/).
Either image or template_hash_id must be provided. Use price to create
an interruptible (spot) instance; omit it for on-demand.
env is a flat dict: regular vars as key/value pairs, port mappings as
{"-p 8000:8000": "1"}. Use onstart to launch your app on SSH/Jupyter
runtypes (their entrypoint is replaced by Vast's).
Examples: create_instance(offer_id=12345678, image="ubuntu:22.04", disk=16, runtype="ssh_direct") create_instance(offer_id=12345678, image="vllm/vllm-openai:latest", disk=50, runtype="ssh_direct", env={"MODEL_ID": "deepseek-ai/DeepSeek-R1-Distill-Llama-8B", "-p 8000:8000": "1"}, onstart="vllm serve $MODEL_ID --port 8000") create_instance(offer_id=12345678, template_hash_id="4e17788f74f075dd9aab7d0d4427968f", disk=100) create_instance(offer_id=12345678, image="ubuntu:22.04", disk=16, runtype="ssh_direct", price=0.20)
Inputs: offer_id (required), env, disk, image, +10 more. Returns: object
destroy_instanceA
Permanently destroy an instance and all its data (DELETE /instances/{id}/).
Irreversible. Call carefully.
Examples: destroy_instance(instance_id=12345)
Inputs: instance_id (required). Returns: object
execute_commandA
Execute a constrained remote command on a STOPPED instance (PUT /instances/command/{id}/).
Only works on instances whose actual_status is stopped (transient launch
commands like downloading an image on first start). For running instances,
the API rejects this with: "Execute command only avail on stopped instances.
Use ssh to run commands on running instances." — use ssh_exec instead.
The API additionally enforces a command whitelist — unknown commands return
400 "Invalid command given". ls-style inspection commands are accepted;
nvidia-smi, whoami, arbitrary binaries are not. For arbitrary commands
on a running instance, use ssh_exec.
Examples: execute_command(instance_id=12345, command="ls /workspace")
Inputs: command (required), instance_id (required). Returns: object
get_current_userA
Retrieve the authenticated user's account info and credit balance (GET /users/current/).
Examples: get_current_user()
Inputs: no named parameters. Returns: object
get_gpu_metricsB
Current snapshot of supply, demand, and pricing across GPU types (GET /metrics/gpu/current/).
Examples: get_gpu_metrics() get_gpu_metrics(gpu_name=["RTX 4090", "A100"], verified=True)
Inputs: gpu_name, verified, datacenter. Returns: object
get_gpu_trendsA
Time-series of GPU supply/demand/pricing (GET /metrics/gpu/history/).
Returns ~20 sampled data points over the window by default.
Examples: get_gpu_trends() get_gpu_trends(gpu_names=["RTX 4090"], window_hours=168)
Inputs: step, gpu_names, window_hours. Returns: object
get_instanceA
Retrieve details of a specific instance (GET /instances/{id}/).
Examples: get_instance(instance_id=12345)
Inputs: instance_id (required). Returns: object
get_instance_ssh_infoA
Resolve an instance's direct SSH endpoint (host, port) and return a
ready-to-run ssh command. Requires actual_status == "running" and a
ssh_direct or jupyter_direct runtype.
Examples: get_instance_ssh_info(instance_id=12345)
Inputs: instance_id (required). Returns: object
list_instancesA
List the authenticated user's instances (GET /instances/).
Examples: list_instances() list_instances(label="vllm-inference")
Inputs: label. Returns: object
list_ssh_keysA
List SSH keys registered on the Vast.ai account (GET /ssh/).
Examples: list_ssh_keys()
Inputs: no named parameters. Returns: object
manage_instanceA
Control instance state: start/stop/label/reboot/recycle.
start/stop/label: PUT /instances/{id}/ withstateorlabel.reboot: PUT /instances/reboot/{id}/ (stops and starts, preserves GPU priority).recycle: PUT /instances/recycle/{id}/ (destroys and recreates from fresh image pull).
For action="label", the label argument is required.
Examples: manage_instance(instance_id=12345, action="stop") manage_instance(instance_id=12345, action="start") manage_instance(instance_id=12345, action="label", label="my-server") manage_instance(instance_id=12345, action="reboot")
Inputs: action (required), instance_id (required), label. Returns: object
raw_requestA
Escape hatch for any Vast.ai REST endpoint not covered by other tools.
path is appended to https://console.vast.ai/api/v0 (include the leading
slash, e.g. "/volumes/").
Examples: raw_request(method="GET", path="/volumes/") raw_request(method="POST", path="/ssh/", body={"ssh_key": "ssh-rsa AAA..."})
Inputs: path (required), method (required), body, params. Returns: object
register_ssh_keyA
Register a local SSH public key on the Vast.ai account (POST /ssh/).
The key is applied automatically to all current instances and any new instances created afterwards. Reads the .pub file from disk — never uploads your private key.
Examples: register_ssh_key(name="laptop", public_key_path="C:/Users/me/.ssh/id_ed25519.pub") register_ssh_key(name="ci", public_key_path="/home/runner/.ssh/id_ed25519.pub")
Inputs: name (required), public_key_path (required). Returns: object
search_benchmarksA
Retrieve all GPU benchmark records (GET /benchmarks/).
Returns a list of benchmark entries with gpu_name, value, type, etc.
Examples: search_benchmarks()
Inputs: no named parameters. Returns: object
search_offersA
Search the Vast.ai GPU marketplace for rentable machine offers.
The body is sent as-is to POST /bundles/. Top-level keys commonly include
type ("ondemand" | "bid"), limit, and filter objects. Each filter maps
a field name to an operator object: {eq, neq, gt, lt, gte, lte, in, notin}.
Examples: search_offers({"gpu_name": {"in": ["RTX 4090"]}, "num_gpus": {"gte": 1}, "reliability": {"gte": 0.99}, "verified": {"eq": True}, "rentable": {"eq": True}, "type": "ondemand", "limit": 5}) search_offers({"type": "bid", "gpu_ram": {"gte": 24000}, "order": [["dph_total", "asc"]], "limit": 10})
Inputs: query (required). Returns: object
search_templatesA
Search user and public templates (GET /template/).
The endpoint always requires a select_filters body (pass {} for "all").
This tool defaults to {} when called without arguments.
Examples: search_templates() search_templates(select_filters={"tag": {"eq": "pytorch"}})
Inputs: select_filters. Returns: object
show_instance_logsA
Request instance logs (PUT /instances/request_logs/{id}). Logs are uploaded to S3; the response contains a URL to fetch them.
Examples: show_instance_logs(instance_id=12345) show_instance_logs(instance_id=12345, tail=5000)
Inputs: instance_id (required), tail. Returns: object
ssh_execA
Execute a command on a running instance over SSH (paramiko).
Resolves the instance's ssh_host/ssh_port automatically. The private
key stays local — never sent to the Vast.ai API.
key_path defaults to the VASTAI_MCP_SSH_KEY_PATH env var if set.
Examples: ssh_exec(instance_id=12345, command="nvidia-smi") ssh_exec(instance_id=12345, command="ls /workspace", key_path="/home/me/.ssh/id_ed25519") ssh_exec(instance_id=12345, command="python train.py", user="root", timeout=300)
Inputs: command (required), instance_id (required), user, timeout, +1 more. Returns: object
ssh_transferA
Transfer a single file between the local machine and an instance over SFTP.
upload: local file -> instance pathdownload: instance path -> local file
Directories are not supported — call once per file. Resolves the instance's
ssh_host/ssh_port automatically. The private key stays local.
key_path defaults to the VASTAI_MCP_SSH_KEY_PATH env var if set.
Examples: ssh_transfer(direction="upload", instance_id=12345, local_path="./train.py", remote_path="/workspace/train.py") ssh_transfer(direction="download", instance_id=12345, local_path="./results.tar", remote_path="/workspace/results.tar")
Inputs: direction (required), local_path (required), instance_id (required), remote_path (required), +3 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Each tool targets a distinct resource and action: search_offers/search_benchmarks/search_templates operate on different datasets, get_gpu_metrics vs get_gpu_trends differ by snapshot vs history, and instance tools are clearly separated (list/get/create/manage/destroy). Even potentially similar tools like execute_command and ssh_exec are explicitly differentiated by stopped vs running instance state.
All tools follow a consistent verb_noun snake_case pattern (search_offers, list_instances, create_instance, destroy_instance, ssh_exec, ssh_transfer). The naming is predictable and consistent, with no camelCase or mixed conventions.
20 tools is at the upper end of 'well-scoped' but appropriate for a full Vast.ai API surface covering marketplace search, instance CRUD, SSH operations, metrics, and user info. The count feels justified given the breadth of features, though slightly heavy compared to a typical 3-15 tool server.
The surface covers the main GPU rental workflow: search offers, create/read/delete instances, manage state, run commands, transfer files, and fetch metrics. Minor gaps like volume management exist, but the raw_request escape hatch covers any missing endpoint, preventing dead ends.
Maintenance
Related MCP Connectors
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Hosted MCP server for live public-data APIs and Skills for AI agents.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server that exposes 300+ AI agents as tools via a single API key. Supports listing agents, invoking any agent with chat-completion style messages, checking agent health, and retrieving platform statistics.54MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for interacting with QUADS infrastructure systems via API, enabling resource management and automation through LLM applications.MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for renting real GPUs from the terminal. Enables browsing, renting, chatting, managing, and pooling GPU instances with per-second billing, designed for AI agents.82 npm1-
- AlicenseAqualityBmaintenanceEnables managing Vast.ai cloud operations, including listing GPUs, searching offers, creating volumes and instances, and viewing billing, through MCP tools.6MIT