Skip to main content
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

If you’re using Claude or ChatGPT (browser, mobile, or desktop), connect to the Coinbase remote MCP via a Claude or ChatGPT connector. Here’s how it looks in Claude:
See Coinbase MCP in Setup options for step-by-step instructions. Using a coding agent (Claude Code, Codex, Cursor)? Paste this into your agent and it will handle the rest:
Follow https://docs.cdp.coinbase.com/coinbase-for-agents/skill.md to install and configure Coinbase for Agents.
The skill file is a machine-readable setup guide. Your agent will identify the best connection method, walk you through authentication, and verify the connection.

Remote MCP connector

Add Coinbase as an MCP connector in Claude or ChatGPT. Sign in with OAuth 2.1 — no local install required.

AI-native

JSON output by default, MCP tool-calling, and a bundled skill file for agent self-onboarding.

Preview before you execute

Every CLI write operation supports --dry-run and order preview. See fees, slippage, and estimated fill price before committing.

Terminal-ready

Market and limit orders, portfolio management, and USDC/USD conversions from the command line.

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: create portfolios, move funds, check balances and positions
  • 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.

Portfolio isolation

Recommended setup: 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.

Setup options

The skill file above handles Coinbase CLI setup automatically, but if you prefer to configure things manually:

Coinbase MCP

Connect any MCP-compatible AI app to the Coinbase MCP server at https://agents.coinbase.com/mcp. Authentication uses OAuth 2.1 to sign in with your Coinbase account.
  1. Click the Customize toolbox icon in the left sidebar
  2. Go to Connectors
  3. Click the + button, then Add custom connector
  4. Name it (e.g., “Coinbase”) and enter the server URL: https://agents.coinbase.com/mcp
  5. Leave all other fields blank — click Create
  6. Sign in with your Coinbase account when prompted
  7. On the approval screen, select which portfolios to give the agent access to. See Portfolio isolation for the recommended setup.
This works identically on Claude web and Claude desktop.
To disconnect Coinbase from an app, go to Coinbase Account > Security > Connections and revoke the connection.

Coinbase CLI

An agent-first CLI for Coinbase Advanced Trade with JSON output, order preview, and a built-in local MCP server. Use it standalone or to run the local MCP server for your coding agents.

1. Install the CLI

npm install -g @coinbase/coinbase-cli
coinbase --version
Node.js 22 or later is required.
nvm/fnm users: Each Node version has its own global packages. If you upgrade Node, reinstall the CLI in a new terminal:
npm install -g @coinbase/coinbase-cli
Linux only: install keyring support to keep secrets out of plaintext:
which secret-tool || sudo apt install -y libsecret-tools

2. Create a CDP API key

  1. Go to API Keys in the CDP Portal (a project is auto-created on first sign-in)
  2. Click Create API Key and give it a name (e.g., my-trading-agent)
  3. Under Advanced Settings > Coinbase App & Advanced Trade:
    • a. Select the portfolio you want the agent to trade from (Primary is selected by default — see Portfolio isolation for the recommended setup).
    • b. Enable Trade and Transfer (View is on by default). Transfer allows moves between your portfolios only and does not allow withdrawals to external addresses.
  4. Click Create & Download and save the JSON key file
The key secret is only shown at creation time.

3. Configure and verify

coinbase 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

4. Check a price and place a trade

# Get the current BTC price
coinbase products get BTC-USD --jq '.price'

# Preview a $10 market buy (shows fees + estimated fill price, does not execute)
coinbase orders preview product_id=BTC-USD side=BUY type=market quote_size=10

# Execute the trade with an idempotent order ID
coinbase orders create product_id=BTC-USD side=BUY type=market \
  quote_size=10 client_order_id=$(uuidgen)

# Check the order
coinbase orders get <order_id>
client_order_id makes the order idempotent. If your connection drops and you retry with the same ID, the API returns the existing order instead of creating a duplicate. Always include one.

Tools

