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.- Enable Developer mode: Settings > Security and login > turn on Developer mode.
- Open ChatGPT Plugins and select the + button.
- Enter a name (for example, “Coinbase”) and description. Under Connection, enter
https://agents.coinbase.com/mcp. - Create the connection and sign in with Coinbase when prompted.
- Start a new conversation and add the Coinbase connection from the tools menu.
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:
- Click Customize in the left navigation.
- Under Connectors, search for Coinbase.
- Click Add Connector.
- Sign in with your Coinbase account.
- Click the Customize toolbox icon in the left sidebar.
- Go to Connectors > click + > Add custom connector.
- Name it “Coinbase” and enter
https://agents.coinbase.com/mcp. - Leave all other fields blank, then click Create.
- Sign in with your Coinbase account when prompted.
- On the approval screen, select which portfolios to give the agent access to.
- Run
claude mcp add coinbase --transport http https://agents.coinbase.com/mcp. - Start Claude Code, run
/mcp, and choose coinbase > Authenticate. - Complete the Coinbase sign-in and approval flow.
First connection checklist
This guide is self-contained; you do not need a prompt from the docs page or a previous chat.- 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.
- 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.
- Discover available Coinbase tools through the connected harness. Call the exposed
coinbase_portfolios_listtool 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. - 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.
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: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; itsx402 commands use the configured CDP API key to discover and pay for curated x402 resources:
npm i -g @coinbase/coinbase-cli again.
Authentication (CLI only)
Create a CDP API key and configure the CLI:- Sign in to https://portal.cdp.coinbase.com/api-keys/secret (a project is auto-created on first sign-in)
- Click Create API Key
- Give it a name (e.g.,
my-trading-agent) - 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
- 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
- Discover: Run
coinbase x402 resources q==<keyword>or callcoinbase_x402_resources. Read the resource URL, advisory price, and input schema; do not invent endpoints or parameters. - 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.
- Fetch: Supply the catalog
resourceURL and flat resource parameters insideinput(not a hand-built HTTP request). Setmax_amountwithin the remaining budget, generate anidempotency_keyUUID, and retain it before the call. Fetch handles a v2 challenge, payment, and the provider request. - Report: Inspect
paid, payment metadata, anddata. 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.
- Payments use USDC on Base only, with a 5 USDC per-payment cap. Other account and spending controls may apply.
- For fetch,
max_amountis 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 --templateor the MCP schema. Send the returned header asX-PAYMENTfor v1 orPAYMENT-SIGNATUREfor 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_keyfor 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: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’scoinbase_ 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:NORMALis regular market hours and the only session supporting market orders. The core MCP defaults resolved equity orders toNORMALwhen no session is supplied.PRE_MARKET,AFTER_HOURS, andOVERNIGHTtarget their named sessions;MULTI_SESSIONspans multiple eligible sessions. These sessions accept whole-share limit orders, not market orders, fractionalbase_size, orquote_size. Verify the applicable session, trading calendar, and product eligibility rather than assuming weekdays or a fixed UTC window.equity_order_dateis the trade date (YYYY-MM-DD), not the order’s expiry or an agent scheduling instruction.end_timeis an RFC 3339 timestamp with timezone for aGTDorder.- For extended-session planning, specify the intended session, trade date, whole-share
base_size, limit price,time_in_force=GTD, andend_time. The ChatGPT trading flow validates this set. Check the selected surface’s schema before submission: the core MCP’s currentorders_previewdoes not exposetime_in_forceorend_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 callingorders_createas 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_listand 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.
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:Install agent skills
Install skills so the agent has step-by-step guidance for common Coinbase workflows (trading, market data, watch, convert, portfolios):npm install -g @coinbase/coinbase-cli upgrades.
Gotchas
- Products list returns hundreds of items. Use
symbol==USDto filter by currency, or--jqfor custom filters. client_order_idprevents duplicate orders. If your connection drops mid-request, retrying with the sameclient_order_idreturns the existing order instead of creating a new one. Always generate one per order attempt.- Futures orders need
base_size, notquote_size. CFM dated-futures market orders rejectquote_size— usebase_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 backpredicted_liquidation_price. - Equities use
TICKER-QUOTEproduct IDs, such asAAPL-USDorAAPL-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-cliagain. - USDC pairs: When buying crypto with a USDC balance, use USDC pairs (e.g.,
BTC-USDCnotBTC-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.- 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, exactredirect_uris,response_types: ["code"],grant_types: ["authorization_code", "refresh_token"], andtoken_endpoint_auth_method: "none"for a public client. Use only a callback the harness controls. Save the returnedclient_idsecurely rather than registering again each run. Do not putresourcein the DCR JSON; it belongs on authorization and token requests. - Request consent. Generate a fresh cryptographically random
stateand 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. - Exchange the code. At the registered callback, verify
statebefore accepting the code. POST a form-encoded token request usinggrant_type=authorization_code,client_id, the sameredirect_uri,code,code_verifier, andresource=https://agents.coinbase.com/mcp. Public clients registered withnonedo not send a client secret. - 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; requestoffline_accessif continued access needs a refresh token. Refresh at the token endpoint withgrant_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.
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 tohttps://agents.coinbase.com/mcp, using:
2025-06-18):
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):
nextCursor with params.cursor:
tools/list. The core MCP portfolio-list tool is coinbase_portfolios_list; after confirming it is exposed, make this call:
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-Afterwhen 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/listdoes 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.