Skip to main content
Glama
mcp-kraken

mcp-kraken

mcp-kraken

License: MIT test release dev image CodeQL pages GHCR PyPI Python Downloads uv Ruff Checked with mypy

WARNING

Alpha software. Interfaces and defaults may change in any minor release until v1.0. No liability for any financial loss, missed trades or misrouted withdrawals. Not financial advice. Not affiliated with Kraken or Payward Inc. See the full Disclaimer below before granting the server credentials with trading or withdrawal permissions.

An MCP server that exposes the Kraken cryptocurrency exchange Spot REST API over HTTP, secured with bearer tokens you manage locally.

  • Full Kraken Spot REST surface, mapped to typed MCP tools.

  • Proactive API-key permission detection — calls that the key cannot perform are rejected before they leave the box, with a clear error.

  • Built-in token CLI: generate, list, and revoke bearer tokens used by HTTP clients to authenticate against the MCP itself.

  • GET /health liveness probe — no credentials required; safe for Docker healthchecks, Kubernetes probes, and load-balancer pings.

  • Single-process, stateless beyond the SQLite token store; ready for containerised deployment behind a reverse proxy.

WebSocket v2 and FIX transports are explicitly out of scope for the first release — see TODO.md.

Architecture

┌────────────┐    HTTPS / bearer    ┌───────────────┐    HMAC-signed    ┌─────────┐
│ MCP client │ ───────────────────▶ │  mcp-kraken   │ ─────────────────▶│ Kraken  │
│ (Claude…)  │ ◀─────────────────── │  FastMCP HTTP │ ◀───────────────  │ REST v0 │
└────────────┘                      └───────────────┘                   └─────────┘
                                          │
                                          ▼
                                   SQLite (bearer-token hashes)

Two authentication boundaries:

Boundary

Mechanism

MCP client → mcp-kraken (you control)

Opaque bearer tokens (SHA-256)

mcp-kraken → Kraken (you control)

KRAKEN_API_KEY + HMAC signature

Related MCP server: mcp-orbit-kraken

Requirements

  • Python >=3.12

  • uv for dependency management

  • just for the dev command runner (optional)

  • A Kraken Spot API key — generate one in Account → Security → API. The permissions you enable on the key directly determine which MCP tools succeed (see Permissions below).

Quick start

# Clone and install
git clone https://github.com/XavierBeheydt/mcp-kraken.git
cd mcp-kraken
uv sync --dev

# Configure
cp .env.example .env
$EDITOR .env  # set KRAKEN_API_KEY and KRAKEN_API_SECRET

# Issue a bearer token for your MCP client
uv run mcp-kraken token create "claude-desktop" --expires-in 90d
# → copy the printed token; it will never be shown again

# Start the HTTP server (defaults to 0.0.0.0:8765/mcp)
uv run mcp-kraken serve

Point your MCP client at http://localhost:8765/mcp/ and authenticate with the bearer token. Two methods are supported:

Method

When to use

Authorization: Bearer mck_… header

Preferred — token stays out of URLs and logs

?apikey=mck_… query parameter

Fallback for clients that cannot set custom headers (e.g. Claude Desktop remote connector)

The server strips ?apikey= from the URL before forwarding to the MCP layer, and redacts it from access logs (apikey=***).

CLI

mcp-kraken serve              # run the HTTP server
mcp-kraken token create NAME  # mint a new bearer token (printed once)
mcp-kraken token list         # list known tokens (hashes only)
mcp-kraken token revoke ID    # revoke a token by id
mcp-kraken version            # print the installed version

token create accepts --expires-in 90d (or 12h, 30m, 3600 seconds). Omit it for a token that never expires. The full plaintext is only shown once at creation — the server only stores the SHA-256 hash plus the short id.

Local testing with Claude Desktop

Claude Desktop accepts MCP servers either as a remote HTTPS connector or as a local command (stdio). Pure self-signed certs are rejected — the cert has to be signed by a CA the OS trusts.

Option A — HTTPS via mkcert (Custom Connector)

