> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Coinbase MCP

> Give your AI agent access to Coinbase.

Coinbase for Agents gives your AI apps access to [Coinbase Advanced Trade](https://www.coinbase.com/advanced-trade) to trade crypto, preview orders, and manage portfolios from any AI harness or the terminal.

## Get started

<Tip>
  **Portfolio isolation:** Create a separate [Advanced portfolio](https://www.coinbase.com/advanced-trade), 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.
</Tip>

<Tabs>
  <Tab title="MCP (Recommended)">
    The remote MCP connects directly to `https://agents.coinbase.com/mcp` via OAuth.

    ### Supported harnesses

    Remote MCP is available only to harnesses on an explicit allowlist.

    * **Supported:** ChatGPT, Grok, Perplexity Computer, Claude, and Claude Code
    * **Coming soon:** Codex
    * **Other or custom harnesses:** Use the <a className="link" href="/ai-agents/coinbase-for-agents/coinbase-mcp#cli">CLI</a>. To request support for a harness, reach out to us on [Discord](https://discord.com/invite/cdp).

    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 CLI setup below for the most consistent execution.

    <Tabs>
      <Tab title="ChatGPT">
        <Frame>
          <video controls className="w-full aspect-video" src="https://mintcdn.com/coinbase-prod/BvbOBhYodwO9uiuH/ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-chatgpt.mp4?fit=max&auto=format&n=BvbOBhYodwO9uiuH&q=85&s=b640d4d82b160631090c1be83527f9b2" data-path="ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-chatgpt.mp4" />
        </Frame>

        <Warning>
          **Prerequisite:** You must enable **developer mode** in ChatGPT before the "Create Plugin" option appears. Go to **Settings** > **Plugins** > **Advanced Settings** and toggle on developer mode.
        </Warning>

        1. Click your **profile icon** in the bottom-left corner
        2. Click **Settings** > **Plugins** > **Create Plugin**
        3. Name the plugin (e.g., "Coinbase") and set the connection URL to `https://agents.coinbase.com/mcp`
        4. Click **Create**
        5. Sign in with your Coinbase account when prompted

        <Info>
          **Desktop & mobile:** Set up the connection on ChatGPT web first. Once connected, the app will automatically be available in ChatGPT desktop and mobile.
        </Info>
      </Tab>

      <Tab title="Grok">
        <Frame>
          <video controls className="w-full aspect-video" src="https://mintcdn.com/coinbase-prod/BvbOBhYodwO9uiuH/ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-grok.mp4?fit=max&auto=format&n=BvbOBhYodwO9uiuH&q=85&s=9b8b3480a88b36f5a55e58b71a4b7122" data-path="ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-grok.mp4" />
        </Frame>

        1. Click the **Plugins** button in the bottom-left corner
        2. Search for **Coinbase**
        3. Click **Add**, then **Connect**
        4. Sign in with your Coinbase account

        <Info>
          **Using Grok Bot?** Grok Bot uses API keys instead of sign-in with Coinbase. Follow the <a className="link" href="/coinbase-for-agents/overview#cli">CLI setup</a> — or hand it to your Grok Bot.
        </Info>
      </Tab>

      <Tab title="Perplexity Computer">
        <Frame>
          <video controls className="w-full aspect-video" src="https://mintcdn.com/coinbase-prod/BvbOBhYodwO9uiuH/ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-perplexity-computer.mp4?fit=max&auto=format&n=BvbOBhYodwO9uiuH&q=85&s=326b4642e4fc81e3d9724a5d1fff759d" data-path="ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-perplexity-computer.mp4" />
        </Frame>

        <a className="not-prose mt-6 block w-full" href="https://www.perplexity.ai/computer/connectors?query=coinbase&connector=coinbase" target="_blank" rel="noopener noreferrer">
          <div className="not-prose flex w-full items-center justify-center gap-2 bg-[#1652F0] text-white rounded-lg px-6 py-3 font-semibold text-lg hover:bg-[#1544CC] transition-colors cursor-pointer">
            Add Coinbase to Perplexity Computer →
          </div>
        </a>

        Click the button above to add the Coinbase connector in one step, then sign in with your Coinbase account.

        <Accordion title="Manual setup (if the button doesn't work)">
          1. Click **Customize** in the left navigation
          2. Under **Connectors**, search for **Coinbase**
          3. Click **Add Connector**
          4. Sign in with your Coinbase account
        </Accordion>
      </Tab>

      <Tab title="Claude">
        <Frame>
          <video controls className="w-full aspect-video" src="https://mintcdn.com/coinbase-prod/BvbOBhYodwO9uiuH/ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-claude.mp4?fit=max&auto=format&n=BvbOBhYodwO9uiuH&q=85&s=61aad2bbb2e79b46d22b3fc5ba9274b9" data-path="ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-claude.mp4" />
        </Frame>

        <a className="not-prose mt-6 block w-full" href="https://claude.ai/new?modal=add-custom-connector&connectorName=Coinbase&connectorUrl=https%3A%2F%2Fagents.coinbase.com%2Fmcp#settings/customize-connectors" target="_blank">
          <div className="not-prose flex w-full items-center justify-center gap-2 bg-[#1652F0] text-white rounded-lg px-6 py-3 font-semibold text-lg hover:bg-[#1544CC] transition-colors cursor-pointer">
            Add Coinbase to Claude →
          </div>
        </a>

        Click the button above to add the Coinbase connector in one step. Then:

        1. Sign in with your Coinbase account when prompted
        2. On the approval screen, select which portfolios to give the agent access to

        <Accordion title="Manual setup (if the button doesn't work)">
          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, then 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
        </Accordion>

        <Warning>
          **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 CLI setup below, which executes most consistently across models.
        </Warning>
      </Tab>

      <Tab title="Claude Code">
        <Frame>
          <video controls className="w-full aspect-video" src="https://mintcdn.com/coinbase-prod/BvbOBhYodwO9uiuH/ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-claude-code.mp4?fit=max&auto=format&n=BvbOBhYodwO9uiuH&q=85&s=5be75476b04aa5a2bc317a5c70f7dc3a" data-path="ai-agents/coinbase-for-agents/resources/coinbase-mcp/videos/connect-claude-code.mp4" />
        </Frame>

        To configure Claude Code:

        1. Run `claude mcp add coinbase --transport http https://agents.coinbase.com/mcp`
        2. Start Claude. Run `/mcp`, then choose **coinbase** > **Authenticate**
        3. Once complete, Claude is ready to use your account
      </Tab>
    </Tabs>
  </Tab>

  <Tab id="cli" title="CLI">
    The CLI 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

    1. Go to [API Keys](https://portal.cdp.coinbase.com/api-keys/secret) 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**:
       * Under **Accounts**, select the portfolio you want the agent to trade from (Primary is selected by default). US Derivatives (Futures) only work in your **default** portfolio — include it in the key scope if the agent will trade US Derivatives (Futures).
       * 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.
    4. Click **Create & Download** and save the JSON key file

    <Warning>
      The key secret is only shown at creation time.
    </Warning>

    ### Manual setup

    If you prefer to set things up yourself instead of using the quickstart:

    **1. Install the CLI**

    ```bash theme={null}
    npm install -g @coinbase/coinbase-cli
    coinbase --version
    ```

    <Info>
      Node.js 22 or later is required.
    </Info>

    **Linux only**: install keyring support to keep secrets out of plaintext:

    ```bash theme={null}
    which secret-tool || sudo apt install -y libsecret-tools
    ```

    **2. Configure your API key**

    ```bash theme={null}
    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
    ```
  </Tab>
</Tabs>

<Info>
  To disconnect Coinbase from an app, go to [Coinbase Account > Security > Connections](https://accounts.coinbase.com/security/connections) and revoke the connection.
</Info>

***

## What's supported today

Coinbase for Agents currently supports:

* **Spot crypto trading**: buy and sell 900+ trading pairs on Coinbase Advanced Trade
* **US Derivatives (Futures)**: trade CFM dated futures contracts on Coinbase Advanced Trade
* **Equities**: trade S\&P 500 US stocks on Coinbase Advanced Trade
* **Isolated agent portfolios**: spot crypto only, scoped to a specific portfolio selected when logging in or creating an API key. US Derivatives (Futures) are available only in your default portfolio.
* **Portfolio management**: Check balances and positions across your account
* **USDC/USD conversions**: instant zero-fee conversions between USDC and USD

<Info>
  **Coming soon:** x402 payments for agent-consumed services (paywalled research, data APIs, compute), prediction markets, and additional asset classes. If it's on Coinbase, your agent will be able to trade it.
</Info>

***

## 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`.

***

## Tools

### 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                                             |

<Info>
  **Equities**: `products_ticker`, `products_book`, `products_candles`, and `products_best_bid_ask` aren't available for equities yet.
</Info>

### 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.

```bash theme={null}
# 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.

```bash theme={null}
coinbase orders create product_id=BTC-USD side=BUY type=limit \
  base_size=0.001 limit_price=50000
```

<Info>
  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).
</Info>

<Info>
  **Futures**: CFM dated futures market orders require `base_size` (number of contracts)—`quote_size` is rejected. Contract codes roll on a schedule (e.g. `BIT-28AUG26-CDE`); discover the live one with `coinbase products list product_type=FUTURE`. Preview the order first to check `predicted_liquidation_price`.
</Info>

<Info>
  **Equities**: use `TICKER-QUOTE` as the product ID (e.g. `AAPL-USD` or `AAPL-USDC`). Only S\&P 500 tickers are currently supported. Orders trade regular market hours by default; set `equity_trading_session` (`PRE_MARKET`, `AFTER_HOURS`, `OVERNIGHT`, or `MULTI_SESSION`) to trade outside them—each of those four sessions accepts only whole-share limit orders (market orders, `quote_size`, and fractional sizing are rejected).
</Info>

### 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        |

***

## 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](https://jqlang.github.io/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](https://portal.cdp.coinbase.com/api-keys/secret) |
| `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.
