Skip to main content
Glama

CCXT MCP Server

npm version npm downloads GitHub stars License: MIT

한국어 버전(Korean version)

CCXT MCP Server ist ein Server, der es KI-Modellen ermöglicht, über das Model Context Protocol (MCP) mit Kryptobörsen-APIs zu interagieren. Dieser Server nutzt die CCXT-Bibliothek, um Zugriff auf mehr als 100 Kryptobörsen und deren Handelsfunktionen zu bieten.

🚀 Schnelleinstieg

# Install the package globally
npm install -g @lazydino/ccxt-mcp

# Run with default settings
ccxt-mcp

# or run without installation
npx @lazydino/ccxt-mcp

Related MCP server: CCXT MCP Server

Installation und Verwendung

Globale Installation

# Install the package globally
npm install -g @lazydino/ccxt-mcp

Ausführung mit npx

Sie können es direkt ohne Installation ausführen:

# Using default settings
npx @lazydino/ccxt-mcp

# Using custom configuration file
npx @lazydino/ccxt-mcp --config /path/to/config.json

Hilfe anzeigen:

npx @lazydino/ccxt-mcp --help

Konfiguration

Registrierung des MCP-Servers in Claude Desktop

  1. Claude Desktop-Einstellungen öffnen:

    • Gehen Sie zum Einstellungsmenü in der Claude Desktop-App

    • Suchen Sie den Abschnitt "MCP Servers"

  2. Einen neuen MCP-Server hinzufügen:

    • Klicken Sie auf die Schaltfläche "Add Server"

    • Server-Name: ccxt-mcp

    • Befehl: npx @lazydino/ccxt-mcp

    • Zusätzliche Argumente (optional): --config /pfad/zu/config.json

  3. Server speichern und testen:

    • Speichern Sie die Einstellungen

    • Testen Sie die Verbindung mit der Schaltfläche "Test Connection"

Konfigurationsmethoden - Zwei Optionen

Option 1: Kontoinformationen direkt in die Claude Desktop-Einstellungen einfügen (Grundlegende Methode)

Diese Methode fügt die CCXT-Kontoinformationen direkt in die Konfigurationsdatei von Claude Desktop (claude_desktop_config.json) ein:

{
  "mcpServers": {
    "ccxt-mcp": {
      "command": "npx",
      "args": ["-y", "@lazydino/ccxt-mcp"],
      "mcpBearerToken": "YOUR_MCP_TOKEN",
      "accounts": [
        {
          "name": "bybit_main",
          "exchangeId": "bybit",
          "apiKey": "YOUR_API_KEY",
          "secret": "YOUR_SECRET_KEY",
          "defaultType": "spot"
        },
        {
          "name": "bybit_futures",
          "exchangeId": "bybit",
          "apiKey": "YOUR_API_KEY",
          "secret": "YOUR_SECRET_KEY",
          "defaultType": "swap"
        }
      ]
    }
  }
}

Bei dieser Methode benötigen Sie keine separate Konfigurationsdatei. Alle Einstellungen sind in die Konfigurationsdatei von Claude Desktop integriert.

Option 2: Verwendung einer separaten Konfigurationsdatei (Erweiterte Methode)

Um Kontoinformationen in eine separate Konfigurationsdatei auszulagern, gehen Sie wie folgt vor:

  1. Erstellen Sie eine separate Konfigurationsdatei (z. B. ccxt-config.json):

{
  "mcpBearerToken": "YOUR_MCP_TOKEN",
  "accounts": [
    {
      "name": "bybit_main",
      "exchangeId": "bybit",
      "apiKey": "YOUR_API_KEY",
      "secret": "YOUR_SECRET_KEY",
      "defaultType": "spot"
    },
    {
      "name": "bybit_futures",
      "exchangeId": "bybit",
      "apiKey": "YOUR_API_KEY",
      "secret": "YOUR_SECRET_KEY",
      "defaultType": "swap"
    }
  ]
}

Wichtig: Die Konfigurationsdatei muss auf der Stammebene ein accounts-Array enthalten, wie oben gezeigt.

Wichtig: Wenn Sie den Server im HTTP+SSE-Modus (--sse) ausführen, legen Sie mcpBearerToken in derselben Konfigurationsdatei fest. Clients müssen bei Anfragen Authorization: Bearer <mcpBearerToken> senden.

  1. Geben Sie den Pfad zur Konfigurationsdatei in den Claude Desktop-Einstellungen an:

{
  "mcpServers": {
    "ccxt-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@lazydino/ccxt-mcp",
        "--config",
        "/path/to/ccxt-config.json"
      ]
    }
  }
}