mkcert creates a local CA, installs it into the system trust store, and signs certs from it.

brew install mkcert            # or your package manager's equivalent
just cert-local                # mkcert -install + generates certs/{key,cert}.pem
just serve-https               # serves HTTPS on 0.0.0.0:8765/mcp

Then in Claude Desktop: Settings → Connectors → Add custom connector, with URL https://localhost:8765/mcp/ and the bearer token from mcp-kraken token create.

Tip — Claude Desktop cannot set custom headers. If the connector UI has no "Authorization header" field, append the token as a query param instead: https://localhost:8765/mcp/?apikey=mck_…
The server converts it to a proper Authorization: Bearer header internally and redacts the value from its access logs.

Option B — stdio (Command Connector)

For purely local use you can skip HTTPS entirely:

uv run mcp-kraken serve --stdio

Wire it into Claude Desktop's config file (claude_desktop_config.json):

{
  "mcpServers": {
    "kraken": {
      "command": "uv",
      "args": ["--directory", "/abs/path/to/mcp-kraken", "run", "mcp-kraken", "serve", "--stdio"],
      "env": {
        "KRAKEN_API_KEY": "...",
        "KRAKEN_API_SECRET": "..."
      }
    }
  }
}

stdio sessions are inherently local — the bearer-token layer is bypassed.

Configuration

Settings come from environment variables, optionally loaded from .env:

Variable

Default

Purpose

KRAKEN_API_KEY

—

Kraken API public key.

KRAKEN_API_SECRET

—

Kraken API private key (base64).

KRAKEN_BASE_URL

https://api.kraken.com

Override for testing.

MCP_KRAKEN_HOST

0.0.0.0

Bind address.

MCP_KRAKEN_PORT

8765

TCP port.

MCP_KRAKEN_PATH

/mcp

HTTP path the MCP transport mounts on.

MCP_KRAKEN_TOKEN_DB

./data/tokens.db

SQLite file holding bearer-token metadata.

MCP_KRAKEN_SSL_KEYFILE

—

TLS private key (PEM). Pair with _SSL_CERTFILE.

MCP_KRAKEN_SSL_CERTFILE

—

TLS certificate (PEM). Pair with _SSL_KEYFILE.

MCP_KRAKEN_HTTP_TIMEOUT

30

Seconds before outbound Kraken calls time out.

MCP_KRAKEN_LOG_LEVEL

INFO

Standard Python log level.

MCP_KRAKEN_AUTH_DISABLED

false

Dev only. Skip bearer-token enforcement.

The full sample lives in .env.example.

Tools

Public market-data tools (no Kraken credentials needed):

get_server_time, get_system_status, get_assets, get_asset_pairs, get_ticker, get_ohlc, get_order_book, get_recent_trades, get_recent_spreads.

Private tools (require KRAKEN_API_KEY + KRAKEN_API_SECRET):

  • Account: get_account_balance, get_extended_balance, get_trade_balance, get_trade_volume, get_ledgers, query_ledgers, get_credit_lines, get_api_key_info, request_export_report, get_export_status, retrieve_export, remove_export.

  • Trading: get_open_orders, get_closed_orders, query_orders, get_trade_history, query_trades, get_open_positions, add_order, add_order_batch, amend_order, edit_order, cancel_order, cancel_all_orders, cancel_all_orders_after, cancel_order_batch.

  • Funding: get_deposit_methods, get_deposit_addresses, get_deposit_status, get_withdrawal_methods, get_withdrawal_addresses, get_withdrawal_info, withdraw, get_withdrawal_status, cancel_withdrawal, wallet_transfer.

  • Earn: list_earn_strategies, list_earn_allocations, allocate_earn, deallocate_earn, get_earn_allocation_status, get_earn_deallocation_status.

  • Subaccounts: create_subaccount, account_transfer.

  • WebSocket auth: get_websockets_token (token for the future WS layer — see TODO.md).

Kraken API key permissions

Kraken keys can be issued with any subset of:

UI label

Capability flag

Query funds

query_funds

Deposit

deposit

