CCXT Crypto Trading

by lazy-dinosaur

26 stars
2.1k downloads
Not rated
GitHub

About

Bridges the CCXT cryptocurrency trading library with natural language interfaces, enabling monitoring, analysis, and trading operations across 100+ exchanges

Details

Author
lazy-dinosaur
Repository
lazy-dinosaur/ccxt-mcp
GitHub stars
26
Downloads
2,120
License
MIT License
Categories
Developer Tools, Other, Finance, API, Design, AI, Infrastructure, Knowledge Base

- Market Information Retrieval:

- List exchanges
- View market information by exchange
- Get price information for specific symbols
- View order book information for specific symbols
- Search historical OHLCV data

- Trading Functions:

- Create market/limit orders
- Cancel orders and check status
- View account balances
- Check trading history

- Trading Analysis:

- Daily/weekly/monthly performance analysis
- Win rate calculation (last 7 days, 30 days, all time)
- Average profit/loss ratio (R-multiple)
- Maximum consecutive loss/profit series analysis
- Asset variation tracking
- Comprehensive performance metrics
- Trade pattern recognition
- Period-based return calculations

- Position Management:

- Capital ratio trading (e.g., enter with 5% of account capital)
- Futures market leverage setting (1-100x)
- Dynamic position sizing (volatility-based)
- Split buy/sell strategy implementation

- Risk Management:
- Technical indicator-based stop loss setting (e.g., lowest point among 10 candles on 5-minute chart)
- Volatility-based stop loss/take profit (ATR multiples)
- Maximum allowable loss limit (daily/weekly)
- Dynamic take profit setting (trailing profit)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name CCXT Crypto Trading
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 -y
    • Argument 2 @lazydino/ccxt-mcp
    Environment
    • mcpBearerToken YOUR_MCP_TOKEN

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository


npm install -g @lazydino/ccxt-mcp

npx @lazydino/ccxt-mcp


bash

You can run it directly without installation:


npx @lazydino/ccxt-mcp --config /path/to/ccxt-config.json

You can find an example configuration file at config/ccxt-config.example.json in the repository.

> Reasons to Use a Separate Configuration File:
>
> - Prevents recursive reference issues
> - Separates sensitive information like API keys
> - Easier multi-environment configuration (development, testing, production)
> - Improved configuration file version control

To separate account information into a separate configuration file, set up as follows:

1. Create a Separate Configuration File (e.g., 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"
    }
  ]
}

> Important: The configuration file must contain an accounts array at the root level, as shown above.

> Important: If you run the server in HTTP+SSE mode (--sse), set mcpBearerToken in the same config file. Clients must send Authorization: Bearer <mcpBearerToken> on requests.

2. Specify the Configuration File Path in Claude Desktop Settings:

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

> Note: When using a separate configuration file with the --config option, the server will look for the accounts array directly in the root of the JSON file, not in mcpServers.ccxt-mcp.accounts path.

3. Running with External Configuration File from Command Line:

