Skip to main content

Coinbase for Agents

Connect to Coinbase Advanced Trade to trade crypto, US equities, and derivatives, manage portfolios, and pay for trading data and research via x402 from your existing Coinbase USDC balance.

Setup

First identify which harness the user wants to connect. Use reliable environment context or ask if it is unknown; distinguish Claude from Claude Code and Grok from Grok Bot. Remote MCP with Coinbase OAuth is currently supported for these allowlisted harnesses: ChatGPT, Grok, Grok Bot, Muse, Perplexity Computer, Claude, and Claude Code. No CDP API key is needed for these. Reuse an existing authenticated Coinbase connection. Otherwise, follow Harness setup and present only the matching harness’s steps, connector link, and prerequisites. Use the documented connector when available; don’t build a custom connection or install the CLI. Reading this guide does not install or authorize a connector. If setup requires user interaction, provide the steps and wait for authentication before verifying access. For any other harness, or when the user explicitly requests it, use the local CLI with a CDP API key if the harness can run shell commands. If an unsupported harness cannot run the CLI, tell the user it is not yet supported and point them to CDP Discord to request support. Do not improvise another connection path or replace a working remote connection with a CLI installation.

Remote MCP

Server: https://agents.coinbase.com/mcp. Coinbase allowlists clients. Remote MCP supports Dynamic Client Registration (DCR) and Client ID Metadata Documents (CIMD); successful registration alone does not make a client supported or grant account access. Let the harness manage registration, Coinbase OAuth, and credential storage. If a supported harness fails to connect, report the error and request help through CDP Discord. For other harnesses, follow the CLI-or-unsupported guidance under Setup. Do not build a replacement OAuth flow, impersonate another client, or bypass access restrictions.

Harness setup

Follow the matching instructions below. The supported-harnesses documentation also includes setup videos. These inline steps are sufficient to guide setup without fetching another page. ChatGPT (web): Set up on ChatGPT web. Developer mode availability depends on your account and workspace policy; ask a workspace admin if it is unavailable. See OpenAI’s developer mode requirements for supported plans and permissions.
  1. Enable Developer mode: Settings > Security and login > turn on Developer mode.
  2. Open ChatGPT Plugins and select the + button.
  3. Enter a name (for example, “Coinbase”) and description. Under Connection, enter https://agents.coinbase.com/mcp.
  4. Create the connection and sign in with Coinbase when prompted.
  5. Start a new conversation and add the Coinbase connection from the tools menu.
Grok: Open Plugins in the bottom-left corner, search for Coinbase, choose Add > Connect, then sign in to Coinbase. Grok Bot: If the user already connected Coinbase in Grok, the connector should also appear in their Grok Bot account; check for it first. Otherwise, open Marketplace, search for Coinbase, choose Add, then sign in to Coinbase if prompted. Connectors are account-wide and available to all of the user’s Bots. Select a dedicated portfolio on the approval screen to limit Coinbase access. Muse: Reuse an existing connection to https://agents.coinbase.com/mcp if available. Otherwise, start Muse’s remote-MCP connection flow. Muse handles registration automatically and redirects the user to Coinbase login; the user does not need to obtain or enter a client ID or create a CDP API key. Have the user sign in on Coinbase and approve only the access needed for their request. If setup asks for a manually supplied client ID, stop and report that automatic registration was not reached rather than registering a client yourself. Perplexity Computer: Open Add Coinbase to Perplexity Computer, add the connector, then sign in to Coinbase. If the link does not 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.
Claude (web, desktop, mobile): Open Add Coinbase to Claude, then sign in with Coinbase and select which portfolios to give the agent access to. If the link does not work:
  1. Click the Customize toolbox icon in the left sidebar.
  2. Go to Connectors > click + > Add custom connector.
  3. Name it “Coinbase” and enter https://agents.coinbase.com/mcp.
  4. Leave all other fields blank, then click Create.
  5. Sign in with your Coinbase account when prompted.
  6. On the approval screen, select which portfolios to give the agent access to.
Claude Code:
  1. Run claude mcp add coinbase --transport http https://agents.coinbase.com/mcp.
  2. Start Claude Code, run /mcp, and choose coinbase > Authenticate.
  3. Complete the Coinbase sign-in and approval flow.
