Coinbase for Agents gives your AI apps access to Coinbase Advanced Trade to trade crypto, preview orders, and manage portfolios from any AI harness or the terminal.
Get started
Portfolio isolation: Create a separate Advanced portfolio, fund it with only what you’re willing to risk, and scope your agent’s access to that portfolio. This limits the blast radius if the agent makes an unexpected trade.
The local MCP server runs on your machine with a CDP API key. It’s the most reliable setup for executing trades consistently across all models — remote MCP has known issues with high-reasoning models blocking trades on certain platforms.Quickstart
Paste this into your coding agent and it will install, configure, and verify automatically:Follow https://docs.cdp.coinbase.com/coinbase-for-agents/skill.md to install and configure Coinbase for Agents.
Your agent will ask you to create a CDP API key (below) during setup.Create a CDP API key
- Go to API Keys in the CDP Portal (a project is auto-created on first sign-in)
- Click Create API Key and give it a name (e.g.,
my-trading-agent)
- Under Advanced Settings > Coinbase App & Advanced Trade:
- Under Accounts, select the portfolio you want the agent to trade from (Primary is selected by default)
- Enable Trade and Transfer. Transfer allows moves between your portfolios only and does not allow withdrawals to external addresses.
- Check Opt out of IP allowlisting if you haven’t configured specific IP addresses.
- Click Create & Download and save the JSON key file
The key secret is only shown at creation time.
Manual setup
If you prefer to set things up yourself instead of using the quickstart:1. Install the CLInpm install -g @coinbase/coinbase-cli
coinbase --version
Node.js 22 or later is required.
Linux only: install keyring support to keep secrets out of plaintext:which secret-tool || sudo apt install -y libsecret-tools
2. Configure your API keycoinbase env live --key-file <path-to-key.json>
coinbase env # verify: shows "live" with your key ID
coinbase balance # verify: returns JSON with account balances
3. Register the MCP server Claude Code
Codex
Cursor / Windsurf
Other MCP clients
claude mcp add --scope user --transport stdio coinbase -- coinbase mcp
codex mcp add coinbase -- coinbase mcp
Add to your MCP config file:{
"mcpServers": {
"coinbase": {
"command": "coinbase",
"args": ["mcp"]
}
}
}
Add to your agent’s MCP configuration:{ "command": "coinbase", "args": ["mcp"] }
Without a global install, use npx (replace coinbase with npx -y @coinbase/coinbase-cli). The remote MCP connects directly to https://agents.coinbase.com/mcp via OAuth — no local install required. Currently supported in ChatGPT (web, desktop, mobile) and Claude (web, desktop, mobile). Note: on hosted chat clients, high-reasoning and extended-thinking modes sometimes draft an order but stop short of executing it. If that happens, reply asking the agent to place the order explicitly, or use the local MCP setup above for the most consistent execution. ChatGPT (web, desktop, mobile)
Claude (web, desktop, mobile)
Prerequisite: You must enable developer mode in ChatGPT before the “Create App” option appears. Go to Settings > Apps > Advanced Settings and toggle on developer mode.
- Click your profile icon in the bottom-left corner
- Click Settings > Apps > Create App
- Name the app (e.g., “Coinbase”) and set the connection URL to
https://agents.coinbase.com/mcp
- Click Create
- Sign in with your Coinbase account when prompted
Desktop & mobile: Set up the connection on ChatGPT web first. Once connected, the app will automatically be available in ChatGPT desktop and mobile.
- Click the Customize toolbox icon in the left sidebar
- Go to Connectors
- Click the + button, then Add custom connector
- Name it (e.g., “Coinbase”) and enter the server URL:
https://agents.coinbase.com/mcp
- Leave all other fields blank — click Create
- Sign in with your Coinbase account when prompted
- On the approval screen, select which portfolios to give the agent access to
Known limitation: On hosted chat clients, high-reasoning and extended-thinking modes sometimes draft an order but stop short of placing it. If your agent only previews, ask it explicitly to execute the order — or use the local MCP setup above, which executes most consistently across models.
What’s supported today
Coinbase for Agents currently supports:
- Spot crypto trading: buy and sell 900+ trading pairs on Coinbase Advanced Trade
- Isolated agent portfolios: spot crypto only, scoped to a specific portfolio selected when logging in or creating an API key
- Portfolio management: Check balances and positions across your account
- USDC/USD conversions: instant zero-fee conversions between USDC and USD
Coming soon: x402 payments for agent-consumed services (paywalled research, data APIs, compute), equities, prediction markets, and additional asset classes. If it’s on Coinbase, your agent will be able to trade it.
Guiding agents to place orders
Based on order-creation testing across Claude and ChatGPT clients and models connected to the Coinbase for Agents remote MCP server:
- Web clients for Claude and ChatGPT reliably create orders from clear, well-specified instructions, across models. The exception is GPT-5.5 Pro, which doesn’t appear to automatically discover the connected MCP.
- Claude previews and requests confirmation in the chat to create the order, whereas ChatGPT creates the order in one turn.
- Claude Desktop refuses most orders that the web client creates; Sonnet 4.6 is the exception, creating orders when the request includes an explicit authorization (e.g.
I authorize you to buy…).
- Lower-tier models may create orders with the wrong product, for example,
ETH-USD instead of ETH-USDC. Prompt for approval to confirm before creating the order.
For reliable order creation, specify the order type, the amount and asset or currency, and the portfolio in one instruction, for example, Buy 1 USDC of ETH in my agent portfolio. Vague or partial requests require the model to infer and resolve additional details.
Best practices
- Scope the agent’s access to the portfolio(s) you want it to use — a focused set gives the agent a clear, unambiguous target.
- Higher-reasoning models translate more complex intent and recover from underspecified orders; use one for multi-step or vague requests, e.g.
check my balance, then put 5% of my USDC into BTC.
Market data
| CLI command | MCP tool | Description |
|---|
coinbase products get <product_id> | products_get | Price, 24-hour volume/change, and size limits |
coinbase products list | products_list | All tradable products (900+ results, filter with symbol or --jq) |
coinbase products list symbol==USD | products_list | Products with USD as the base or quote currency |
coinbase products ticker <product_id> | products_ticker | Recent trades with best bid/ask |
coinbase products book <product_id> | products_book | Full order book (bids + asks) |
coinbase products candles <product_id> granularity==1h | products_candles | OHLCV price history |
coinbase products best-bid-ask product_ids=BTC-USD | — | Current best bid and ask |
Orders
| CLI command | MCP tool | Description |
|---|
coinbase orders preview ... | orders_preview | Dry-run: returns fill estimate, fees, and slippage |
coinbase orders create ... | orders_create | Execute an order |
coinbase orders list | orders_list | All orders with status, fill percentage, and fees |
coinbase orders get <order_id> | orders_get | Single order detail |
coinbase orders fills | orders_fills | All trade fills with price, size, and commission |
coinbase orders edit <order_id> | orders_edit | Modify an existing order |
coinbase orders cancel order_ids:='["<id>"]' | orders_cancel | Batch cancel orders |
coinbase orders close-position product_id=<id> size=<n> | orders_close_position | Close an open position |
Market order: executes immediately at the best available price.
# Buy $100 of BTC (quote_size = USD amount to spend)
coinbase orders create product_id=BTC-USD side=BUY type=market quote_size=100
# Sell 0.5 ETH (base_size = amount of the asset to sell)
coinbase orders create product_id=ETH-USD side=SELL type=market base_size=0.5
Limit order: executes at the specified price or better.
coinbase orders create product_id=BTC-USD side=BUY type=limit \
base_size=0.001 limit_price=50000
Market buys use quote_size (the amount to spend in USD). Market sells use base_size (the amount of the asset to sell). When switching between buy and sell, explicitly clear the other field (e.g., add quote_size= to clear a stale value).
Portfolios and balances
| CLI command | MCP tool | Description |
|---|
coinbase balance | balance | All account balances (crypto + fiat) |
coinbase portfolios list | portfolios_list | All portfolios with UUID, name, and type |
coinbase portfolios get <portfolio_id> | portfolios_get | Breakdown: balances, positions, allocation %, unrealized PnL |
coinbase portfolios create name=<name> | portfolios_create | Create a new portfolio |
coinbase portfolios edit <portfolio_id> name=<n> | portfolios_edit | Rename a portfolio |
coinbase portfolios delete <portfolio_id> | portfolios_delete | Delete a portfolio (must be empty) |
coinbase transfer amount=<n> currency=<c> from=<uuid> to=<uuid> | transfer | Move funds between portfolios |
Conversions
| CLI command | MCP tool | Description |
|---|
coinbase convert quote from=<c> to=<c> amount=<n> | convert_quote | Get a conversion quote (rate + fee) |
coinbase convert execute <quote_id> from=<c> to=<c> | convert_execute | Execute a quoted conversion |
coinbase convert get <quote_id> | convert_get | Check conversion status |
Info and session
| CLI command | MCP tool | Description |
|---|
coinbase fees | fees | Fee tier (maker/taker rates) and 30-day volume |
coinbase env | — | View and manage credential environments |
coinbase mcp | — | Start the local MCP server (stdio) |
Global flags
These flags work on any CLI command:
| Flag | What it does | When to use |
|---|
--watch | Live-stream updates over WebSocket (local CLI + CDP API key; not OAuth) | Only on orders list, products ticker, products book — e.g. watch a price live, or add --until "price > 70k" to exit on a condition |
--template | Print the expected request body without sending | Before your first call to any command. Discover field names instead of guessing. |
--dry-run | Assemble the full request and print it without sending | Before any write operation to verify what will be sent |
--jq <expr> | Filter the JSON response with a jq expression | Extract specific fields: --jq '.price', --jq '.accounts[].currency' |
-e <env> | Override the active environment | Switch between configured environments |
Field syntax
CLI commands use the following field syntax:
| Syntax | Meaning | Example |
|---|
key=value | String body field | product_id=BTC-USD |
key:=value | Raw JSON (arrays, numbers, Boolean values) | order_ids:='["abc","def"]' |
key==value | Query parameter | product_type==SPOT |
@file.json | Load body from a JSON file | @order.json |
Troubleshooting
| Error | Cause | Fix |
|---|
HTTP 401 | Expired credentials | Create a new key in the CDP Portal |
HTTP 403 Missing required scopes | API key missing Trade or Transfer permission | Check key permissions in the Portal |
insufficient fund | Account balance too low | Run coinbase balance to check available funds |
coinbase: command not found | CLI not on PATH | Run npm install -g @coinbase/coinbase-cli; on Windows, add %APPDATA%\npm to PATH |
MISSING_FIELDS | Required fields not provided | Run coinbase <command> --template to see expected fields |
INVALID_VALUE | Unrecognized enum value | Check the error message for accepted values |
INVALID_FORMAT | Wrong date/time format | Use RFC 3339 with timezone (e.g., 2024-01-01T00:00:00Z) |
Disclaimer
AI agents can make errors, misinterpret instructions, or produce inaccurate output. Coinbase does not guarantee the accuracy of any action taken by an AI agent using this product. You are solely responsible for reviewing and authorizing any trades, transfers, or account changes made through agentic workflows.