```bash

fetchMarkets

Fetch markets from a cryptocurrency exchange

fetchTicker

Fetch ticker information for a symbol on an exchange

fetchTickers

Fetch all tickers from an exchange

fetchOrderBook

Fetch order book for a symbol on an exchange

fetchTrades

Fetch recent trades for a symbol on an exchange

fetchOHLCV

Fetch OHLCV candlestick data for a symbol on an exchange

createOrder

Create a new order using a configured account

cancelOrder

Cancel an existing order using a configured account

fetchOrder

Fetch information about a specific order using a configured account

fetchOpenOrders

Fetch all open orders using a configured account

fetchClosedOrders

Fetch all closed orders using a configured account

listAccounts

List all configured account names

fetchBalance

Fetch account balance for a configured account

fetchDeposits

Fetch deposit history for a configured account

fetchWithdrawals

Fetch withdrawal history for a configured account

fetchMyTrades

Fetch personal trade history for a configured account

analyzeTradingPerformance

Analyze trading performance for a configured account

calculateWinRate

Calculate win rate and profit metrics for a configured account

analyzeConsecutiveProfitLoss

Analyze consecutive winning and losing trades

analyzePeriodicReturns

Analyze daily and monthly returns for a configured account

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "ccxt crypto trading": {
            "env": {
                "mcpBearerToken": "YOUR_MCP_TOKEN"
            },
            "args": [
                "-y",
                "@lazydino/ccxt-mcp"
            ],
            "command": "npx"
        }
    }
}

Linux

{
    "env": {
        "mcpBearerToken": "YOUR_MCP_TOKEN"
    },
    "args": [
        "-y",
        "@lazydino/ccxt-mcp"
    ],
    "command": "npx"
}

Macos

{
    "env": {
        "mcpBearerToken": "YOUR_MCP_TOKEN"
    },
    "args": [
        "-y",
        "@lazydino/ccxt-mcp"
    ],
    "command": "npx"
}

Windows

{
    "env": {
        "mcpBearerToken": "YOUR_MCP_TOKEN"
    },
    "args": [
        "/c",
        "npx",
        "-y",
        "@lazydino/ccxt-mcp"
    ],
    "command": "cmd"
}

Interact with over 100 cryptocurrency exchange APIs using the CCXT library.

CCXT MCP Server is a server that allows AI models to interact with cryptocurrency exchange APIs through theModel Context Protocol (MCP). This server uses theCCXT libraryto provide access to more than 100 cryptocurrency exchanges and their trading capabilities.

# Install the package globally npm install -g @lazydino/ccxt-mcp # Run with default settings ccxt-mcp # or run without installation npx @lazydino/ccxt-mcp
# Install the package globally npm install -g @lazydino/ccxt-mcp

You can run it directly without installation:

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

Registering the MCP Server in Claude Desktop

- Go to the Settings menu in the Claude Desktop app
- Find the "MCP Servers" section

- Click the "Add Server" button
- Server name:ccxt-mcp
- Command:npx @lazydino/ccxt-mcp
- Additional arguments (optional):--config /path/to/config.json

- Save the settings
- Test the connection with the "Test Connection" button

Option 1: Include Account Information Directly in Claude Desktop Settings (Basic Method)

This method includes CCXT account information directly in the Claude Desktop settings file (claude_desktop_config.json):

{ "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" } ] } } }

Using this method, you don't need a separate configuration file. All settings are integrated into the Claude Desktop configuration file.

Option 2: Using a Separate Configuration File (Advanced Method)

To separate account information into a separate configuration file, set up as follows:
- Create a Separate Configuration File(e.g.,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" } ] }

Important: The configuration file must contain anaccountsarray at the root level, as shown above.

Important: If you run the server in HTTP+SSE mode (--sse), setmcpBearerTokenin the same config file. Clients must sendAuthorization: Bearer <mcpBearerToken>on requests.
- Specify the Configuration File Path in Claude Desktop Settings:

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

Note: When using a separate configuration file with the--configoption, the server will look for theaccountsarray directly in the root of the JSON file, not inmcpServers.ccxt-mcp.accountspath.
- Running with External Configuration File from Command Line:

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

You can find an example configuration file atconfig/ccxt-config.example.jsonin the repository.

Reasons to Use a Separate Configuration File:

- Prevents recursive reference issues
- Separates sensitive information like API keys
- Easier multi-environment configuration (development, testing, production)
- Improved configuration file version control

- List exchanges
- View market information by exchange
- Get price information for specific symbols
- View order book information for specific symbols
- Search historical OHLCV data

- Create market/limit orders
- Cancel orders and check status
- View account balances
- Check trading history

- Daily/weekly/monthly performance analysis
- Win rate calculation (last 7 days, 30 days, all time)
- Average profit/loss ratio (R-multiple)
- Maximum consecutive loss/profit series analysis
- Asset variation tracking
- Comprehensive performance metrics
- Trade pattern recognition
- Period-based return calculations

- Capital ratio trading (e.g., enter with 5% of account capital)
- Futures market leverage setting (1-100x)
- Dynamic position sizing (volatility-based)
- Split buy/sell strategy implementation

- Technical indicator-based stop loss setting (e.g., lowest point among 10 candles on 5-minute chart)
- Volatility-based stop loss/take profit (ATR multiples)
- Maximum allowable loss limit (daily/weekly)
- Dynamic take profit setting (trailing profit)

User <--> AI Model(Claude/GPT) <--> MCP Protocol <--> CCXT MCP Server <--> Cryptocurrency Exchange API

- User: Requests like "Tell me the Bitcoin price" or "Buy Ethereum on my Binance account"
- AI Model: Understands user requests and determines which MCP tools/resources to use
- MCP Protocol: Standardized communication between AI and CCXT MCP server
- CCXT MCP Server: Communicates with cryptocurrency exchange APIs using the CCXT library
- Exchange API: Provides actual data and executes trade orders

When registered with Claude Desktop, you can make the following types of requests to AI models:

When using AI models, consider the following cautions and use the prompt below for effective trading:

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

- AI models sometimes confuse futures trading with spot trading.
- Without clear guidance on trading capital size, AI might get confused.
- Using the above prompt helps clearly communicate your trading intentions.

Check and compare the current Bitcoin price on binance and coinbase.
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.
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.
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.
# 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
cp config/ccxt-config.example.json config/ccxt-config.json

Then fill in your real API keys inconfig/ccxt-config.json. Also setmcpBearerTokenin that same config file. 2. Build image:
- Start the MCP server in background (SSE mode on localhost:2298):

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

This Compose setup runs MCP over HTTP+SSE (/sse+/messages) on localhost:2298 for reverse proxying.

If your MCP client runs on another host, use an Nginx reverse proxy on this machine.
- Copyccxt-mcp.nginxto your Nginx config location and update certificate paths:

sudo cp ccxt-mcp.nginx /etc/nginx/conf.d/ccxt-mcp.conf

- Edit/etc/nginx/conf.d/ccxt-mcp.confand set:

- ssl_certificate
- ssl_certificate_key
- Authorization header forwarding (already included in this file)

sudo nginx -t && sudo systemctl reload nginx

- In your MCP client, configure the MCP server URL to your TLS endpoint:

- SSE URL:https://YOUR_HOSTNAME_OR_IP:42299/sse
- Messages URL:https://YOUR_HOSTNAME_OR_IP:42299/messages
- Header:Authorization: Bearer YOUR_MCP_TOKEN

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

- 42298is HTTP (redirect only)
- 42299is HTTPS
- 2298comes fromCCXTon a phone keypad

If your MCP client accepts command-based MCP servers instead of URL configuration, configureccxt-mcpwith:

[ "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" ]

Build the image first withdocker compose build.

Contributions are welcome! Please feel free to submit a Pull Request.

Distributed under the MIT License. See the LICENSE file for more information.

If you find this project useful, please consider giving it a ⭐️ on GitHub!

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Access prediction market data from the PolyMarket API.

WunderTrading MCP connects AI agents to live crypto trading execution on 20+ supported exchanges through a single MCP integration. Use it to turn AI-driven signals, market analysis, sentiment, screenshots, and custom strategy logic into real trades on exchanges including Binance, Bybit, Coinbase, Bitget, OKX, KuCoin, Hyperliquid, and BingX. Supports MCP and REST API workflows for order execution, trade management, and AI-powered automation.

Manage stock and crypto portfolios, place trades, and access market data via the Alpaca Trading API.

Provides seamless access to the Binance exchange API. Requires Binance API credentials to be configured.

Interact with the Binance API to view portfolios, convert tokens, and execute trades with minimal market impact.

Access the Binance Futures API for trading, account management, and market data.

Access market data, manage accounts, and execute trades on the Upbit Cryptocurrency Exchange via its OpenAPI.

Real-time and historical FX/crypto signal API for AI agents. Pay-per-call via x402 protocol on Base. No subscription, no API key. Correlation, regime, momentum, volatility across 10 instruments.

Interact with Alchemy's blockchain APIs to query data without writing code.

Integrate AI with high-frequency cryptocurrency trading systems.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.