After the matching setup flow, use the checklist below to verify access.

First connection checklist

This guide is self-contained; you do not need a prompt from the docs page or a previous chat.
  1. Reuse an authenticated connection or complete the matching harness setup above. Let the harness manage MCP initialization, OAuth, and credential storage; do not replace working credential helpers with custom token handling.
  2. Let the harness discover supported OAuth scopes from the protected-resource metadata and request all scopes needed for the intended Coinbase capabilities. Do not limit scopes to read-only just because verification uses a portfolio-list call; honor an explicit read-only request. If authentication is needed, have the user sign in on Coinbase and approve the permissions and portfolios. Wait for them to finish. Never ask for passwords, one-time codes, authorization codes, or tokens in chat.
  3. Discover available Coinbase tools through the connected harness. Call the exposed coinbase_portfolios_list tool with an empty arguments object, using the exact tool name and schema the connection exposes. Check for tool and authorization errors; an empty portfolio list is a valid result. If no Coinbase tools are available after the matching setup flow, report that verification is blocked rather than claiming success or bypassing the connection with raw HTTP requests.
  4. Report that the connection was verified only after the read-only portfolio call succeeds. Granted OAuth permissions enable actions; execute trades, transfers, or paid requests only when the user requests or approves them.
Tool availability depends on the client and account eligibility; do not promise every tool in every harness. The dedicated ChatGPT trading integration excludes x402 payments.

Adopt this guide as a skill

Reading this URL supplies instructions for the current task; it does not install a skill or guarantee discovery in future chats. If the user asks to make it reusable, use the harness’s documented skill installation mechanism and confirm that the installed skill can be discovered. Do not assume a universal skills directory or auto-install on first contact. If the harness already generated a Coinbase connector skill, preserve its credential binding, runtime helpers, and tool-calling code. Add or link this guide as a reference using the harness’s supported mechanism; ask before replacing existing files. In particular, do not replace a harness credential broker with code that exposes real tokens to the model. For a harness that accepts standalone SKILL.md files, save the guide body with YAML frontmatter. The documentation site’s Markdown export can omit the source frontmatter. If it is missing, prepend the following header before the guide’s title and body; do not save only the header:
Record the actual source URL and retrieval date with the local copy. Use the same documentation origin as the page being tested; a preview page and the production guide can have different revisions. Recheck the source before refreshing a saved copy, preserve local integration code, and inspect current tools/list schemas. Do not treat an installed skill as a frozen API contract or permission to bypass the harness’s security rules.

Disconnect or remove local instructions

To revoke Coinbase access, the user can open Coinbase Account > Security > Connections and revoke the connection. The harness may also offer its own connector-disconnect action. If the agent is denied permission to disconnect, direct the user to the UI; do not bypass that boundary or claim revocation succeeded. Removing a local skill, deleting local credentials, and clearing chat memory are different from revoking Coinbase access. Ask for explicit authorization before deleting local files or memory, and do not promise to erase logs or backups. Reconnection needs fresh consent after access is revoked.

Local CLI (Cursor, Windsurf, Codex, and other coding agents)

Use this path for unsupported coding agents or an explicit request for the local CLI, not as a substitute for a supported remote connector. Install the Coinbase CLI; its x402 commands use the configured CDP API key to discover and pay for curated x402 resources:
Linux only: install keyring support to avoid plaintext secrets:
nvm/fnm users: Upgrading Node versions requires reinstalling global packages. After upgrading, open a new terminal and run npm i -g @coinbase/coinbase-cli again.

Authentication (CLI only)

Create a CDP API key and configure the CLI:
  1. Sign in to https://portal.cdp.coinbase.com/api-keys/secret (a project is auto-created on first sign-in)
  2. Click Create API Key
  3. Give it a name (e.g., my-trading-agent)
  4. Under Advanced Settings > Coinbase App & Advanced Trade:
    • Under Accounts, select the portfolio for the agent to trade from. 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 (View is enabled by default)
    • Check Opt out of IP allowlisting if you haven’t configured specific IP addresses, or set your IP range to allowlist them
  5. Click Create & Download and save the JSON key file

x402 Payments