Withdraw

withdraw

Earn

earn

View open orders & trades

query_open_orders

View closed orders & trades

query_closed_orders

Create & modify orders

create_modify_orders

Cancel & close orders

cancel_orders

View ledger entries

query_ledger

Export data

export_data

WebSocket interface

websocket

On the first private call, mcp-kraken introspects the key via GetAPIKeyInfo and caches the resulting permission set. Subsequent tool invocations are checked against that cache; missing permissions raise KrakenPermissionError with the list of flags the key would need. If the introspection itself fails (older keys may not support GetAPIKeyInfo), the server falls back to letting Kraken enforce permissions over the wire.

IP restrictions, expiry, query date ranges, and custom nonce windows are configured on the key itself in the Kraken UI; the server passes through whatever the key allows.

Development

just sync          # uv sync --all-extras --dev
just test          # pytest
just check         # lint + format-check + mypy + tests
just fix           # auto-fix lint and format
just docker-build  # local image build

Run just with no arguments for the full recipe list.

Docker

The published image is ghcr.io/xavierbeheydt/mcp-kraken:

Tag

Pushed by

Notes

latest

release workflow

Latest non-prerelease tag.

vX.Y.Z, vX.Y, vX

release workflow

Semver tags on every release.

dev

dev-publish workflow

Tip of the dev branch.

dev-<sha7>

dev-publish workflow

Per-commit tag on dev.

The reference deployment uses compose.yml:

cp .env.example .env  # set KRAKEN_API_KEY / KRAKEN_API_SECRET
docker compose up -d

The container runs as a non-root user (uid 10001), with a read-only root filesystem, no added capabilities, and a SQLite token-store volume at /data. Put it behind a TLS-terminating reverse proxy in production — the server speaks plain HTTP internally.

Health endpoint

GET /health returns 200 {"status":"ok"} without a bearer token — safe for orchestrators, load balancers, and uptime monitors:

curl http://localhost:8765/health
# {"status":"ok"}

Both the Dockerfile HEALTHCHECK and compose.yml use this endpoint.

Versioning & release flow

Versions are derived from git tags via hatch-vcs; there is no version number to bump in pyproject.toml.

        feature → PR → dev   →  dev-publish workflow → ghcr.io/…:dev[-sha]
                                                      ↑
                                                test workflow

                  tag v1.2.3  →  release workflow    → ghcr.io/…:1.2.3, :latest
                                                      + GitHub Release
                                                      + fast-forward main to the tag

Branch conventions:

  • main — protected; always equals the latest released commit.

  • dev — default integration branch; every push runs tests and republishes the :dev image.

  • topic branches → PR into dev.

  • Releases are cut by tagging the desired dev commit vX.Y.Z. The release workflow tests it, builds and pushes the image with semver tags, opens a GitHub Release with auto-generated notes, and fast-forwards main to the tag. If main cannot be fast-forwarded (e.g. main has diverged) the workflow emits a warning and leaves the merge for a human.

To prerelease, tag v1.2.3-rc1: the workflow builds and pushes 1.2.3-rc1, 1.2-rc1, 1-rc1, marks the GitHub Release as prerelease, and does not publish the :latest tag.

Disclaimer

CAUTION

Read this section before pointingmcp-kraken at a Kraken API key with trading or withdrawal permissions.

Alpha software. Tool signatures, default behaviours, configuration keys and the on-disk token format may change in any minor release until v1.0. Run a non-production instance against a read-only Kraken API key first, and read each tool's docstring before granting the server credentials with trading or withdrawal permissions.

No liability. The software is provided as is, without warranty of any kind, express or implied. The author is not responsible for any direct, indirect, incidental, or consequential financial loss arising from the use, misuse or unavailability of this software — including but not limited to misrouted withdrawals, unintended trades, missed executions, exchange downtime, API rate-limit hits, or compromised credentials.

Not financial advice. Nothing in this software, its documentation, or any tool output constitutes investment, trading, tax or legal advice. You are solely responsible for the decisions you make and the orders you submit.

