vastai-mcp
# Vast.ai MCP Server
An MCP (Model Context Protocol) server that exposes Vast.ai cloud operations
as tools: list GPUs, search offers, create volumes, create instances, and
view billing.
## Setup
Installed as a package via pip (recommended):
```bash
pip install vastai-mcp
export VAST_API_KEY=your_api_key_here
```
Or from source, for local development:
```bash
pip install -e .
```
Get an API key at <https://cloud.vast.ai> (Settings -> API Keys).
## Run (stdio, for MCP clients)
Installing the package puts a `vastai-mcp` command on your PATH:
```bash
vastai-mcp
```
## Claude Desktop config example
```json
{
"mcpServers": {
"vastai": {
"command": "vastai-mcp",
"env": { "VAST_API_KEY": "your_api_key" }
}
}
}
```
(See `mcp.json.example` in this repo for a copy-pasteable template — copy it to
`mcp.json` and fill in your key; `mcp.json` itself is gitignored since it holds
a real secret.)
## Tools
| Tool | Description |
| --- | --- |
| `list_gpus` | Current GPU supply/demand/pricing snapshot. |
| `search_offers` | Search rentable machine offers (filter by GPU, price, disk, country). |
| `create_volume` | Rent a new persistent volume (searches a matching volume offer and rents it). |
| `list_volumes` | List your rented volumes. |
| `create_instance` | Rent a machine by offer id (requires `max_hourly_price` as a spend cap), optionally creating/attaching a volume. |
| `billing_summary` | Per-instance hourly cost breakdown (GPU, disk, storage, total) plus recent charges. |
### Typical workflow
1. `list_gpus` to see what's available.
2. `search_offers(gpu_name="RTX 4090", max_price=1.0, limit=10)` to find a machine.
3. `billing_summary` to check current spend.
4. `create_instance(offer_id=123, max_hourly_price=1.0, volume={"size_gb": 100, "mount_path": "/data"})`
to launch (refuses if the offer's live price exceeds `max_hourly_price`).
TDQS
Scored across 6 tools
Each tool targets a distinct resource or action: GPU pricing snapshots, rentable offers, volume creation, volume listing, instance creation, and billing. list_gpus and search_offers are related but clearly differ in granularity, and the descriptions prevent confusion.
Most tool names follow a clear verb_noun pattern such as list_gpus, create_volume, and create_instance. billing_summary is the only real outlier, being a noun phrase rather than a verb-led action, but the overall convention remains predictable.
Six tools is well within the ideal scope for a focused rental-management server. Each tool serves a necessary step in the core workflow, and there is no obvious bloat or redundancy.
The tool set covers discovery, creation, volume listing, and billing, but it lacks essential lifecycle operations such as listing instances, terminating instances, and deleting volumes. This creates significant dead ends: resources can be created but not managed or cleaned up.