Your agent can pay for premium services directly from your Coinbase USDC balance. The remote MCP uses OAuth; the local CLI uses a configured CDP API key. Services include onchain analytics, market intelligence, web research, and more.

x402 Tools

How x402 works

  1. Discover: Run coinbase x402 resources q==<keyword> or call coinbase_x402_resources. Read the resource URL, advisory price, and input schema; do not invent endpoints or parameters.
  2. Authorize: Establish a user-approved research budget before spending. A request to connect Coinbase or research a topic is not unlimited payment or trading authority.
  3. Fetch: Supply the catalog resource URL and flat resource parameters inside input (not a hand-built HTTP request). Set max_amount within the remaining budget, generate an idempotency_key UUID, and retain it before the call. Fetch handles a v2 challenge, payment, and the provider request.
  4. Report: Inspect paid, payment metadata, and data. Report provider, amount, and any data-delivery failure separately; cite only values returned by the source. Track total spend across calls. A trade requires its own authorization.
Key details:
  • Payments use USDC on Base only, with a 5 USDC per-payment cap. Other account and spending controls may apply.
  • For fetch, max_amount is optional and expressed in atomic USDC units (1000000 = 1 USDC). It tightens the catalog ceiling; it cannot raise that ceiling. A prompt budget is not a server-enforced session or daily limit.
  • Catalog prices are advisory. The live challenge supplies the exact price, bounded by the request ceiling and server limits. Stop and ask if the authorized budget is insufficient.
  • Fetch supports curated catalog URLs and x402 v2 only. Prefer it over manually constructing a payment.
  • For low-level pay, copy the actual challenge fields and use coinbase x402 pay --template or the MCP schema. Send the returned header as X-PAYMENT for v1 or PAYMENT-SIGNATURE for v2. Pay authorizes funds but does not retrieve the resource.
  • A timeout or unknown payment outcome is not proof of failure. Reuse the original idempotency_key for the same logical payment; omitting or changing it can create another hold. For terminal rejection, follow the error’s instructions before starting a new authorized attempt.
  • Do not claim native Sign-In-With-X (SIWX) support. If an endpoint requires a separate signing or asynchronous retrieval flow, verify that it is supported before paying; don’t repeatedly pay to work around missing authentication.
  • Settled payments are irreversible.

Available providers

Discover current resources and prices at runtime; do not hardcode prices from this skill.
  • Nansen: smart money flows and wallet intelligence
  • Arkham (Arkham x402): entity intelligence and wallet data
  • Glassnode: onchain metrics
  • Dripstack (Drip): market analysis
  • Exa: web search and content retrieval
  • You.com: web search
  • Massive: stock market data

x402 Workflows

Use these after establishing a research budget. Discover the matching resources first, stay within the remaining budget, and do not trade unless separately authorized. Smart money research:
Morning data brief:
On-chain analysis:

Core Commands

Market Data

Equity price lookup: Use products get or products list and read price when present. This is a reference price, not a guaranteed fresh or executable bid/ask quote. Do not infer equity market-data support from a successful product lookup; see the matrix below.

Product-type support and limitations

Use this routing matrix before planning a workflow. Tool names below omit the core MCP’s coinbase_ prefix; use the exact names and schemas returned by tools/list. FUTURE here means CFM dated futures, which require account approval. Discovery of a product does not establish that every endpoint supports it. These are routing rules, not a promise that every listed product/account supports every operation. Do not repeatedly call a rejected equity data endpoint, substitute crypto data, or change product identifiers to bypass a restriction. If price is missing or insufficiently current, report that a usable equity quote is unavailable. Paid research is a separate, user-authorized option—not an automatic fallback.

Equity sessions and order lifecycle

