@coinbase/coinbase-cli
v0.0.1
Published
Coinbase for agents — CLI and MCP server for trading, wallets, payments, and onchain across the Coinbase platform
Readme
@coinbase/coinbase-cli
Coinbase for agents — CLI and MCP server for the Coinbase platform. Authenticate once, access every API from your terminal or AI agent.
Zero runtime dependencies — just Node.js 22+.
Install
npm install -g @coinbase/coinbase-cliQuick start
# 1. Set up your API key (get one at coinbase.com/settings/api)
coinbase env live --key-id <id> --key-secret <secret>
# 2. Make a request
coinbase products list
# 3. Explore available commands
coinbase --helpCommands
coinbase env — Manage API keys
Configure API keys once; all subsequent commands authenticate automatically.
coinbase env # list environments
coinbase env live --key-id <id> --key-secret <secret> # configure inline
coinbase env live --remove # remove an environmentMultiple API keys — prefix live to inherit its URL with a different key:
coinbase env live-team-a --key-id <id> --key-secret <secret> # inherits live URL
coinbase env live # switch back to live
coinbase products list -e live-team-a # one-off overrideCustom environment names that don't start with live require --url:
coinbase env custom --key-id <id> --key-secret <secret> --url https://api.coinbase.comcoinbase <resource> <action> — API operations
Commands are generated from the API spec. Run coinbase --help to see available resources and actions.
coinbase products list
coinbase products get product_id=BTC-USD
coinbase orders list
coinbase orders create product_id=BTC-USD side=BUY ...
coinbase balanceUse --template to see the expected request shape before writing, and --dry-run to preview without sending:
coinbase orders create --template # print request body template
coinbase orders create --dry-run # preview the assembled requestField syntax:
| Syntax | Meaning |
|---|---|
| key=value | String body field |
| key:=value | Raw JSON body field |
| key==value | Query parameter |
| a.b.c=value | Nested body field |
| @file.json | Body from file |
| - | Body from stdin |
| Header:value | Custom HTTP header |
Resource flags:
| Flag | Behavior |
|---|---|
| --template | Print request body template as JSON |
| --dry-run | Print request without sending |
| --edit | Open request body in $EDITOR |
| --jq <expr> | Filter JSON response (requires jq) |
| --paginate | Auto-follow pagination for full results |
| -e <env> | Use a specific environment |
coinbase history — Request history
View and manage a log of recent API requests made through the CLI.
coinbase history # show recent requests
coinbase history clear # clear request historycoinbase skills — Workflow skills
Manage reusable workflow skills (prompt templates) that extend the MCP server.
coinbase skills list # list available skills
coinbase skills add # install/update all bundled skills
coinbase skills add --dir <path> # install to a specific directory
coinbase skills remove # remove all installed skillsClaude Code / MCP
coinbase mcp starts an MCP server that gives AI agents typed tool access to every Coinbase API endpoint. Tools are generated from the spec — new endpoints appear automatically when the CLI updates.
In addition to API tools, the MCP server exposes meta-tools for environment and workflow management:
| Tool | Purpose |
|---|---|
| coinbase_set_env | Switch the active API environment |
| coinbase_env | Show current environment and key info |
| coinbase_help | Get usage help for CLI commands |
If you installed the CLI globally:
claude mcp add --scope user --transport stdio coinbase -- coinbase mcpMCP only (no global install needed — runs via npx):
claude mcp add --scope user --transport stdio coinbase -- npx -y @coinbase/coinbase-cli mcpIf you use both the CLI and MCP, install globally so they share the same version and spec.
Or add to your project's .mcp.json:
{
"mcpServers": {
"coinbase": { "transport": "stdio", "command": "coinbase", "args": ["mcp"] }
}
}Auto-approve read operations in .claude/settings.json:
{
"permissions": {
"allow": [
"mcp__coinbase__coinbase_env",
"mcp__coinbase__coinbase_help",
"mcp__coinbase__coinbase_*_list",
"mcp__coinbase__coinbase_*_get"
]
}
}Configuration
Environment variables override config file values:
| Variable | Purpose |
|---|---|
| COINBASE_ENV | Active environment name |
| COINBASE_KEY_ID | API key ID |
| COINBASE_KEY_SECRET | API key secret |
| COINBASE_URL | Base URL override |
| COINBASE_NO_HISTORY | Set to 1 to disable request history |
| COINBASE_CONFIG_DIR | Config directory (default: ~/.config/coinbase, %APPDATA%\coinbase on Windows) |
Keys and state are stored in config.json within the config directory.
Contributing
See CONTRIBUTING.md.
Security
See SECURITY.md.