Not affiliated with Kraken or Payward Inc. "Kraken" is a trademark of its respective owner. This project is an independent client of the public Kraken REST API, written against the publicly documented API surface.

Available Tools

54 tools
account_transferC

Transfer funds between the master account and a sub-account.

Inputs: asset (required), amount (required), from_account (required), to_account (required).

add_orderC

Place a new order.

Inputs: pair (required), type (required), ordertype (required), volume (required), +18 more.

add_order_batchB

Submit up to 15 orders for the same pair in a single call.

Inputs: pair (required), orders (required), deadline, validate.

allocate_earnC

Allocate amount of the strategy's asset into strategy_id.

Inputs: strategy_id (required), amount (required).

amend_orderC

Amend an existing order in-place (preserves queue priority where the venue allows). Provide either txid or cl_ord_id.

Inputs: txid, cl_ord_id, order_qty, display_qty, +4 more.

cancel_all_ordersB

Cancel every open order.

Inputs: no named parameters.

cancel_all_orders_afterA

Dead-man-switch: schedule a bulk cancel after timeout seconds.

Setting timeout=0 disables the switch.

Inputs: timeout (required).

cancel_orderC

Cancel one order by id.

Inputs: txid, cl_ord_id.

cancel_order_batchA

Cancel up to 50 orders in a single call.

orders may contain txids or cl_ord_ids.

Inputs: orders (required).

cancel_withdrawalC

Request cancellation of a pending withdrawal.

Inputs: asset (required), refid (required).

create_subaccountC

Create a new sub-account.

Inputs: username (required), email (required).

deallocate_earnC

Withdraw amount from strategy_id.

Inputs: strategy_id (required), amount (required).

edit_orderC

Edit an order by replacing it (cancels + recreates atomically).

Inputs: txid (required), pair (required), volume, price, +6 more.

get_account_balanceB

Return the spot wallet balance per asset.

Inputs: no named parameters.

get_api_key_infoA

Return metadata about the API key currently in use, including the set of permissions granted to it.

Inputs: no named parameters.

get_asset_pairsC

Return tradable pair metadata.

Inputs: pair, info, country_code.

get_assetsC

Return info about one or more assets.

Inputs: asset, aclass.

get_closed_ordersC

List closed orders.

Inputs: trades, userref, cl_ord_id, start, +5 more.

get_credit_linesB

Return any available credit facilities on the account.

Inputs: no named parameters.

get_deposit_addressesC

Return deposit addresses for asset via method.

Inputs: asset (required), method (required), new, amount.

get_deposit_methodsC

List available deposit methods for an asset.

Inputs: asset (required), aclass.

get_deposit_statusC

Return status of recent deposits.

Inputs: asset, method, start, end, +2 more.

get_earn_allocation_statusC

Track the progress of a pending allocation.

Inputs: strategy_id (required).

get_earn_deallocation_statusC

Track the progress of a pending deallocation.

Inputs: strategy_id (required).

get_export_statusC

List the current status of every export of type report.

Inputs: report (required).

get_extended_balanceA

Return balance with hold/available breakdowns per asset.

Note: ExtendedBalance is not supported on all Kraken account types or regions. If this tool returns an error, use get_account_balance instead (same data, without the hold/available breakdown).

Inputs: no named parameters.

get_ledgersC

Return ledger entries (deposits, withdrawals, trades, fees…).

Inputs: asset, aclass, type, start, +3 more.

get_ohlcC

Return OHLC candles.

Inputs: pair (required), interval, since.

get_open_ordersC

List currently open orders.

Inputs: trades, userref, cl_ord_id.

get_open_positionsC

List open margin positions.

Inputs: txid, docalcs, consolidation.

get_order_bookB

Return an order-book snapshot.

Inputs: pair (required), count.

get_recent_spreadsC

Return recent bid/ask spread snapshots.

Inputs: pair (required), since.

get_recent_tradesC

Return recent trades for a pair.

Inputs: pair (required), since, count.

get_server_timeA

Return Kraken's current server time (unix and RFC1123).