Use these rules for order planning, not as permission to trade:
  • NORMAL is regular market hours and the only session supporting market orders. The core MCP defaults resolved equity orders to NORMAL when no session is supplied.
  • PRE_MARKET, AFTER_HOURS, and OVERNIGHT target their named sessions; MULTI_SESSION spans multiple eligible sessions. These sessions accept whole-share limit orders, not market orders, fractional base_size, or quote_size. Verify the applicable session, trading calendar, and product eligibility rather than assuming weekdays or a fixed UTC window.
  • equity_order_date is the trade date (YYYY-MM-DD), not the order’s expiry or an agent scheduling instruction. end_time is an RFC 3339 timestamp with timezone for a GTD order.
  • For extended-session planning, specify the intended session, trade date, whole-share base_size, limit price, time_in_force=GTD, and end_time. The ChatGPT trading flow validates this set. Check the selected surface’s schema before submission: the core MCP’s current orders_preview does not expose time_in_force or end_time, and equity session/date fields can be disabled for an account. Do not assume a preview validated an expiry it could not accept.
  • Market or quote-sized equity orders can be rejected outside normal hours. Do not assume they queue for the next open. Report the rejection; ask before changing the session, order type, sizing, or execution time.
  • An equity preview may fail with API order preview is not available for equities products. Report the missing estimate rather than retrying it or calling orders_create as a test. If the user required a preview before execution, stop. An explicitly authorized order without a preview still needs the applicable equity checks.
  • A returned order ID is not a fill. Read orders_get/orders_list and fills to distinguish accepted/open, filled, canceled, or rejected states. Inspect per-order cancellation results; don’t treat an HTTP success as proof of cancellation.
A weekly rebalance needs a separately authorized schedule and trading policy. Connection setup and a refresh token do not authorize recurring trades. Decide with the user what to do on a holiday, halt, closed session, missing quote, unavailable preview, or expired consent; don’t silently submit a different order.

Orders

Portfolios & Balances

Conversions

Info & Session

Agent-Critical Flags

Use these flags on any command. They are the most important features for safe, efficient agent operation.

Field syntax

Workflows

1. Check price and preview a trade

2. Sell an asset

3. Transfer funds between portfolios

4. Convert USDC to USD (or vice versa)

5. Discover field names for any command

6. Filter large result sets

Local MCP Server Setup

The CLI includes an MCP server that exposes every command as a typed tool. If using MCP, the tool schemas are your primary reference (they include full field descriptions and enums). Claude Code:
Other agents: add to your MCP config:
Codex users: Default sandbox can’t access OS keychain. Either prompt Codex for “elevated access” or use the MCP server instead of direct CLI commands.

Install agent skills

Install skills so the agent has step-by-step guidance for common Coinbase workflows (trading, market data, watch, convert, portfolios):
If non-interactive, pass the skills directory explicitly:
Skills auto-update on future npm install -g @coinbase/coinbase-cli upgrades.

Gotchas

  • Products list returns hundreds of items. Use symbol==USD to filter by currency, or --jq for custom filters.
  • client_order_id prevents duplicate orders. If your connection drops mid-request, retrying with the same client_order_id returns the existing order instead of creating a new one. Always generate one per order attempt.
  • Futures orders need base_size, not quote_size. CFM dated-futures market orders reject quote_size — use base_size (number of contracts). They’re available only in your default portfolio, so configure the API key to include that portfolio; a key scoped only to an isolated agent portfolio cannot place futures orders. Preview the order first and read back predicted_liquidation_price.
  • Equities use TICKER-QUOTE product IDs, such as AAPL-USD or AAPL-USDC. Discover eligible tickers rather than assuming a fixed index list. Read product-type limitations and equity session rules before planning an equity order.
  • nvm/fnm users: Upgrading Node versions requires reinstalling global packages. After upgrading, open a new terminal and run npm i -g @coinbase/coinbase-cli again.
  • USDC pairs: When buying crypto with a USDC balance, use USDC pairs (e.g., BTC-USDC not BTC-USD). The agent may default to USD pairs otherwise.
  • x402 routing: Explicitly tell the agent “use x402 fetch to…” or “you have authorization to pay for this data” so it routes to the correct tool.

Troubleshooting

Remote MCP integration reference

This section describes the OAuth and MCP protocol handled by the harness. It is a reference, not another setup path: connect through a supported harness’s remote MCP flow or use the local CLI. Let the harness perform registration, authorization, token management, and transport; do not implement a replacement client during onboarding.

OAuth endpoints and discovery

Let the harness discover the OAuth endpoints and manage registration, sign-in, and credentials. The endpoints below are for reference; do not manually register clients, construct authorization URLs, or exchange tokens during setup. The issuer is https://login.coinbase.com/. Public clients using token_endpoint_auth_method: "none" and PKCE are supported. Use the authorization-code flow with code_challenge_method=S256, not an implicit flow or an embedded client secret. Coinbase-side DCR allowlisting still applies.