Hinweis: Wenn Sie eine separate Konfigurationsdatei mit der Option --config verwenden, sucht der Server direkt im Stammverzeichnis der JSON-Datei nach dem accounts-Array, nicht im Pfad mcpServers.ccxt-mcp.accounts.

  1. Ausführung mit externer Konfigurationsdatei über die Befehlszeile:

# Using custom configuration file
npx @lazydino/ccxt-mcp --config /path/to/ccxt-config.json

Sie finden eine Beispiel-Konfigurationsdatei unter config/ccxt-config.example.json im Repository.

Gründe für die Verwendung einer separaten Konfigurationsdatei:

  • Verhindert Probleme mit rekursiven Referenzen

  • Trennt sensible Informationen wie API-Schlüssel

  • Einfachere Konfiguration für mehrere Umgebungen (Entwicklung, Test, Produktion)

  • Verbesserte Versionskontrolle der Konfigurationsdatei

Hauptfunktionen

  • Abruf von Marktinformationen:

    • Börsen auflisten

    • Marktinformationen nach Börse anzeigen

    • Preisinformationen für bestimmte Symbole abrufen

    • Orderbuchinformationen für bestimmte Symbole anzeigen

    • Historische OHLCV-Daten durchsuchen

  • Handelsfunktionen:

    • Market-/Limit-Orders erstellen

    • Orders stornieren und Status prüfen

    • Kontostände anzeigen

    • Handelshistorie prüfen

  • Handelsanalyse:

    • Analyse der täglichen/wöchentlichen/monatlichen Performance

    • Berechnung der Gewinnrate (letzte 7 Tage, 30 Tage, insgesamt)

    • Durchschnittliches Gewinn-/Verlustverhältnis (R-Multiple)

    • Analyse der maximalen aufeinanderfolgenden Verlust-/Gewinnserien

    • Nachverfolgung von Vermögensänderungen

    • Umfassende Leistungskennzahlen

    • Erkennung von Handelsmustern

    • Periodenbasierte Renditeberechnungen

  • Positionsmanagement:

    • Handel nach Kapitalverhältnis (z. B. Einstieg mit 5 % des Kontokapitals)

    • Einstellung des Hebels für den Terminmarkt (1-100x)

    • Dynamische Positionsgrößenbestimmung (volatilitätsbasiert)

    • Implementierung von Split-Kauf-/Verkaufsstrategien

  • Risikomanagement:

    • Stop-Loss-Einstellung basierend auf technischen Indikatoren (z. B. tiefster Punkt unter 10 Kerzen im 5-Minuten-Chart)

    • Volatilitätsbasierter Stop-Loss/Take-Profit (ATR-Multiplikatoren)

    • Maximal zulässiges Verlustlimit (täglich/wöchentlich)

    • Dynamische Take-Profit-Einstellung (Trailing Profit)

Funktionsweise

User <--> AI Model(Claude/GPT) <--> MCP Protocol <--> CCXT MCP Server <--> Cryptocurrency Exchange API
  1. Benutzer: Anfragen wie "Sag mir den Bitcoin-Preis" oder "Kaufe Ethereum auf meinem Binance-Konto"

  2. KI-Modell: Versteht Benutzeranfragen und bestimmt, welche MCP-Tools/-Ressourcen verwendet werden sollen

  3. MCP-Protokoll: Standardisierte Kommunikation zwischen KI und CCXT MCP-Server

  4. CCXT MCP-Server: Kommuniziert mit Kryptobörsen-APIs unter Verwendung der CCXT-Bibliothek

  5. Börsen-API: Liefert tatsächliche Daten und führt Handelsaufträge aus

Verwendung mit KI-Modellen

Wenn Sie bei Claude Desktop registriert sind, können Sie folgende Arten von Anfragen an KI-Modelle stellen:

Vorsichtsmaßnahmen und empfohlene Prompts

Berücksichtigen Sie bei der Verwendung von KI-Modellen die folgenden Vorsichtsmaßnahmen und verwenden Sie den unten stehenden Prompt für effektiven Handel:

Your goal is to execute trades using the ccxt tools as much as possible
Cautions:
- Accurately identify whether it's a futures market or spot market before proceeding with trades
- If there's no instruction about percentage of capital or amount to use, always calculate and execute trades using the entire available capital

Hinweise:

  • KI-Modelle verwechseln manchmal den Terminhandel mit dem Spot-Handel.

  • Ohne klare Anweisungen zur Größe des Handelskapitals könnte die KI verwirrt sein.

  • Die Verwendung des obigen Prompts hilft dabei, Ihre Handelsabsichten klar zu kommunizieren.

