Skip to main content
@coinbase/cdp-cli is a CLI and MCP server for the CDP API. It handles authentication, provides inline documentation for every endpoint, and exposes the full API surface as typed tools for AI agents.

Auth-transparent

Configure credentials once per environment. The CLI handles JWT signing for every request.

AI-native

Doubles as an MCP server with bundled agent skills. New API features become available the moment the CLI updates.

Inline schema discovery

Every command has built-in help with fields, types, and examples.

Zero dependencies

A single ESM bundle on Node.js 22+. Zero runtime dependencies.

Get started

The fastest way to get started is to point your AI agent at the setup instructions. Copy this into Claude Code, Cursor, Codex, or any coding agent:
Your agent will install the CLI, walk you through API key creation, and verify the connection.
The skill file is a machine-readable guide that teaches agents how to install, authenticate, and use the CLI. It covers every command and common workflows.

Manual install

If you prefer to set things up yourself:

1. Install the CLI

Node.js 22 or later is required.

2. Create a CDP API key

  1. Go to API Keys in the CDP Portal. Sign in (a project is auto-created on first sign-in).
  2. Click Create API Key → download the JSON key file. The key secret is only shown at creation time.

3. Configure the environment

Verify it works:
An empty project returns {"accounts":[]}. This is expected.

4. Add a wallet secret

The wallet secret is a separate credential required for any operation that touches private keys (creating accounts, signing, sending). Generate one in the Non-custodial Wallet section of the Portal. Look for Generate Wallet Secret, then download the file.
Run cdp env to verify. live should appear with the key ID and a (wallet) indicator.

5. Create an account and send a transaction

Non-custodial wallet accounts are network-agnostic. The same address works on any EVM network (Base, Ethereum, Arbitrum, etc.). The network is specified when sending a transaction.
A transactionHash appears in the response. Your first on-chain transaction is complete.

What’s available

Run cdp to see the current resources and commands. EVM Accounts and Solana Accounts: create accounts, sign messages and transactions, send using the encode-sign-send pipeline, manage smart accounts (ERC-4337), and execute token swaps. Onchain Data: token balances, SQL queries against indexed chain data, and webhook subscriptions for on-chain event monitoring. Policy Engine: accept/reject rules by value, address, or network, attachable to any account. End User Accounts, Onramp, and x402: self-custodial wallets for end users, fiat-to-crypto onramp via Coinbase, and payments over the x402 protocol. Client-side utilities: transaction encoding and decoding, ABI encoding, and key encryption. These run locally with no network calls.

Already using the CDP SDK?

The CLI complements the SDK for workflows where a command is faster than writing code:
  • Ad-hoc operations: create an account, check a balance, or fund a testnet wallet without opening an editor
  • Debugging: decode a raw transaction with cdp util tx-decode, inspect request and response headers with cdp api -v
  • Exploration: browse every endpoint with cdp api, preview request shapes with --template, iterate with --edit
  • AI agents: the MCP server exposes every CDP operation as a typed tool
The CLI is self-documenting. Run cdp evm --help to see all actions, or cdp evm accounts create --help to see fields and examples for a specific action.

Commands

Every resource action (cdp <resource> <action>) follows the same workflow.

Discover

Compose

Preview

Send and filter

Reuse

The CLI saves the last successful request body per environment and action. On the next run, omit unchanged fields:
View or clear saved history with cdp history:

Global flags

These flags work on any command:

Field syntax


How it works

Auth and environments

The CLI uses two credentials, each serving a different purpose: Both are stored in the OS keyring and used to generate short-lived JWTs for every request. Read-only operations like listing accounts or checking balances only need the API key. The wallet secret is additionally required whenever the request touches private key material.

Environments

An environment is a named credential set. The built-in live environment has the CDP API URL pre-configured. Only keys need to be supplied.
Multiple keys: Prefix live with any name to create additional environments that inherit live’s URL:
Custom environment names that don’t start with live require --url:

Headless / environment variable configuration

As an alternative to cdp env, the CLI can be configured entirely through environment variables. This is useful when secrets are managed externally (Vault, AWS Secrets Manager, etc.) or in headless environments without an OS keyring:

The encode-sign-send pipeline

Sending a transaction is a three-step process: encode an unsigned transaction locally, sign it with the account’s private key in the Trusted Execution Environment (TEE), and send it to the network.

EVM

For ERC-20 transfers, use abi-encode to build the calldata:

Solana

Smart accounts

Smart accounts (ERC-4337) use user operations instead of the encode-sign-send pipeline:

cdp api

Browse the embedded API spec or make raw authenticated requests:
Same field syntax as resource commands, plus Header:value for custom HTTP headers.

Client-side utilities

cdp util commands run locally. See cdp util <command> -h for full options.

Agent skills

Bundled skills teach AI agents complete workflows. Install them with cdp skills add.
Skills cover: account creation and funding, the encode-sign-send pipeline, signing, import/export, smart accounts, spend permissions, token swaps, data queries, policies, end users, onramp, Solana, and x402.

MCP server

The cdp mcp command starts an MCP (Model Context Protocol) server that exposes every CDP API operation as a typed tool. Any MCP-compatible agent can call these tools directly, with no manual API wiring needed. Tools are generated dynamically from the embedded OpenAPI spec, so new endpoints appear automatically whenever the CLI updates. All tool names are prefixed with cdp_ and mirror the nested resource structure using underscores (e.g. cdp_evm_accounts_create, cdp_evm_accounts_sign_message). In addition to API tools, bundled skills walk agents through complete workflows like account creation, the encode-sign-send pipeline, and token swaps. Install them with cdp skills add.

Setup

Claude Code

With the CLI installed globally:
MCP only (no global install needed, runs via npx):
When using both the CLI and MCP, install globally so they share the same version and spec.

Project-scoped setup

To enable the MCP server for a single project, add it to the project’s .mcp.json:

Other MCP-compatible agents

Add the server to the agent’s MCP configuration (format varies by agent):

Available tools

Start any write operation with cdp_template. It returns the full request shape with field documentation and examples, which reduces back-and-forth guessing field names.

Permissions

By default, Claude Code prompts before calling any MCP tool. To auto-approve read operations while requiring confirmation for writes, add the following to .claude/settings.json:
This auto-approves cdp_env, cdp_help, cdp_template, list, and get operations. All mutating operations (create, update, delete, sign, send) still require confirmation.

Troubleshooting