Register and authorize

The harness performs these steps internally; they are not manual onboarding steps for the agent or user.
  1. Reuse the approved client registration. If the harness needs DCR, POST its real client metadata as JSON to the registration endpoint. Include its client_name, exact redirect_uris, response_types: ["code"], grant_types: ["authorization_code", "refresh_token"], and token_endpoint_auth_method: "none" for a public client. Use only a callback the harness controls. Save the returned client_id securely rather than registering again each run. Do not put resource in the DCR JSON; it belongs on authorization and token requests.
  2. Request consent. Generate a fresh cryptographically random state and PKCE verifier; derive the S256 challenge. Open the authorization endpoint in the user’s browser with the fields below. The user signs in on Coinbase and chooses the permissions/portfolios to approve.
  3. Exchange the code. At the registered callback, verify state before accepting the code. POST a form-encoded token request using grant_type=authorization_code, client_id, the same redirect_uri, code, code_verifier, and resource=https://agents.coinbase.com/mcp. Public clients registered with none do not send a client secret.
  4. Store and refresh securely. Keep tokens in the harness’s credential store, never in model-visible logs, prompts, source files, or chat. Use the returned expires_in; request offline_access if continued access needs a refresh token. Refresh at the token endpoint with grant_type=refresh_token, client_id, refresh_token, and the same resource identifier. Atomically save replacement tokens and serialize refresh attempts; do not keep reusing a rotated refresh token. Reconnect if consent is revoked or refresh fails permanently.
Authorization request fields (URL-encode each value):
Always send resource on authorization and token requests. The MCP authorization specification requires it. A flow that happens to succeed without it is not a supported compatibility guarantee; do not implement omission as the default.

Scope reference

The protected-resource metadata advertises these scopes. Add offline_access to request a refresh token; it is advertised by the authorization server, not the MCP resource’s mcp:* list. Do not use the literal wildcard mcp:*.

Verify the connection

The harness uses Streamable HTTP transport. The following messages illustrate the protocol it handles, not requests for the agent to send manually. Each message is sent in order as its own POST to https://agents.coinbase.com/mcp, using:
First initialize with a protocol version the client supports (this example uses 2025-06-18):
Validate the negotiated protocolVersion from the result. Include it as the MCP-Protocol-Version header on subsequent requests. If a server returns Mcp-Session-Id, retain and send it too; don’t require or invent a session ID when none is returned. Then send the initialized notification (no JSON-RPC id):
List tools and follow any nextCursor with params.cursor:
Use the exact tool name and input schema returned by tools/list. The core MCP portfolio-list tool is coinbase_portfolios_list; after confirming it is exposed, make this call:
Success means initialization and tool discovery succeeded and the portfolio call returned a valid result with no JSON-RPC error or tool isError. An empty portfolio list can still be a successful connection. HTTP 200 alone is not enough. Tell the user which connection was verified without dumping account details.

Rate limits and connection failures

This guide does not specify a numeric remote-MCP request quota. Do not assume an Advanced Trade REST or WebSocket limit is the MCP limit. Cache product metadata, avoid tight polling, bound retries, and stagger recurring reads. --watch belongs to the local CLI’s WebSocket path; it is not a remote-MCP subscription.
  • HTTP 429 or a rate-limit tool error: honor Retry-After when present; otherwise use bounded exponential backoff with jitter. Reduce concurrency instead of retrying continuously.
  • HTTP 401: let the harness refresh the connection or ask the user to reconnect through its Coinbase OAuth flow. Do not handle tokens or register a new OAuth client yourself.
  • Missing scopes: ask the user to reconnect and approve the required permissions. A working tools/list does not prove every tool call is authorized.
  • Registration or authorization denied: if the harness is not listed under Setup, follow the CLI-or-unsupported guidance there. For a supported harness, report the error and request help through CDP Discord. Do not switch to manual registration or bypass access restrictions.
  • Unsupported product/session or unavailable tool: use the product guidance and current schema; don’t change the product, session, or order type without authorization.
  • Unknown write outcome: inspect order/payment state and preserve the original idempotency key before considering a retry. Connection setup never requires a write.