prime-intellect-mcp
prime-intellect-mcp
Claude CodeがPrime IntellectのGPUポッドを自律的にレンタル、操作、終了できるようにします。管理者が設定した厳格な支出上限が適用されます。
概要
Claude Code(または任意のMCPクライアント)をPrime Intellectアカウントに接続するMCPサーバーです。これを使用することで、エージェントは以下の操作が可能になります:
🔍 検索: 要件に一致する最も安価なGPUポッドを検索
💸 見積もり: 課金前に価格を提示
🛒 プロビジョニング: ポッドの作成(
confirm=Trueを指定した場合のみ)🖥️ SSH: ポッドへのSSH接続(接続文字列はエージェント自身の
Bashツールに渡されます)🛑 終了: 作業完了後のポッド終了(終了忘れに対する警告機能付き)
「最も安いH100をレンタルしてトレーニングスクリプトを実行し、終わったら終了して」とClaudeに指示するだけで、400ドルの請求に驚くような事態を防ぐワークフローのために構築されています。
Related MCP server: claude-colab
60秒でインストール
Claude Codeを通じてGPUをレンタルし始めるには、以下の手順が必要です:
1. Prime Intellect APIキーを取得する
こちらをクリックして生成 → 権限を以下のように設定します:
スコープ | レベル |
Instances | Read and write |
Availability | Read only |
Billing | Read only |
SSH Keys | Read only |
キーをコピーしてください(pit_…で始まります)。
2. Claude Codeにサーバーを追加する
~/Library/Application Support/Claude/claude_desktop_config.json(macOS)またはプロジェクトの.mcp.jsonを開き、以下を貼り付けます:
{
"mcpServers": {
"prime-intellect": {
"command": "uvx",
"args": ["prime-intellect-mcp"],
"env": {
"PRIME_API_KEY": "pit_PASTE_YOURS_HERE",
"PRIME_MAX_HOURLY_USD": "5",
"PRIME_MAX_TOTAL_USD": "40"
}
}
}
}以上です。Claude Codeを再起動し、「現在1ドル/時間以下で利用可能なGPUは何ですか?」と尋ねてみてください。
uvxがない場合は、curl -LsSf https://astral.sh/uv/install.sh | sh(またはbrew install uv)でインストールしてください。これはuvパッケージマネージャーのワンライナーインストーラーであり、今後仮想環境の管理に悩む必要がなくなります。
✨ SSHの追加(オプション、+2分) — Claudeがポッド上でコードを実行するために必要
上記のサーバーだけでもポッドのプロビジョニング、確認、終了は可能です。しかし、Claude Codeが実行中のポッドにSSH接続してコマンドを実行するには、Prime Intellectがあなたのマシンの公開SSHキーを知っている必要があります。
3. マシン上のSSHキーを確認または生成する
ls ~/.ssh/*.pub # if you have id_ed25519.pub or similar, you're set
# otherwise:
ssh-keygen -t ed25519 -C "you@example.com" # press Enter through the prompts4. 公開キーをPrime Intellectに登録する
cat ~/.ssh/id_ed25519.pub # or whichever .pub file you have出力された内容(ssh-ed25519 …で始まる1行)をコピーし、app.primeintellect.ai/dashboard/ssh-keysのAdd SSH keyフォームに貼り付けます。
以上です。今後のポッドにはあなたの公開キーがauthorized_keysに含まれるようになり、Claude CodeのBashツールから直接SSH接続できるようになります:
ssh ubuntu@<pod-ip-from-pod_status> "nvidia-smi"v0.2で予定: Claude内からステップ4を実行できる
register_ssh_keyMCPツール(ブラウザを開く必要がなくなります)。進捗はissueトラッカーで確認できます。
Claudeでできること(9つのツール)
ツール | ユースケース |
| 「Prime IntellectではどのようなGPUタイプを提供していますか?」 |
| 「3ドル/時間以下で利用可能な1×H100ポッドを表示して。」 |
| 「残りのクレジットはいくらですか?」 |
| 「200GBディスク付きの1×A100の見積もりを出して。」(課金なし) |
| 「その見積もりでポッドをプロビジョニングして。」( |
| 「実行中のポッドを表示して。」 |
| 「ポッドXは準備完了ですか?SSH情報が出るまで待機して。」 |
| 「ポッドXを終了して。」( |
| 「終了し忘れているポッドはありませんか?」 |
安全性:無断でのプロビジョニングは行われません
以下の3層の保護が適用されます:
まず見積もり:
pod_quoteは価格と60秒間有効なトークンを返します。副作用はなく、金額はエージェントのコンテキストに保持されます。明示的な確認:
pod_create(およびpod_terminate)にはconfirm=Trueが必要です。これがない場合、ドライランのプレビューのみが行われます。環境変数による厳格な上限:
PRIME_MAX_HOURLY_USDはレートを超えるポッドをブロックします。PRIME_MAX_TOTAL_USDは(レート × 最大稼働時間)が予算を超えるポッドをブロックします。ウォレット残高も強制的にチェックされます。これらの上限はツール引数で上書きすることはできず、呼び出しのたびに読み込まれます。
デフォルト値: PRIME_MAX_HOURLY_USD=5, PRIME_MAX_TOTAL_USD=40。設定ファイルのenvブロックで指定してください。
すべてのpod_create / pod_terminateはJSONとして~/.prime-intellect-mcp/audit.logに追記されるため、エージェントがあなたの資金をどのように使用したかの完全な履歴が残ります。
プロンプト例(Claude Codeに貼り付けてください)
List the cheapest 1×H100 pods available right now. Show me the top 3 by hourly price.Quote a 1×A100 80GB with 100GB disk, 8 vCPU, 64GB RAM. Don't provision yet —
just show me what it would cost.I need to fine-tune a 7B model overnight. Find the cheapest 1×H100 with 200GB
disk, max $40 total budget, max 12 hours. Provision it, give me the SSH command,
and remind me to terminate when I'm done.Check if I have any running pods I forgot about and show me their hourly cost.Terminate pod abc123. Confirm before doing it.トラブルシューティング
Claude Codeの設定がenvブロックを読み込めていないか、PRIME_API_KEYという名前が間違っています。以下で確認してください:
$ env | grep PRIMEClaude Codeを起動するのと同じシェルで確認するか、JSONのenvブロックにキーを直接貼り付けてください(${PRIME_API_KEY}を使用する代わりに)。
エージェントが上限を超えるポッドを選択しました。以下のいずれかを行ってください:
より安いGPUを選択する(
list_availabilityでリージョンフィルターを使用すると、より安いコミュニティ価格の行が表示されることがあります)。設定の
PRIME_MAX_HOURLY_USDを引き上げ、Claude Codeを再起動する。
見積もりは60秒間有効です。エージェントがpod_quoteとpod_createの間で時間をかけすぎました。再度pod_quoteを呼び出してください(コストはかかりません)。
プロビジョニングが完全に完了していません。ポッドは起動していますが、インストールスクリプトを実行中です。pod_status(pod_id, wait_for_ssh=True)を呼び出すと、SSHが利用可能になるまで(5秒ごとにポーリングして)待機します。
Prime Intellectに公開キーを伝えていないか、登録前にポッドがプロビジョニングされました。修正方法:
app.primeintellect.ai/dashboard/ssh-keysで公開キーが登録されているか確認する。
再プロビジョニング — ポッドの
authorized_keysは作成時に設定されるため、登録前に作成されたポッドにはキーが反映されません。秘密鍵にパスフレーズがある場合は、macOSで
ssh-add --apple-use-keychain ~/.ssh/your_keyを一度実行してください。これにより、エージェントが自動的にロックを解除できるようになります。
app.primeintellect.ai/walletでチャージしてから再試行してください。
なぜこれが必要なのか?
PyPIにはprime-mcp-server 0.1.2が存在しますが、これは概念実証レベルのものです。本プロジェクトはフォークではありません。夜間などの無人運用における違いは以下の通りです:
|
| |
2段階の見積もり → 確認 | ✅ | ❌ |
環境変数による支出上限 | ✅ | ❌ |
ウォレットの事前チェック | ✅ | ❌ |
暴走ポッドの検知 | ✅ | ❌ |
エージェントへのSSH引き渡し | ✅ | ❌ |
テスト | 32ユニット + ライブテスト | なし |
ローカル開発
git clone https://github.com/kvrancic/prime-intellect-mcp
cd prime-intellect-mcp
uv sync
uv run pytest -m "not live" # 32 fast tests, no network, no spend
uv run ruff check .
uv run mypy srcライブスモークテスト(最も安いGPUをプロビジョニングし、nvidia-smiを実行して終了。約0.05ドルの消費):
PRIME_API_KEY=pit_... PRIME_LIVE_TEST=1 PRIME_LIVE_MAX_HOURLY=0.60 \
PRIME_MAX_HOURLY_USD=0.60 PRIME_MAX_TOTAL_USD=2.00 \
uv run pytest tests/test_smoke_live.py -v -sロードマップ
v0.2 —
register_ssh_keyMCPツール(ダッシュボードでの手順を不要にする)、サンドボックス(prime-sandboxesSDK)、Environments Hubv0.3 — オプションの自動終了デーモン(サーバー側での
max_lifetime_hoursの強制)、コストテレメトリv1.0+ — Prime IntellectがOAuthをサポートした際のホスト型/OAuthデプロイ、Anthropicコネクタディレクトリへの提出
謝辞
Prime Intellect: 作業の90%を担う
primePython SDKを提供MIT 6.8610 (Advanced NLP): テストを可能にしたPrime Intellectクレジットを提供
FastMCP: フレームワークを提供
ライセンス
MIT — LICENSEを参照してください。
貢献
IssueやPRを歓迎します。提出前にuv run pytest -m "not live"とuv run ruff check .を実行してください。
Available Tools
9 toolsget_wallet_balanceA
Return the current Prime Intellect wallet balance and recent billings.
Use this to estimate how long a quoted pod can run, or to check why pod_create returned an insufficient-funds error.
Inputs: no named parameters. Returns: object
list_availabilityA
List currently-available GPU pods that match the filters.
Returns the SDK's GPUAvailability rows (cloud_id, gpu_type, gpu_count, prices, disk/vcpu/memory bounds, stock_status, ...). Use this to pick a target before pod_quote, or to show the user options.
Inputs: gpu_type, gpu_count, regions. Returns: object
list_gpu_typesA
List every GPU type Prime Intellect currently offers (e.g. "H100_80GB", "A100_80GB").
Use this when the user is vague about what they want. Pass the result into list_availability or pod_quote.
Inputs: no named parameters. Returns: result
pod_check_runawayA
Return locally-tracked pods that have run past max_lifetime_hours OR whose accumulated cost is approaching PRIME_MAX_TOTAL_USD.
Call this at the start of long-running sessions to catch forgotten pods.
Inputs: no named parameters. Returns: result
pod_createA
Provision a Prime Intellect GPU pod (or preview the provisioning).
With confirm=False: returns a dry-run preview describing what would happen. With confirm=True: validates spend caps + quote freshness, then provisions.
The server enforces:
quote_token must be fresh (TTL 60s)
hourly_usd ≤ PRIME_MAX_HOURLY_USD
hourly_usd × max_lifetime_hours ≤ PRIME_MAX_TOTAL_USD
estimated total ≤ wallet balance
On success, the pod is recorded in local state.json so pod_check_runaway can warn about overdue pods later.
Inputs: quote_token (required), name (required), max_lifetime_hours, confirm, +1 more. Returns: object
pod_listA
List every pod the API key can see (active + provisioning + stopped).
Inputs: no named parameters. Returns: result
pod_quoteA
Get a non-binding price quote + reserved provisioning payload.
Returns a quote_token (TTL=60s) that you pass to pod_create with confirm=True to actually provision. This tool has NO side effects.
The server picks the cheapest matching GPUAvailability row that satisfies the requested disk/vcpu/memory. If none matches, returns an error explaining what's available.
Inputs: gpu_type (required), gpu_count, disk_size_gb, vcpus, +2 more. Returns: object
pod_statusA
Get the current status (provisioning / active / failed) for a pod.
With wait_for_ssh=True, blocks (polls every 5s) until ssh_connection is
available — that's when you can SSH in. Returns the SSH connection string
in ssh_connection (e.g. "root@1.2.3.4 -p 22000"). Use it from your Bash
tool: ssh -o StrictHostKeyChecking=no <ssh_connection> "<cmd>".
Inputs: pod_id (required), wait_for_ssh, timeout_s. Returns: object
pod_terminateA
Destroy (terminate) a pod. Idempotent on already-deleted pods.
Without confirm=True, returns a no-op preview so you can re-read your decision.
Inputs: pod_id (required), confirm. 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
Each tool has a unique and clearly distinct purpose, from wallet balance and GPU availability listing to pod creation, quoting, and termination. There is no overlap that could cause an agent to select the wrong tool.
Tool names follow a consistent pattern: utility functions use verb_noun (e.g., get_wallet_balance, list_availability) and pod operations all start with pod_ (e.g., pod_create, pod_terminate). The naming is predictable and easily understood.
With 9 tools covering wallet, GPU types, availability, pod lifecycle (create, list, status, quote, terminate), and runaway monitoring, the count is well-scoped for the server's purpose. Each tool earns its place with no redundancy.
The tool surface covers the full lifecycle of GPU pod management: discovering availability, quoting, creating, monitoring status, listing, terminating, and checking for runaway pods. The inclusion of wallet balance and wait-for-SSH functionality addresses common operational needs.
Maintenance
Related MCP Connectors
Rent GPUs at live prices and serve any Hugging Face model, with spend caps for AI agents.
AI cloud for agents: launch GPUs, run jobs that stop their own billing, schedule runs.
Rent cloud GPUs from AI agents: live prices, VRAM estimates, launch, logs and stop.
Rent A100 and H100 GPUs by the minute from your agent, within a spending limit you set.
Related MCP Servers
- AlicenseAqualityFmaintenanceA server that allows LLMs to run Claude Code with all permissions bypassed automatically, enabling code execution and file editing without permission interruptions.1793 npm1,315MIT
- AlicenseNot gradedqualityFmaintenanceEnables Claude Code to execute shell commands, Python code, and file transfers on a Google Colab T4 GPU via an MCP server, bridging the GPU gap for AI coding agents.6MIT
- AlicenseAqualityDmaintenanceThis MCP server enables remote control and management of Claude Code agents, allowing you to execute missions, configure agent personalities, and integrate with other MCP tools.715 npm1MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that lets any MCP-capable agent spawn and drive Claude Code sessions — effectively turning Claude Code into an orchestratable sub-agent fleet.107 npmMIT