Inputs: no named parameters.

get_system_statusA

Return the current trading-engine status (online, maintenance, cancel_only, post_only).

Inputs: no named parameters.

get_tickerC

Return ticker data (ask, bid, last, vol, etc.) for the given pairs.

Inputs: pair.

get_trade_balanceB

Return trade balance summary (equity, margin, free margin) in asset.

Inputs: asset.

get_trade_historyC

Return historical fills.

Inputs: type, trades, start, end, +3 more.

get_trade_volumeB

Return 30-day volume and current fee tier for the requested pairs.

Inputs: pair.

get_websockets_tokenA

Issue a token for use with the private WebSocket API.

Tokens are valid for 15 minutes from issue. Re-issue before expiry. Requires the API key to have the WebSocket interface permission enabled.

Inputs: no named parameters.

get_withdrawal_addressesC

List whitelisted withdrawal addresses.

Inputs: asset, aclass, method, key, +1 more.

get_withdrawal_infoB

Preview withdrawal cost (fee, limits).

Inputs: asset (required), key (required), amount (required).

get_withdrawal_methodsC

List available withdrawal methods.

Inputs: asset, aclass, network.

get_withdrawal_statusC

Return status of recent withdrawals.

Inputs: asset, aclass, method, start, +3 more.

list_earn_allocationsC

List current allocations across earn strategies.

Inputs: ascending, hide_zero_allocations, converted_asset.

list_earn_strategiesC

Browse available earn strategies.

Inputs: asset, lock_type, cursor, limit, +1 more.

query_ledgersC

Look up specific ledger entries by id.

Inputs: id (required), trades.

query_ordersA

Look up specific orders by transaction id (up to 50).

Inputs: txid (required), trades, userref, consolidate_taker.

query_tradesB

Look up specific trades by id (up to 20).

Inputs: txid (required), trades.

remove_exportA

Cancel a pending export or delete the file of a completed one.

Inputs: id (required), type.

request_export_reportB

Submit a request to export trades or ledgers as CSV/TSV.

Inputs: report (required), description (required), format, fields, +2 more.

retrieve_exportA

Retrieve the binary content of a completed export by id.

Returns the raw bytes Base64-encoded as a string under the data key.

Inputs: id (required).

wallet_transferB

Transfer between Kraken wallet types (e.g. Spot ↔ Futures).

Inputs: asset (required), from_wallet (required), to_wallet (required), amount (required).

withdrawC

Submit a withdrawal.

Inputs: asset (required), key (required), amount (required), address, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 54 tools

    Disambiguation5/5

    Each tool targets a distinct action or resource (e.g., add_order vs add_order_batch, cancel_order vs cancel_all_orders). Descriptions clearly differentiate between similar operations, and the batch variants are explicitly noted.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (e.g., get_account_balance, add_order), but a few use noun_verb (wallet_transfer, account_transfer). The mix of 'get_' and 'list_' prefixes is minor and does not cause confusion.

    Tool Count3/5

    54 tools is on the high side for a single server, but the Kraken API covers many areas (orders, account, deposits, earn, exports). The count is justified given the platform's complexity, though it may feel heavy for users.

    Completeness4/5

    The tool set covers major workflows: order lifecycle, transfers, deposits/withdrawals, earn strategies, reports, and market data. Minor gaps exist (e.g., no direct margin trade tools), but the core trading experience is well-supported.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server for cryptocurrency trading via Freqtrade, enabling trade management, balance checks, strategy configuration, backtesting, and bot lifecycle control from any MCP-compatible AI agent.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server for interacting with the Kraken cryptocurrency exchange, providing 32 tools for trading, account management, deposits, withdrawals, and grid trading automation.
      32
      5 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server that exposes QuantXData's institutional crypto market data APIs to AI assistants, enabling natural language queries for trades, order books, OHLCV, options, and more across 120+ exchanges.
      12
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for accessing crypto market data (prices, portfolio analytics) from CoinGecko and performing RAG-based search over internal documents with responsible-AI guardrails.
      4
      MIT