Grundlegende Abfragebeispiele

Check and compare the current Bitcoin price on binance and coinbase.

Beispiele für fortgeschrittene Handelsabfragen

Positionsmanagement

Open a long position on BTC/USDT futures market in my Bybit account (bybit_futures) with 5% of capital using 10x leverage.
Enter based on moving average crossover strategy and set stop loss at the lowest point among the 12 most recent 5-minute candles.

Performance-Analyse

Analyze my Binance account (bybit_main) trading records for the last 7 days and show me the win rate, average profit, and maximum consecutive losses.

Detaillierte Handelsanalytik

Analyze my trading performance on the bybit_futures account for BTC/USDT over the last 30 days. Calculate win rate, profit factor, and identify any patterns in my winning trades.
Show me the monthly returns for my bybit_main account over the past 90 days and identify my best and worst trading months.
Analyze my consecutive wins and losses on my bybit_futures account and tell me if I have any psychological patterns affecting my trading after losses.

Entwicklung

Erstellen aus dem Quellcode

# Clone repository
git clone https://github.com/lazy-dinosaur/ccxt-mcp.git

# Navigate to project directory
cd ccxt-mcp

# Install dependencies
npm install

# Build
npm run build

Docker

Erstellen und Ausführen mit Docker Compose

  1. Erstellen Sie eine Konfigurationsdatei:

cp config/ccxt-config.example.json config/ccxt-config.json

Tragen Sie dann Ihre echten API-Schlüssel in config/ccxt-config.json ein. Legen Sie außerdem mcpBearerToken in derselben Konfigurationsdatei fest. 2. Image erstellen:

docker compose build
  1. Starten Sie den MCP-Server im Hintergrund (SSE-Modus auf localhost:2298):

docker compose up -d
  1. Überprüfen Sie den lokalen Health-Endpunkt:

curl -H "Authorization: Bearer YOUR_MCP_TOKEN" http://127.0.0.1:2298/healthz

Dieses Compose-Setup führt MCP über HTTP+SSE (/sse + /messages) auf localhost:2298 für Reverse-Proxying aus.

Konfiguration des Remote-MCP-Clients

Wenn Ihr MCP-Client auf einem anderen Host läuft, verwenden Sie einen Nginx-Reverse-Proxy auf dieser Maschine.

  1. Kopieren Sie ccxt-mcp.nginx an Ihren Nginx-Konfigurationsort und aktualisieren Sie die Zertifikatspfade:

sudo cp ccxt-mcp.nginx /etc/nginx/conf.d/ccxt-mcp.conf
  1. Bearbeiten Sie /etc/nginx/conf.d/ccxt-mcp.conf und legen Sie Folgendes fest:

  • ssl_certificate

  • ssl_certificate_key

  • Weiterleitung des Authorization-Headers (in dieser Datei bereits enthalten)

  1. Nginx neu laden:

sudo nginx -t && sudo systemctl reload nginx
  1. Konfigurieren Sie in Ihrem MCP-Client die MCP-Server-URL auf Ihren TLS-Endpunkt:

  • SSE-URL: https://IHR_HOSTNAME_ODER_IP:42299/sse

  • Nachrichten-URL: https://IHR_HOSTNAME_ODER_IP:42299/messages

  • Header: Authorization: Bearer IHR_MCP_TOKEN

Sie können ein starkes Token generieren mit:

openssl rand -hex 32

Konfigurationsbeispiel:

{
  "mcpBearerToken": "YOUR_MCP_TOKEN",
  "accounts": [
    {
      "name": "bybit_main",
      "exchangeId": "bybit",
      "apiKey": "YOUR_API_KEY",
      "secret": "YOUR_SECRET_KEY"
    }
  ]
}

Port-Hinweis:

  • 42298 ist HTTP (nur Weiterleitung)

  • 42299 ist HTTPS

  • 2298 stammt von CCXT auf einer Telefontastatur

Wenn Ihr MCP-Client befehlsbasierte MCP-Server anstelle einer URL-Konfiguration akzeptiert, konfigurieren Sie ccxt-mcp mit:

  • Befehl: docker

  • Argumente:

[
  "run",
  "--rm",
  "-i",
  "-p",
  "127.0.0.1:2298:2298",
  "-v",
  "/absolute/path/to/ccxt-mcp/config/ccxt-config.json:/config/ccxt-config.json:ro",
  "ccxt-mcp:local",
  "--sse",
  "--host",
  "0.0.0.0",
  "--port",
  "2298",
  "--config",
  "/config/ccxt-config.json"
]

