Skip to main content
Glama
README.md
# @striderlabs/mcp-coinbase

MCP (Model Context Protocol) server for Coinbase crypto exchange. Provides browser-automated tools for live prices, portfolio management, transaction history, and trading.

## Tools

| Tool | Description |
|------|-------------|
| `get_prices` | Get current cryptocurrency prices from Coinbase |
| `get_portfolio` | Get your Coinbase portfolio balances and values |
| `get_transactions` | Get recent transaction history |
| `buy_crypto` | Place a buy order (with preview mode) |
| `sell_crypto` | Place a sell order (with preview mode) |
| `get_wallet_address` | Get your deposit address for a cryptocurrency |

## Installation

```bash
npm install -g @striderlabs/mcp-coinbase
npx playwright install chromium
```

Or from the tarball:

```bash
npm install -g striderlabs-mcp-coinbase-1.0.0.tgz
npx playwright install chromium
```

## Configuration

Set these environment variables before running:

```bash
export COINBASE_EMAIL="your@email.com"
export COINBASE_PASSWORD="yourpassword"
export COINBASE_2FA_CODE="123456"   # optional: TOTP code, or leave blank to enter manually
```

## Usage with Claude Desktop

Add to your `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "coinbase": {
      "command": "mcp-coinbase",
      "env": {
        "COINBASE_EMAIL": "your@email.com",
        "COINBASE_PASSWORD": "yourpassword"
      }
    }
  }
}
```

Or using `npx`:

```json
{
  "mcpServers": {
    "coinbase": {
      "command": "npx",
      "args": ["-y", "@striderlabs/mcp-coinbase"],
      "env": {
        "COINBASE_EMAIL": "your@email.com",
        "COINBASE_PASSWORD": "yourpassword"
      }
    }
  }
}
```

## Tool Reference

### `get_prices`

Get current spot prices for one or more cryptocurrencies.

```json
{
  "symbols": ["BTC", "ETH", "SOL"],
  "currency": "USD"
}
```

Returns live prices fetched from the Coinbase public API — no login required.

### `get_portfolio`

Get your full portfolio with balances and USD values. Requires login.

```json
{}
```

### `get_transactions`

Get recent transaction history.

```json
{
  "limit": 20
}
```

### `buy_crypto`

Place a buy order. Use `confirm: false` (default) to preview the order without executing.

```json
{
  "symbol": "BTC",
  "amount_usd": 100,
  "confirm": false
}
```

Set `confirm: true` to execute the trade.

### `sell_crypto`

Place a sell order. Use `confirm: false` (default) to preview.

```json
{
  "symbol": "ETH",
  "amount_crypto": 0.5,
  "confirm": false
}
```

### `get_wallet_address`

Get your deposit address for a cryptocurrency.

```json
{
  "symbol": "BTC"
}
```

## 2FA Handling

The server handles two-factor authentication gracefully:

- If `COINBASE_2FA_CODE` is set, it will be used automatically
- Otherwise, the server waits up to 60 seconds for you to complete 2FA in the browser
- The browser session is reused across tool calls to minimize repeated logins

## Browser Automation

This package uses [Playwright](https://playwright.dev/) with stealth mode (via `playwright-extra` + `puppeteer-extra-plugin-stealth`) to automate the Coinbase web interface. This approach:

- Works with Coinbase's standard web UI
- Handles dynamic page content
- Bypasses basic bot detection via stealth plugin

## Development

```bash
git clone https://github.com/markswendsen-code/mcp-coinbase
cd mcp-coinbase
npm install
npx playwright install chromium
npm run build
```

Run in dev mode (with tsx, no build step):

```bash
npm run dev
```

## Security Notes

- Never commit your Coinbase credentials to version control
- Use environment variables for all sensitive configuration
- The `confirm: false` default on buy/sell prevents accidental trades
- Review all trades carefully before setting `confirm: true`

## License

MIT

TDQS

A4.1/5.0

Scored across 6 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: portfolio, transactions, buy, sell, wallet address, and prices. There is no overlap or ambiguity between them.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern: get_ for reads, buy_/sell_ for actions. Naming is uniform and predictable.

Tool Count5/5

With 6 tools, the server is well-scoped for Coinbase operations. Each tool serves a clear function without redundancy or bloat.

Completeness4/5

Core account management and trading workflows are covered: viewing balances, history, prices, buying, selling, and getting deposit address. Minor gaps exist (e.g., cancel order, send crypto) but these are not critical for a basic trading server.

Maintenance

ActivityInactive
ResponsivenessNo issues