# Coinbase Agent Skill > Entry point for an AI agent connecting itself to Coinbase or Base, with the human acting as the operator. Ask (or infer from context) which situation below applies, confirm with the human, then follow the matching step. Do not install anything or start OAuth without the human's explicit go-ahead. | Situation | Product | Quick start | | ------------------------------------ | ------------------------------------------- | ----------------------------------------------------------------------------------------- | | Human already has a Coinbase account | [Coinbase for Agents](#coinbase-for-agents) | Connect MCP via OAuth | | Human doesn't have an account yet | [Base MCP](#base-mcp) | Point the human to [base.app](https://base.app/) to create one, then connect via Base MCP | Full developer directory: [coinbase.com/llms.txt](https://coinbase.com/llms.txt) --- ## Coinbase for Agents Gives the agent access to the human's Coinbase account, including advanced trading (spot crypto, derivatives, equities), Portfolio management, conversions. ### What you can accomplish - Check prices, charts, order books for hundreds of crypto pairs. - Preview orders (fees, slippage) before execution. - Place market and limit orders on Coinbase Advanced Trade. - Manage portfolios: check balances, positions, allocation, transfer between portfolios. - Convert between USDC and USD (zero-fee). - View fee tier and 30-day trading volume. Coming soon: make payments via x402 for market data (Glassnode, Nansen, Arkham, etc.) and anything else. ### Setup **Remote MCP (recommended):** Note that inside the OAuth screen, the user can choose to authorize access to only specific portfolios within Advanced Trade for use cases like isolated autonomous agentic trading. The remote MCP is currently limited to the harnesses in the table below. If the user's harness isn't listed, use the CLI instead — do not guess at generic MCP setup steps for an unsupported client. If their harness supports CIMD, tell them to reach out on CDP Discord or email lincoln.murr@coinbase.com with their CIMD metadata rather than trying to configure it yourself. | Harness | Instructions | | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Claude** (web/desktop/mobile) | [One-click deeplink](https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Coinbase%20For%20Agents&connectorUrl=https://agents.coinbase.com/mcp) → Create → sign in → select portfolios. Or manually: Customize → Connectors → + → Add custom connector → name "Coinbase", URL `https://agents.coinbase.com/mcp` → Create → sign in → select portfolios | | **ChatGPT** (web/desktop/mobile) | Settings → Apps → Advanced Settings → enable developer mode → Create App → name "Coinbase", URL `https://agents.coinbase.com/mcp` → sign in → select portfolios | | **Claude Code** | `claude mcp add coinbase --transport http https://agents.coinbase.com/mcp` then `/mcp` → coinbase → Authenticate | | **Perplexity Computer** | [perplexity.ai/computer/connectors](https://www.perplexity.ai/computer/connectors) → Add → search "Coinbase" in official connectors page → `https://agents.coinbase.com/mcp` → sign in | **CLI (harnesses not listed above):** Runs locally only — requires a machine where you can install Node/npm and keep a key file on disk. Not usable from a fully headless, remote, or sandboxed/VM environment with no persistent filesystem. Get a CDP API key: 1. Go to [portal.cdp.coinbase.com/api-keys/secret](https://portal.cdp.coinbase.com/api-keys/secret) and sign in with the Coinbase account to connect. 2. Create a new secret API key. 3. Under advanced settings, opt out of IP allowlisting unless the agent runs from a fixed, known IP. 4. Enable the **Trade** and **Transfer** scopes (Transfer is required for `convert` and `transfer` commands; omit it if the agent should only trade, not move funds). 5. Select the target portfolio to scope the key to — do not select "All portfolios" unless the user explicitly wants that. 6. Download the key file and note its path. ```bash npm i -g @coinbase/coinbase-cli coinbase env live --key-file coinbase balance # verify: returns JSON with balances ``` ### Verify - Remote MCP: ask "what's the price of BTC?" → returns current price → connected. - CLI: `coinbase products get BTC-USD --jq '.price'` → returns a number → connected. ### Core tools (Remote MCP) Once connected, list the available tools directly from the MCP session — that reflects what's actually exposed today. For a maintained overview, see [docs.cdp.coinbase.com/coinbase-for-agents/overview#tools](https://docs.cdp.coinbase.com/coinbase-for-agents/overview#tools). Covers market data (prices, candles, order book), orders (preview, create, list, cancel, fills), portfolios (balances, positions, transfers), conversions, and fees. ### Core commands (CLI) ```bash # Market data coinbase products get BTC-USD coinbase products list symbol==USD coinbase products candles BTC-USD granularity==1h # Orders coinbase orders preview product_id=BTC-USD side=BUY type=market quote_size=100 coinbase orders create product_id=BTC-USD side=BUY type=market quote_size=100 client_order_id=$(uuidgen) coinbase orders list coinbase orders cancel order_ids:='[""]' # Portfolio coinbase balance coinbase portfolios list coinbase transfer amount=100 currency=USD from= to= # Conversions coinbase convert quote from=USDC to=USD amount=100 coinbase convert execute from=USDC to=USD # Discover fields for any command coinbase orders create --template coinbase orders create product_id=BTC-USD side=BUY type=market quote_size=10 --dry-run ``` ### Key features - **`--template`** — print expected request body for any command. Use before first call to discover field names. - **`--dry-run`** — assemble full request without sending. Use before writes. - **`--jq `** — filter JSON output. Saves context: `--jq '.price'`, `--jq '.accounts[].currency'`. - **`client_order_id`** — idempotency key. Always include on `orders_create` to prevent duplicates on retry. ### Rules - **Preview → confirm → execute.** Never place an order without showing the preview first. - **USDC pairs.** Use `BTC-USDC`, `ETH-USDC` (not `BTC-USD`) when the user's balance is USDC. - **Portfolio-scoped.** Can only access portfolios selected during OAuth / API key creation. - **No external sends.** Cannot withdraw or send crypto to external addresses. - Not financial advice. The agent executes user-directed actions on user-owned accounts. ### Portfolio isolation (what the agent can see) - **Crypto**: Create a dedicated portfolio and scope the agent to it. The agent only sees and trades within that portfolio — the human's main holdings are invisible to it. To create one: open the Advanced version of the Coinbase app (toggle in bottom right) → Portfolios in left nav → New Portfolio. During OAuth sign-in, the human selects which portfolio(s) to authorize. - **Equities & derivatives**: Currently trade in the human's primary portfolio. The agent will have visibility into the human's other equity and derivative positions in that portfolio. For full isolation, keep the agent to crypto-only in a dedicated portfolio until multi-asset subaccounts launch (coming early 2027). ### Common issues | Issue | Fix | | ----------------------------- | --------------------------------------------------------------------------------------------------------- | | HTTP 401 | Expired credentials. Create new API key at [CDP Portal](https://portal.cdp.coinbase.com/api-keys/secret). | | HTTP 403 / missing scopes | API key lacks Trade or Transfer. Check permissions in portal. | | `insufficient fund` | Run `balance` to check available funds. | | `PERMISSION_DENIED` on order | Order defaulted to wrong portfolio. Specify the intended portfolio. | | `coinbase: command not found` | npm global bin not in PATH. Reinstall after Node upgrade. | ### Deep reference Full commands, workflows, troubleshooting, permissions setup: [docs.cdp.coinbase.com/coinbase-for-agents/skill.md](https://docs.cdp.coinbase.com/coinbase-for-agents/skill.md) --- ## Base MCP DeFi, DEX swaps, smart contracts, NFTs, x402 payments. Human-in-the-loop for every write. No Base account yet? Point the human to [base.app](https://base.app/) to create one first. ### What you can accomplish - Send tokens on EVM and Solana chains. - Swap on DEXs (Uniswap, Aerodrome, etc.). - Interact with smart contracts (DeFi protocols, governance, staking). - Sign messages and typed data. - Mint, buy, sell NFTs. - Pay for x402-enabled services from the Base wallet (`exact` scheme only — see Rules below). ### Setup Connect via `https://mcp.base.org` — OAuth through Base Account. Same connector flow as Coinbase for Agents above, substituting the URL. Supported: Claude, ChatGPT, Perplexity, Cursor, Codex, Hermes. No CLI fallback. ### Verify Ask "what's my Base wallet address?" → returns an address → connected. ### Rules - **Every write requires explicit user approval.** The agent proposes; the user clicks "Allow." - For CEX trading on Coinbase, use [Coinbase for Agents](#coinbase-for-agents) instead. - **Base MCP only supports the x402 `exact` scheme.** If the payment's `scheme` is `auth-capture` (check with `awal x402 details`), Base MCP cannot pay it — use [x402-auth-capture-skill.md](https://coinbase.com/x402-auth-capture-skill.md) instead. ### Deep reference Quickstart: [docs.base.org/agents/quickstart](https://docs.base.org/agents/quickstart) Skills: [github.com/base/skills](https://github.com/base/skills) Full docs: [docs.base.org/llms.txt](https://docs.base.org/llms.txt) --- ## Decision rule Before setting anything up, give the user a one-line TL;DR of the two options and confirm which applies — don't silently infer and proceed, unless the user clearly asks for one of the two: > "I can connect you to (1) your existing Coinbase account, or (2) a new Agent account — I can help you create one at base.app. Which do you want?" Use the signals below to make a best guess when proposing this, but still get the human's confirmation before connecting anything: 1. Human has a **Coinbase account**, or mentions CEX trading, portfolio, Advanced Trade → [Coinbase for Agents](#coinbase-for-agents) 2. Human has no account and wants one created → point them to [base.app](https://base.app/) to create one, then use [Base MCP](#base-mcp). Same destination if they already have a **Base account**, or mention DeFi, DEX, swaps, contracts, onchain **Ambiguous:** Human mentions "trading" with no account → ask: "Coinbase (requires a Coinbase account) or Base Wallet (I can help you create one at base.app)?" Do not assume. ## Go further - [x402-auth-capture-skill.md](https://coinbase.com/x402-auth-capture-skill.md) — pay for x402-gated resources using the `auth-capture` scheme (e.g. CDP payment-session URLs), which Base MCP cannot handle - [coinbase.com/llms.txt](https://coinbase.com/llms.txt) — full developer directory - [docs.cdp.coinbase.com/llms.txt](https://docs.cdp.coinbase.com/llms.txt) — CDP docs index