> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kraken.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Expose all Kraken CLI commands as tools for AI agents via the built-in Model Context Protocol server

kraken-cli ships a built-in [Model Context Protocol](https://modelcontextprotocol.io) server over stdio. It exposes all 151 CLI commands as structured tools that any MCP-compatible AI agent can call — Claude, Cursor, GitHub Copilot, Windsurf, and others.

The MCP server is part of the CLI binary. [Install the CLI](/home/cli) first.

## Quickstart

```bash theme={null}
kraken mcp
```

This starts the server with the default safe service set: `market` (public data), `account` (read-only), and `paper` (paper trading). No credentials required for market and paper.

## Client setup

<Tabs>
  <Tab title="Claude Code">
    Run once to register the server for your user:

    ```bash theme={null}
    claude mcp add --scope user kraken -- kraken mcp -s market,account,paper
    ```

    For all services including live trading:

    ```bash theme={null}
    claude mcp add --scope user kraken -- kraken mcp -s all
    ```

    Verify it is registered:

    ```bash theme={null}
    claude mcp list
    ```
  </Tab>

  <Tab title="Claude Desktop">
    Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

    ```json theme={null}
    {
      "mcpServers": {
        "kraken": {
          "command": "kraken",
          "args": ["mcp", "-s", "market,account,paper"]
        }
      }
    }
    ```

    Restart Claude Desktop to pick up the change.
  </Tab>

  <Tab title="Cursor">
    Create or edit `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` in your project:

    ```json theme={null}
    {
      "mcpServers": {
        "kraken": {
          "command": "kraken",
          "args": ["mcp", "-s", "market,account,paper"]
        }
      }
    }
    ```

    Reload the Cursor window after saving.
  </Tab>

  <Tab title="VS Code (Copilot)">
    Create or edit `.vscode/mcp.json` in your workspace:

    ```json theme={null}
    {
      "servers": {
        "kraken": {
          "type": "stdio",
          "command": "kraken",
          "args": ["mcp", "-s", "market,account,paper"]
        }
      }
    }
    ```
  </Tab>

  <Tab title="Windsurf">
    Edit `~/.codeium/windsurf/mcp_config.json`:

    ```json theme={null}
    {
      "mcpServers": {
        "kraken": {
          "command": "kraken",
          "args": ["mcp", "-s", "market,account,paper"]
        }
      }
    }
    ```

    Restart Windsurf to apply.
  </Tab>
</Tabs>

## Services

Pass `-s <services>` to control which command groups are exposed. Multiple services are comma-separated.

| Service         | Auth  | Risk level | What it exposes                                   |
| :-------------- | :---- | :--------- | :------------------------------------------------ |
| `market`        | No    | None       | Ticker, orderbook, trades, OHLC, spreads          |
| `account`       | Yes   | Read-only  | Balances, open orders, trade history, positions   |
| `paper`         | No    | None       | Spot paper trading (live prices, no real capital) |
| `futures-paper` | No    | None       | Futures paper trading                             |
| `trade`         | Yes   | Dangerous  | Place, amend, and cancel live Spot orders         |
| `futures`       | Mixed | Dangerous  | Futures order entry and market data               |
| `earn`          | Yes   | Dangerous  | Staking allocations and deallocations             |
| `funding`       | Yes   | Dangerous  | Withdrawals and transfers                         |
| `subaccount`    | Yes   | Dangerous  | Subaccount creation and transfers                 |
| `auth`          | No    | Read-only  | Credential validation                             |
| `all`           | Mixed | Mixed      | All of the above                                  |

**Default** (no `-s` flag): `market`, `account`, `paper`.

### Dangerous tools

Tools marked dangerous (order placement, withdrawals, transfers) require the calling agent to pass `acknowledged: true` in the tool input unless the server was started with `--allow-dangerous`. This gives you a confirmation gate at the tool level without relying on the agent's judgment alone.

```bash theme={null}
# Require per-call acknowledgement for dangerous tools
kraken mcp -s all

# Disable the acknowledgement gate (use in trusted, controlled environments only)
kraken mcp -s all --allow-dangerous
```

## Authentication

Set credentials as environment variables before starting the server:

```bash theme={null}
export KRAKEN_API_KEY="your-key"
export KRAKEN_API_SECRET="your-secret"
kraken mcp -s market,account,trade
```

Or use the CLI config file (set up once with `kraken setup`). The server inherits credentials from the CLI's standard resolution order.

## What agents can do

With the default safe service set, an agent can:

* Query live prices, orderbooks, and recent trades for any pair
* Check account balances and open orders
* Place and cancel paper trades against live prices
* Stream real-time market data

With `trade` added, an agent can place, amend, and cancel live orders. With `funding`, it can initiate withdrawals. Scope services to the minimum your workflow requires.

## Safety notes

* The MCP server runs locally over stdio and is not exposed as a network service
* Use minimum-permission API keys scoped to what the agent actually needs
* The default service set (`market`, `account`, `paper`) is read-only for live funds
* Treat agent sessions with live trading scope the same as a logged-in user session
* Set position size limits and pair allowlists at the API key level on Kraken's settings page

## Agent resources

The CLI ships supplementary resources for agent integration:

| Resource                    | Purpose                                                          |
| :-------------------------- | :--------------------------------------------------------------- |
| `AGENTS.md`                 | Full integration guide with patterns and constraints             |
| `CONTEXT.md`                | Runtime context injected at session start                        |
| `agents/tool-catalog.json`  | All 151 commands with parameter schemas in machine-readable form |
| `agents/error-catalog.json` | 9 error categories with retry guidance                           |
| `skills/`                   | 50 pre-built workflow packages for common trading tasks          |
| `CLAUDE.md`                 | Claude-specific guidance for the CLI                             |
