CCXT MCP Server
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.
README
CCXT MCP Server
This project provides a Model Context Protocol (MCP) server that exposes various functions from the CCXT library as tools for Large Language Models (LLMs).
It allows LLMs to interact with cryptocurrency exchanges for tasks like fetching balances, market data, creating orders, and more, in a standardized and asynchronous way.
This server is built using FastMCP, which simplifies the process of creating MCP servers in Python.
Features
- CCXT Integration: Wraps common CCXT functions for exchange interaction.
- Asynchronous: Built using
asyncioandccxt.async_supportfor efficient non-blocking operations. - Clear Tool Definitions: Uses
typing.Annotatedandpydantic.Fieldfor clear parameter descriptions and constraints, making it easier for LLMs (and developers) to understand and use the tools. - Authentication Handling: Supports API key, secret, and passphrase authentication for private endpoints.
- Public & Private Tools: Provides separate tools for public market data and private account actions.
Installation
-
Clone the repository (if you haven't already):
git clone <your-repo-url> # Replace with your repository URL cd ccxt-mcp-server -
Create and activate a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate` -
Install dependencies: The required libraries are listed in
requirements.txt. You can install them usingpiporuv.- Using
pip:pip install -r requirements.txt - Using
uv(if installed):uv pip install -r requirements.txt # Or, if you prefer uv's environment management: # uv sync
- Using
Running the Server
Once the dependencies are installed, you can run the MCP server directly:
python mcp_server.py
You should see output indicating the server has started, similar to:
Starting CCXT MCP Server (Async with Annotated Params and Tool Metadata)...
# ... (FastMCP server startup logs)
The server will then be available for MCP clients to connect to (typically on a default port managed by FastMCP, unless configured otherwise).
Available MCP Tools
This server exposes the following tools, categorized by whether they require API authentication.
Tools Requiring API Authentication (Private)
fetch_account_balance: Fetches the current account balance.fetch_deposit_address: Fetches the deposit address for a currency.withdraw_cryptocurrency: Withdraws cryptocurrency to a specified address.fetch_open_positions: Fetches open positions (primarily for futures/derivatives).set_trading_leverage: Sets leverage for a trading symbol (primarily for futures).create_spot_limit_order: Places a new spot limit order.create_spot_market_order: Places a new spot market order.create_futures_limit_order: Places a new futures limit order.create_futures_market_order: Places a new futures market order.cancel_order: Cancels an existing open order.fetch_order_history: Fetches the history of orders (open/closed).fetch_my_trade_history: Fetches the history of trades executed by the user.
Tools for Public Data (No Authentication Required)
fetch_ohlcv: Fetches historical OHLCV (candlestick) data.fetch_funding_rate: Fetches the funding rate for a perpetual futures contract.fetch_long_short_ratio: Fetches the long/short ratio (requires exchange-specificparams).fetch_option_contract_data: Fetches market data for an options contract.fetch_market_ticker: Fetches the latest price ticker data for a symbol.fetch_public_market_trades: Fetches recent public trades for a symbol.
Each tool has detailed parameter descriptions available via the MCP protocol itself, thanks to the use of Annotated and pydantic.Field.
Usage Notes
- Futures/Options: When using tools related to futures or options (e.g.,
fetch_open_positions,create_futures_limit_order,fetch_funding_rate), ensure you correctly configure the CCXT client via theparamsargument, specifically passing{'options': {'defaultType': 'future'}}(or'swap','option'as needed) if the exchange requires it or doesn't default to the desired market type. fetch_long_short_ratio: This is not a standard CCXT unified method. You must provide the specific exchange method name and its parameters within theparamsargument (e.g.,params={'method_name': 'fapiPublicGetGlobalLongShortAccountRatio', 'method_params': {'symbol': 'BTCUSDT', 'period': '5m'}}for Binance futures).- Error Handling: Tools return a dictionary with an
"error"key if an issue occurs during the CCXT call.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.