Erstellen Sie das Image zuerst mit docker compose build.

🤝 Mitwirken

Beiträge sind willkommen! Bitte zögern Sie nicht, einen Pull Request einzureichen.

📄 Lizenz

Vertrieben unter der MIT-Lizenz. Weitere Informationen finden Sie in der Datei LICENSE.

❤️ Unterstützung

Wenn Sie dieses Projekt nützlich finden, ziehen Sie bitte in Betracht, ihm ein ⭐️ auf GitHub zu geben!

Available Tools

20 tools
analyzeConsecutiveProfitLossC

Analyze consecutive winning and losing trades

Inputs: accountName (required), symbol, period.

analyzePeriodicReturnsB

Analyze daily and monthly returns for a configured account

Inputs: accountName (required), symbol, period, interval.

analyzeTradingPerformanceC

Analyze trading performance for a configured account

Inputs: accountName (required), symbol, period.

calculateWinRateC

Calculate win rate and profit metrics for a configured account

Inputs: accountName (required), symbol, period.

cancelOrderC

Cancel an existing order using a configured account

Inputs: accountName (required), id (required), symbol (required), params.

createOrderC

Create a new order using a configured account

Inputs: accountName (required), symbol (required), type (required), side (required), +3 more.

fetchBalanceC

Fetch account balance for a configured account

Inputs: accountName (required).

fetchClosedOrdersC

Fetch all closed orders using a configured account

Inputs: accountName (required), symbol, since, limit, +1 more.

fetchDepositsC

Fetch deposit history for a configured account

Inputs: accountName (required), code, since, limit.

fetchMarketsC

Fetch markets from a cryptocurrency exchange

Inputs: exchangeId (required).

fetchMyTradesC

Fetch personal trade history for a configured account

Inputs: accountName (required), symbol, since, limit.

fetchOHLCVC

Fetch OHLCV candlestick data for a symbol on an exchange

Inputs: exchangeId (required), symbol (required), timeframe, since, +1 more.

fetchOpenOrdersC

Fetch all open orders using a configured account

Inputs: accountName (required), symbol, since, limit, +1 more.

fetchOrderC

Fetch information about a specific order using a configured account

Inputs: accountName (required), id (required), symbol (required), params.

fetchOrderBookC

Fetch order book for a symbol on an exchange

Inputs: exchangeId (required), symbol (required), limit.

fetchTickerC

Fetch ticker information for a symbol on an exchange

Inputs: exchangeId (required), symbol (required).

fetchTickersC

Fetch all tickers from an exchange

Inputs: exchangeId (required), symbols.

fetchTradesC

Fetch recent trades for a symbol on an exchange

Inputs: exchangeId (required), symbol (required), since, limit.

fetchWithdrawalsC

Fetch withdrawal history for a configured account

Inputs: accountName (required), code, since, limit.

listAccountsB

List all configured account names

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 20 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap between analyzeConsecutiveProfitLoss, analyzePeriodicReturns, analyzeTradingPerformance, and calculateWinRate, which all focus on performance analysis and could cause confusion. The remaining tools are clearly differentiated by their specific actions and targets.

    Naming Consistency4/5

    The naming is mostly consistent with a verb_noun pattern, using camelCase throughout. However, there are minor deviations: 'listAccounts' uses 'list' while others use 'fetch' or 'analyze', and 'calculateWinRate' uses 'calculate' instead of 'analyze' for similar analysis tasks, slightly breaking the pattern.

    Tool Count4/5

    With 20 tools, the count is on the higher side but reasonable for a cryptocurrency trading server that needs to cover account management, order handling, market data, and performance analysis. It feels slightly heavy but not excessive for the domain's complexity.

    Completeness5/5

    The tool set provides comprehensive coverage for cryptocurrency trading: it includes account listing and balance fetching, full order lifecycle (create, fetch, cancel, open/closed orders), market data (markets, tickers, trades, OHLCV, order book), deposit/withdrawal history, and performance analysis. No obvious gaps are present for core trading workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A server that provides real-time cryptocurrency data through the Model Context Protocol, allowing access to detailed exchange information and current cryptocurrency rates from the CoinCap API.
      6 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables LLMs to interact with cryptocurrency exchanges through CCXT, allowing for tasks like fetching balances, market data, creating orders, and trading operations in a standardized way.
      8
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that provides a standardized interface for AI models and applications to interact with the Luno cryptocurrency exchange API for trading operations.
      2
      -