Market data

CLI commandMCP toolDescription
coinbase products get <product_id>products_getPrice, 24-hour volume/change, and size limits
coinbase products listproducts_listAll tradable products (900+ results, filter with symbol or --jq)
coinbase products list symbol==USDproducts_listProducts with USD as the base or quote currency
coinbase products ticker <product_id>products_tickerRecent trades with best bid/ask
coinbase products book <product_id>products_bookFull order book (bids + asks)
coinbase products candles <product_id> granularity==1hproducts_candlesOHLCV price history
coinbase products best-bid-ask product_ids=BTC-USDCurrent best bid and ask

Orders

CLI commandMCP toolDescription
coinbase orders preview ...orders_previewDry-run: returns fill estimate, fees, and slippage
coinbase orders create ...orders_createExecute an order
coinbase orders listorders_listAll orders with status, fill percentage, and fees
coinbase orders get <order_id>orders_getSingle order detail
coinbase orders fillsorders_fillsAll trade fills with price, size, and commission
coinbase orders edit <order_id>orders_editModify an existing order
coinbase orders cancel order_ids:='["<id>"]'orders_cancelBatch cancel orders
coinbase orders close-position product_id=<id> size=<n>orders_close_positionClose 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 commandMCP toolDescription
coinbase balancebalanceAll account balances (crypto + fiat)
coinbase portfolios listportfolios_listAll portfolios with UUID, name, and type
coinbase portfolios get <portfolio_id>portfolios_getBreakdown: balances, positions, allocation %, unrealized PnL
coinbase portfolios create name=<name>portfolios_createCreate a new portfolio
coinbase portfolios edit <portfolio_id> name=<n>portfolios_editRename a portfolio
coinbase portfolios delete <portfolio_id>portfolios_deleteDelete a portfolio (must be empty)
coinbase transfer amount=<n> currency=<c> from=<uuid> to=<uuid>transferMove funds between portfolios

Conversions

CLI commandMCP toolDescription
coinbase convert quote from=<c> to=<c> amount=<n>convert_quoteGet a conversion quote (rate + fee)
coinbase convert execute <quote_id> from=<c> to=<c>convert_executeExecute a quoted conversion
coinbase convert get <quote_id>convert_getCheck conversion status

Info and session

CLI commandMCP toolDescription
coinbase feesfeesFee tier (maker/taker rates) and 30-day volume
coinbase envView and manage credential environments
coinbase mcpStart the local MCP server (stdio)

Global flags

These flags work on any CLI command:
FlagWhat it doesWhen to use
--templatePrint the expected request body without sendingBefore your first call to any command. Discover field names instead of guessing.
--dry-runAssemble the full request and print it without sendingBefore any write operation to verify what will be sent
--jq <expr>Filter the JSON response with a jq expressionExtract specific fields: --jq '.price', --jq '.accounts[].currency'
-e <env>Override the active environmentSwitch between configured environments

Field syntax

CLI commands use the following field syntax:
SyntaxMeaningExample
key=valueString body fieldproduct_id=BTC-USD
key:=valueRaw JSON (arrays, numbers, Boolean values)order_ids:='["abc","def"]'
key==valueQuery parameterproduct_type==SPOT
@file.jsonLoad body from a JSON file@order.json

Troubleshooting

ErrorCauseFix
HTTP 401Expired credentialsCreate a new key in the CDP Portal
HTTP 403 Missing required scopesAPI key missing Trade or Transfer permissionCheck key permissions in the Portal
insufficient fundAccount balance too lowRun coinbase balance to check available funds
coinbase: command not foundCLI not on PATHRun npm install -g @coinbase/coinbase-cli; on Windows, add %APPDATA%\npm to PATH
MISSING_FIELDSRequired fields not providedRun coinbase <command> --template to see expected fields
INVALID_VALUEUnrecognized enum valueCheck the error message for accepted values
INVALID_FORMATWrong date/time formatUse 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.