logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

unified-crypto-gateway-service

A standardized, asynchronous framework for interfacing with diverse digital asset exchanges, enabling LLMs to perform secure account operations, retrieve real-time pricing, and manage transactional records using authenticated credentials.

Author

unified-crypto-gateway-service logo

jcwleo

MIT License

Quick Info

GitHub GitHub Stars 4
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

jcwleoapisapirequests jcwleojcwleo ccxtmcp server

Unified Cryptocurrency Interaction Facade (CCXT-based)

smithery badge

This component furnishes a Model Context Protocol (MCP) endpoint, architected around the powerful CCXT library, to grant Large Language Models (LLMs) programmatic access to numerous cryptocurrency exchanges.

It abstracts complex exchange interactions into uniform tool calls for fetching asset status, accessing market kinematics, executing trade placements, and more, all handled asynchronously.

The underpinning structure leverages FastMCP for streamlined, Python-based MCP service creation.

Core Capabilities

  • Exchange Abstraction: Provides wrappers for conventional CCXT functionalities concerning asset interaction.
  • Non-Blocking I/O: Implemented with asyncio and ccxt.async_support to ensure highly efficient, concurrent operations.
  • Semantic Clarity: Utilizes advanced Python typing (typing.Annotated, pydantic.Field) to ensure exhaustive parameter definitions, maximizing LLM interpretability and reducing ambiguity.
  • Credential Management: Robust support for API credentials (key, secret, passphrase) necessary for private endpoints.
  • Operational Segregation: Clearly delineates tools for public data inquiry versus private, authenticated account management.

Setup Instructions

  1. Source Acquisition: Clone the project repository if necessary: bash git clone https://github.com/jcwleo/ccxt-mcp-server.git cd ccxt-mcp-server

  2. Environment Isolation: Establish and activate a dedicated virtual environment (highly recommended): bash python -m venv .venv source .venv/bin/activate # For Windows: .venv\Scripts\activate

  3. Dependency Installation: Install required packages listed in requirements.txt.

    • Using pip: bash pip install -r requirements.txt

Service Launch

Execute the server using uvicorn:

bash uv run uvicorn mcp_server:app

Successful initiation will display startup messages confirming the asynchronous CCXT MCP Server is operational and awaiting MCP client connections.

Client Configuration Notes

For MCP clients that require manual endpoint registration (e.g., certain desktop applications), integrate the server information using a configuration structure similar to this:

{ "mcpServers": { "unified-crypto-gateway-service": { "command": "npx", "args": ["mcp-remote", "http://127.0.0.1:8000/mcp/"] } } }

Exposed Toolkit Inventory

Tools are partitioned based on whether they mandate secure API context for execution.

Secure Access Required (Authenticated Operations)

  • fetch_account_balance: Retrieves the current asset holdings status.
  • fetch_deposit_address: Queries the unique address for depositing a specified token.
  • withdraw_cryptocurrency: Initiates a transfer of crypto assets to an external destination.
  • fetch_open_positions: Lists active leveraged or derivatives positions.
  • set_trading_leverage: Modifies the multiplier setting for a given trading instrument.
  • create_spot_limit_order: Submits a buy/sell order at a specified non-market price on the spot market.
  • create_spot_market_order: Submits an immediate order execution request on the spot market.
  • create_futures_limit_order: Submits a limit order for derivative contracts.
  • create_futures_market_order: Submits a market order for derivative contracts.
  • cancel_order: Terminates an order that has not yet been filled.
  • fetch_order_history: Retrieves records of past and pending orders.
  • fetch_my_trade_history: Retrieves records of the user's successfully executed transactions.

Public Data Access (No Authentication Needed)

  • fetch_ohlcv: Retrieves historical candlestick data (Open, High, Low, Close, Volume).
  • fetch_funding_rate: Gets the periodic financing cost for perpetual futures.
  • fetch_long_short_ratio: Fetches aggregate sentiment data (requires exchange-specific parameterization).
  • fetch_option_contract_data: Retrieves specific market metrics for options contracts.
  • fetch_market_ticker: Fetches the most recent aggregated price quote for a symbol.
  • fetch_public_market_trades: Retrieves a stream of recent, publicly visible transactions for a pair.
  • calculate_technical_indicator_tool: Fetches candlestick data and computes advanced metrics (e.g., RSI, SMA, MACD, ATR).

Detailed schema and parameter context for every tool are discoverable via the standard MCP introspection mechanism, facilitated by the Pydantic annotations.

Operational Guidance

  • Derivatives Context: For tools involving futures or options (e.g., fetch_open_positions, create_futures_limit_order), users must often supply the exchange context via the params argument, such as { 'options': { 'defaultType': 'future' } }, unless the exchange defaults correctly.
  • Custom Public Metrics: The fetch_long_short_ratio method is non-standard. Successful invocation mandates providing the exact exchange endpoint method name and its required arguments within the params field (e.g., for Binance: params={'method_name': 'fapiPublicGetGlobalLongShortAccountRatio', 'method_params': {'symbol': 'BTCUSDT', 'period': '5m'}}).
  • Failure Reporting: Operational failures during CCXT execution are communicated back to the client via a JSON response containing an explicit "error" key.

Contextual Reference: XMLHttpRequest (XHR) API

XMLHttpRequest (XHR) is a foundational JavaScript interface implemented as an object that facilitates the transmission of HTTP requests between a web browser environment and a remote web server. Its methods enable client-side applications to asynchronously communicate with the server post-page load, receiving data updates without full page reloads—a core tenet of Ajax programming. Before XHR, server interaction relied primarily on traditional form submissions or hyperlink navigation, both of which typically necessitated page replacement.

== Chronicle of Development == XMLHttpRequest's conceptual foundation was established in 2000 by Microsoft developers associated with Outlook. The initial implementation appeared in Internet Explorer 5 (1999), though it used proprietary identifiers like ActiveXObject("Msxml2.XMLHTTP"). By the release of Internet Explorer 7 (2006), the standardized XMLHttpRequest identifier had achieved universal adoption across all major browser engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).

=== Standardization Trajectory === The World Wide Web Consortium (W3C) advanced the standard with a Working Draft in April 2006. The Level 2 specification, introduced in February 2008, augmented capabilities by adding event monitoring, support for cross-site requests, and byte stream handling. By late 2011, the Level 2 features were merged back into the primary specification. Development ownership subsequently transferred to WHATWG in 2012, which maintains the specification as a continuously evolving document defined using Web IDL.

== Operational Flow == Typical utilization of XMLHttpRequest involves a sequential programming process:

  1. Instantiation: Create an instance of the XMLHttpRequest object.
  2. Configuration: Invoke the open() method to define the HTTP method, target URI, and specify asynchronous versus synchronous execution.
  3. Event Listener Setup: For asynchronous requests, attach a callback function to monitor state transitions.
  4. Transmission: Start the request process via the send() method, potentially including payload data.
  5. Response Handling: Monitor the state changes in the listener. Upon reaching state 4 ("done"), the server's response is accessible, commonly within the responseText property.

Beyond these fundamentals, XHR offers extensive control, such as appending custom request headers, uploading data via the send() argument, parsing received responses directly into JavaScript objects (e.g., JSON), processing data streams incrementally, implementing request timeouts, or issuing premature aborts.

See Also

`