### Start CCXT-MCP Server (Default) Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md Starts the CCXT-MCP server with default configuration. Ensure CCXT-MCP is installed and in your PATH. ```bash ccxt-mcp ``` -------------------------------- ### Standard Startup Output Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Example output when starting the CCXT MCP Server with default or custom configuration. ```text [INFO] Starting CCXT MCP Server... [INFO] Loading config from: ~/.config/Claude/claude_desktop_config.json [INFO] Found 2 account(s) in configuration CCXT MCP Server started ``` -------------------------------- ### start() Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Starts the MCP server, initiating the transport layer after awaiting account loading. This method is crucial for bringing the server online. ```APIDOC ## start() ### Description Starts the MCP server using standard input/output transport. Awaits account loading before connecting transport. ### Method ```typescript async start(): Promise ``` ### Throws Error if account loading fails or transport connection fails. ### Request Example ```typescript const server = new CcxtMcpServer(); await server.start(); console.log('Server started successfully'); ``` ``` -------------------------------- ### Install and Run CCXT MCP Server Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Install the package globally and run it with default settings, or run without installation using npx. ```bash npm install -g @lazydino/ccxt-mcp ccxt-mcp ``` ```bash npx @lazydino/ccxt-mcp ``` -------------------------------- ### Basic Query Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md A simple example of a user request to compare Bitcoin prices across different exchanges. ```text Check and compare the current Bitcoin price on binance and coinbase. ``` -------------------------------- ### AccountConfig Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/types.md An example JSON object demonstrating how to configure a 'bybit' spot account. Ensure to replace placeholder API keys and secrets with your actual credentials. ```json { "name": "bybit_main", "exchangeId": "bybit", "apiKey": "YOUR_API_KEY", "secret": "YOUR_SECRET_KEY", "defaultType": "spot", "enableRateLimit": true, "timeout": 30000 } ``` -------------------------------- ### Common Tasks Examples Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md Examples demonstrating how to perform common tasks using the CCXT MCP Server tools. ```APIDOC ## Get Current Price ### Description Fetch the current price for a trading symbol on a specific exchange. ### Tool `fetchTicker` ### Parameters ```json { "exchangeId": "binance", "symbol": "BTC/USDT" } ``` ### Returns Current bid, ask, last price, 24h volume. ``` ```APIDOC ## Place a Buy Order ### Description Place a limit buy order for a trading symbol on an exchange. ### Tool `createOrder` ### Parameters ```json { "accountName": "bybit_main", "symbol": "BTC/USDT", "type": "limit", "side": "buy", "amount": 0.1, "price": 45000 } ``` ### Returns Order confirmation with ID. ``` ```APIDOC ## Check Account Balance ### Description Retrieve the balance details for a configured account. ### Tool `fetchBalance` ### Parameters ```json { "accountName": "bybit_main" } ``` ### Returns Balance for all currencies (free, used, total). ``` ```APIDOC ## Analyze Trading Performance ### Description Get a summary of trading performance over a specified period. ### Tool `analyzeTradingPerformance` ### Parameters ```json { "accountName": "bybit_main", "period": "30d" } ``` ### Returns Win rate, profit factor, total trades, net profit. ``` ```APIDOC ## Get Win Rate ### Description Calculate and retrieve the win rate metrics for an account over a specified period. ### Tool `calculateWinRate` ### Parameters ```json { "accountName": "bybit_main", "period": "30d" } ``` ### Returns Win rate %, R-multiple, average win/loss, expectancy. ``` ```APIDOC ## Monitor Price Across Exchanges ### Description Fetch ticker information for the same symbol across multiple exchanges to compare prices. ### Tool `fetchTicker` ### Parameters ```json [ { "exchangeId": "binance", "symbol": "BTC/USDT" }, { "exchangeId": "bybit", "symbol": "BTC/USDT" }, { "exchangeId": "coinbase", "symbol": "BTC/USDT" } ] ``` ### Returns Price comparison across exchanges. ``` -------------------------------- ### Standard Startup with Custom Config Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Starts the CCXT MCP Server using a specified custom configuration file. ```bash # Use custom config file ccxt-mcp --config /path/to/config.json ``` -------------------------------- ### CcxtMcpServer Methods Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/README.md Reference for the main server class methods, including starting the server, connecting transports, and getting exchange instances. ```APIDOC ## CcxtMcpServer ### Description Main server class with methods for exchange instance management. ### Methods - **start()**: Starts the CCXT MCP Server. - **connectTransport(transport)**: Connects to a specified transport. - **getExchangeInstance(exchangeId)**: Retrieves an instance of a configured exchange. - **stop()**: Stops the CCXT MCP Server. ``` -------------------------------- ### Basic CCXT MCP Server Commands Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Shows how to run the CCXT MCP Server using npm global installation, npx for no installation, or directly from source. ```bash # Using npm global installation ccxt-mcp [options] # Using npx (no installation required) npx @lazydino/ccxt-mcp [options] # From source npm start -- [options] node dist/index.js [options] ``` -------------------------------- ### Start CcxtMcpServer Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Start the MCP server. This method awaits account loading and then connects the transport. Ensure accounts are loaded successfully before proceeding. ```typescript const server = new CcxtMcpServer(); await server.start(); console.log('Server started successfully'); ``` -------------------------------- ### HTTP+SSE Mode Output Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Example output when starting the CCXT MCP Server in HTTP+SSE mode. ```text [INFO] Starting CCXT MCP Server... [INFO] CCXT MCP SSE server listening on http://127.0.0.1:2298 ``` -------------------------------- ### Start CCXT-MCP Server with Custom Configuration Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md Starts the CCXT-MCP server using a specified configuration file. This allows for customized settings like API keys and exchange details. ```bash ccxt-mcp --config /path/to/config.json ``` -------------------------------- ### JSON Configuration Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/types.md An example of a JSON configuration object for defining multiple trading accounts with their respective API keys and settings. ```json { "accounts": [ { "name": "trading_main", "exchangeId": "bybit", "apiKey": "xxx", "secret": "yyy", "defaultType": "spot", "timeout": 30000 } ] } ``` -------------------------------- ### Start CCXT MCP Server with SSE Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Starts the CCXT MCP server in SSE mode, listening on all interfaces and a specified port. Requires a configuration file. ```bash # Listen on all interfaces, port 8080 ccxt-mcp --sse --host 0.0.0.0 --port 8080 --config /etc/ccxt-mcp/config.json ``` -------------------------------- ### Example Configuration with Accounts Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md Ensure your configuration file includes an 'accounts' array with the correct structure for defining trading accounts. ```json { "accounts": [ { "name": "...", "exchangeId": "...", ... } ] } ``` -------------------------------- ### Install CCXT MCP Server Globally Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Install the CCXT MCP Server package globally on your system. ```bash npm install -g @lazydino/ccxt-mcp ``` -------------------------------- ### Standard Startup with Default Config Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Starts the CCXT MCP Server using the default configuration file located at ~/.config/Claude/claude_desktop_config.json. ```bash # Use default config (~/.config/Claude/claude_desktop_config.json) ccxt-mcp ``` -------------------------------- ### MCP Client Configuration Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md An example JSON configuration for an MCP client, including the bearer token and account details for an exchange. ```json { "mcpBearerToken": "YOUR_MCP_TOKEN", "accounts": [ { "name": "bybit_main", "exchangeId": "bybit", "apiKey": "YOUR_API_KEY", "secret": "YOUR_SECRET_KEY" } ] } ``` -------------------------------- ### Start CCXT MCP Server Programmatically Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/overview.md Instantiate and start the CCXT MCP server using its programmatic API. Ensure the path to the configuration file is correctly provided. ```typescript import { CcxtMcpServer } from './server.js'; const server = new CcxtMcpServer('/path/to/config.json'); await server.start(); ``` -------------------------------- ### HTTP+SSE Mode Startup (Local) Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Starts the CCXT MCP Server in HTTP+SSE mode, listening on the default localhost and port. ```bash # Start SSE server on default localhost:2298 ccxt-mcp --sse # With custom config ccxt-mcp --sse --config ./ccxt-config.json ``` -------------------------------- ### mcpBearerToken Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Example JSON snippet showing the mcpBearerToken configuration option. This token is used for client authentication in SSE mode. ```json { "mcpBearerToken": "e3f4c7a9d2b1f5e8c4d9a2b5f8e1c4d7a0b3c6d9e2f5a8b1c4d7e0a3b6c9" } ``` -------------------------------- ### Start CCXT-MCP SSE Server (HTTP) Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md Starts the CCXT-MCP server with Server-Sent Events (SSE) enabled over HTTP. Useful for real-time data streams. Specify host, port, and configuration file. ```bash ccxt-mcp --sse --host 0.0.0.0 --port 2298 --config config.json ``` -------------------------------- ### TypeScript CCXT Usage Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/types.md Demonstrates importing and using CCXT with custom account configuration to fetch balance and create an order. ```typescript import { Exchange } from 'ccxt'; import type { AccountConfig } from './server'; import type { Order, Trade, Balance } from 'ccxt'; const config: AccountConfig = { name: 'myaccount', exchangeId: 'binance', apiKey: 'xxx', secret: 'yyy', defaultType: 'spot' }; const exchange: Exchange = new Exchange(config); const balance: Balance = await exchange.fetchBalance(); const order: Order = await exchange.createOrder( 'BTC/USDT', 'limit', 'buy', 0.1, 45000 ); ``` -------------------------------- ### Configuration with Environment Variable Expansion Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md This example shows how to reference environment variables for sensitive credentials like API keys and secrets within the configuration file. Ensure these variables are set before running the server. ```json { "accounts": [ { "name": "main", "exchangeId": "binance", "apiKey": "${BINANCE_API_KEY}", "secret": "${BINANCE_API_SECRET}" } ] } ``` -------------------------------- ### CCXT MCP Server Configuration Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/overview.md Example JSON configuration for the CCXT MCP Server, detailing account credentials and connection options. Ensure sensitive information like API keys and secrets are handled securely. ```json { "mcpBearerToken": "token_for_sse_mode", "accounts": [ { "name": "account_identifier", "exchangeId": "exchange_name", "apiKey": "api_key", "secret": "api_secret", "defaultType": "spot|margin|future|swap|option", "enableRateLimit": true|false, "timeout": 30000, "verbose": true|false, "proxy": "proxy_url", "options": {} } ] } ``` -------------------------------- ### Advanced Trading: Detailed Analytics Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md An example of a request for detailed trading analytics, including win rate, profit factor, pattern identification, and monthly returns. ```text 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. ``` ```text Show me the monthly returns for my bybit_main account over the past 90 days and identify my best and worst trading months. ``` ```text 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. ``` -------------------------------- ### Production Configuration with All Options Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md This JSON configuration demonstrates a comprehensive setup for production, including multiple accounts with specific settings like default trading types, rate limiting, timeouts, and custom options for fetching trading fees. ```json { "mcpBearerToken": "e3f4c7a9d2b1f5e8c4d9a2b5f8e1c4d7a0b3c6d9e2f5a8b1c4d7e0a3b6c9", "accounts": [ { "name": "bybit_main", "exchangeId": "bybit", "apiKey": "${BYBIT_API_KEY}", "secret": "${BYBIT_API_SECRET}", "defaultType": "spot", "enableRateLimit": true, "timeout": 30000, "verbose": false, "options": { "fetchAccountTradingFees": true } }, { "name": "bybit_futures", "exchangeId": "bybit", "apiKey": "${BYBIT_API_KEY}", "secret": "${BYBIT_API_SECRET}", "defaultType": "swap", "enableRateLimit": true, "timeout": 30000, "options": { "defaultType": "swap" } } ] } ``` -------------------------------- ### Build CCXT MCP from Source Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Provides the necessary bash commands to clone the CCXT MCP repository, install dependencies, and build the project from source. ```bash # 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 ``` -------------------------------- ### Advanced Trading: Position Management Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md An example of an advanced trading request involving opening a futures position with specific capital, leverage, entry strategy, and stop loss conditions. ```text 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. ``` -------------------------------- ### Get Configured Account Names Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Retrieve a list of all account names that have been loaded from the configuration file. ```typescript const accounts = server.getAccountNames(); console.log('Available accounts:', accounts); // Output: ['bybit_main', 'bybit_futures', 'binance_main'] ``` -------------------------------- ### Client Configuration for SSE Mode Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Example JSON configuration for a client to connect to the CCXT MCP Server running in HTTP+SSE mode. ```json { "mcpServers": { "ccxt-mcp": { "command": "http", "url": "http://127.0.0.1:2298", "headers": { "Authorization": "Bearer YOUR_MCP_TOKEN" } } } } ``` -------------------------------- ### Advanced Trading: Performance Analysis Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md An example of a request to analyze trading performance over a specific period, focusing on win rate, average profit, and maximum consecutive losses. ```text 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. ``` -------------------------------- ### Account Configuration with Subaccount Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Example of an account configuration specifying a subaccount. This is relevant for exchanges like Bybit that support subaccount features for managing multiple trading entities under one main account. ```json { "name": "bybit_sub1", "exchangeId": "bybit", "apiKey": "xxx", "secret": "yyy", "subaccount": "subaccount_name" } ``` -------------------------------- ### Run CCXT MCP Server with npx Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Execute the CCXT MCP Server directly using npx without a global installation. Supports custom configuration files and viewing help. ```bash npx @lazydino/ccxt-mcp # Using custom configuration file npx @lazydino/ccxt-mcp --config /path/to/config.json ``` ```bash npx @lazydino/ccxt-mcp --help ``` -------------------------------- ### Instantiate and Use CCXT MCP Server Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md Create a CcxtMcpServer instance, retrieve an exchange instance by account name, and perform CCXT operations. The server can be started with the stdio transport or a custom transport. ```typescript import { CcxtMcpServer } from '@lazydino/ccxt-mcp/dist/server.js'; // Create server const server = new CcxtMcpServer('/path/to/config.json'); // Get exchange instance const exchange = server.getExchangeInstance('account_name'); // Use exchange directly (CCXT) const ticker = await exchange.fetchTicker('BTC/USDT'); const balance = await exchange.fetchBalance(); // Or start server with transports await server.start(); // Stdio transport // or await server.connectTransport(customTransport); ``` -------------------------------- ### CCXT MCP Server Separate Configuration File Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Example of using a separate configuration file for CCXT MCP Server, passed via the --config argument. This file contains essential settings like bearer token and accounts. ```bash ccxt-mcp --config /path/to/ccxt-config.json ``` ```json { "mcpBearerToken": "YOUR_TOKEN", "accounts": [ { "name": "...", "exchangeId": "...", ... } ] } ``` -------------------------------- ### Enable Debug Logging for CCXT MCP Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Examples for enabling verbose or debug logging for the CCXT MCP server. This can be done via environment variables or command-line flags. ```bash # Enable debug output (if implemented) DEBUG=ccxt-mcp:* ccxt-mcp --config config.json ``` ```bash # Increase logging ccxt-mcp --config config.json --verbose ``` -------------------------------- ### Account Configuration with Password Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Example of an account configuration that includes an optional password field. This is used by exchanges like FTX that require an additional password for authentication. ```json { "name": "ftx_account", "exchangeId": "ftx", "apiKey": "xxx", "secret": "yyy", "password": "zzz" } ``` -------------------------------- ### Win Rate Response Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/analysis-tools.md This JSON object represents the response for win rate analysis, including trade counts, win/loss statistics, profit factor, and R-multiple. ```json { "totalTrades": 100, "completedPositions": 85, "winCount": 51, "lossCount": 34, "winRate": "60.00%", "profitFactor": "2.45", "averageWin": "125.50", "averageLoss": "51.25", "rMultiple": "2.45" } ``` -------------------------------- ### Periodic Returns Response Example Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/analysis-tools.md This JSON object details periodic returns analysis, showing interval statistics, total profit, profitable periods, and a list of returns for each period. ```json { "interval": "daily", "totalPeriods": 30, "totalProfit": "3500.00", "averagePeriodProfit": "116.67", "profitablePeriods": 18, "lossPeriods": 12, "profitablePeriodRatio": "60.00%", "bestPeriod": { "period": "2024-06-01", "profit": "450.00", "trades": 5 }, "periodicReturns": [ { "period": "2024-06-01", "profit": "350.00", "trades": 4 }, { "period": "2024-06-02", "profit": "-75.50", "trades": 3 } ] } ``` -------------------------------- ### Remote Client Configuration for SSE Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Example JSON configuration for a remote client to connect to the CCXT MCP SSE server. Includes server URL and authentication headers. ```json { "mcpServers": { "ccxt-mcp": { "command": "http", "url": "http://server-hostname:8080", "headers": { "Authorization": "Bearer YOUR_MCP_TOKEN" } } } } ``` -------------------------------- ### Instantiate CcxtMcpServer Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Initialize the MCP server. Use the default configuration path or provide a custom path to a JSON file containing account credentials. ```typescript const server = new CcxtMcpServer(); ``` ```typescript const server = new CcxtMcpServer('/path/to/custom-config.json'); ``` -------------------------------- ### CcxtMcpServer Constructor Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Initializes the MCP server, loads accounts from configuration, and registers resources. It can use a default configuration path or a custom one. ```APIDOC ## CcxtMcpServer Constructor ### Description Initializes the MCP server, loads accounts from configuration file, and registers all available resources and tools. ### Parameters #### Path Parameters - **configPath** (string) - Optional - Path to configuration file containing account credentials. Defaults to `~/.config/Claude/claude_desktop_config.json`. ### Request Example ```typescript // Using default config path const server = new CcxtMcpServer(); // Using custom config path const server = new CcxtMcpServer('/path/to/custom-config.json'); ``` ``` -------------------------------- ### Get Ticker Data for All Symbols on an Exchange Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Retrieves ticker data for all available trading pairs on a specified exchange. This is useful for getting a broad overview of market activity across an entire exchange. ```text tickers://exchange/binance tickers://exchange/bybit ``` -------------------------------- ### Docker: Build and Run CCXT MCP Server Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Instructions for building the Docker image and running the CCXT MCP server using Docker Compose. Includes steps for configuration and verification. ```bash # Create a config file: cp config/ccxt-config.example.json config/ccxt-config.json Then fill in your real API keys in `config/ccxt-config.json`. Also set `mcpBearerToken` in that same config file. # Build image: docker compose build # Start the MCP server in background (SSE mode on localhost:2298): docker compose up -d # Verify local health endpoint: curl -H "Authorization: Bearer YOUR_MCP_TOKEN" http://127.0.0.1:2298/healthz ``` -------------------------------- ### Display Help Message Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Use the -h or --help flags to display the help message, which lists all available command-line options. ```bash ccxt-mcp --help ``` -------------------------------- ### Get Exchange Info Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Fetches detailed information about a specific exchange, including its capabilities, metadata, and supported features. ```APIDOC ## GET exchange://info/{exchangeId} ### Description Detailed information about a specific exchange. ### Method GET ### Endpoint exchange://info/{exchangeId} ### Parameters #### Path Parameters - **exchangeId** (string) - Required - Exchange identifier (e.g., 'binance') ### Returns JSON object with exchange capabilities and metadata. ### Response Example ```json { "id": "binance", "name": "Binance", "countries": ["CN"], "urls": { "logo": "...", "api": "...", "www": "..." }, "version": "1", "certified": true, "pro": true, "has": { "spot": true, "margin": true, "future": true, "swap": true, "option": false, "fetchTicker": true, "fetchTickers": true, "fetchOrderBook": true, "fetchTrades": true, "fetchOHLCV": true, "createOrder": true, "cancelOrder": true }, "timeframes": { "1m": "1m", "5m": "5m", "1h": "1h", "1d": "1d", ... }, "requiredCredentials": { "apiKey": true, "secret": true, "password": false }, "precisionMode": "DECIMAL_PLACES", "limitRate": 1200, "fees": { "trading": { "maker": 0.001, "taker": 0.001 } } } ``` ``` -------------------------------- ### Specify Custom Configuration File Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md Use the --config option to load account credentials from a custom JSON file instead of the default. ```bash # Use custom config file ccxt-mcp --config /etc/ccxt-mcp/config.json # Use config from current directory ccxt-mcp --config ./ccxt-config.json # Use config from home directory ccxt-mcp --config ~//trading-config.json ``` -------------------------------- ### Fetch All Withdrawals Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/account-tools.md Retrieves all withdrawal history for a specified account. Use this to get a complete record of past withdrawals. ```typescript const withdrawals = await account.fetchWithdrawals({ accountName: 'bybit_main' }); ``` -------------------------------- ### Get Supported CCXT Exchanges Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md Retrieve a list of exchanges supported by your CCXT version using the 'ccxt.exchanges' command. ```javascript ccxt.exchanges ``` -------------------------------- ### Help Message Output Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md The output of the --help command shows the server's usage and available options. ```text CCXT MCP Server Usage: node dist/index.js [options] Options: --config Path to config JSON file --sse Run as HTTP+SSE server for remote MCP clients --host Host bind address for --sse mode (default: 127.0.0.1) --port Port for --sse mode (default: 2298) -h, --help Show this help message ``` -------------------------------- ### Fetch All Trades Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/account-tools.md Retrieves all personal trade history for a specified account. Use this to get a complete record of your trading activity. ```typescript const allTrades = await account.fetchMyTrades({ accountName: 'bybit_main' }); ``` -------------------------------- ### Run CCXT MCP Server with External Configuration File Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Launch the CCXT MCP Server using a custom configuration file specified via the --config flag in the command line. ```bash npx @lazydino/ccxt-mcp --config /path/to/ccxt-config.json ``` -------------------------------- ### Configuration for Multiple Exchanges Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Sets up accounts for multiple different exchanges, including spot and futures/swap trading on Bybit. ```json { "mcpBearerToken": "your_token_here", "accounts": [ { "name": "binance_main", "exchangeId": "binance", "apiKey": "binance_key", "secret": "binance_secret", "defaultType": "spot" }, { "name": "bybit_main", "exchangeId": "bybit", "apiKey": "bybit_key", "secret": "bybit_secret", "defaultType": "spot" }, { "name": "bybit_futures", "exchangeId": "bybit", "apiKey": "bybit_key", "secret": "bybit_secret", "defaultType": "swap" } ] } ``` -------------------------------- ### Get Specific Market Info Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Fetches detailed information for a specific trading market/symbol on a given exchange, including precision and limits. ```APIDOC ## GET market://exchange/{exchangeId}/{symbol} ### Description Detailed information for a specific market/symbol. ### Method GET ### Endpoint market://exchange/{exchangeId}/{symbol} ### Parameters #### Path Parameters - **exchangeId** (string) - Required - Exchange identifier - **symbol** (string) - Required - Trading symbol (e.g., 'BTC/USDT') ### Returns Market object with trading parameters. ### Response Example ```json { "id": "BTCUSDT", "symbol": "BTC/USDT", "base": "BTC", "quote": "USDT", "baseId": "BTC", "quoteId": "USDT", "active": true, "type": "spot", "spot": true, "margin": false, "swap": false, "future": false, "option": false, "maker": 0.001, "taker": 0.001, "precision": { "amount": 5, "base": 8, "quote": 8, "price": 2 }, "limits": { "amount": { "min": 0.00001, "max": 10000 }, "price": { "min": 0.01, "max": 1000000 }, "cost": { "min": 10, "max": 500000 } } } ``` ``` -------------------------------- ### Setting Environment Variables and Running CCXT-MCP Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md This bash script demonstrates how to export environment variables for API keys and then launch the CCXT-MCP server using a configuration file. This is a common practice for securely managing credentials. ```bash export BINANCE_API_KEY="your_key" export BINANCE_API_SECRET="your_secret" ccxt-mcp --config config.json ``` -------------------------------- ### Get Exchange Information Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Fetch detailed information about a specific exchange, including its capabilities, metadata, and supported features. Requires an exchangeId. ```json { "id": "binance", "name": "Binance", "countries": ["CN"], "urls": { "logo": "...", "api": "...", "www": "..." }, "version": "1", "certified": true, "pro": true, "has": { "spot": true, "margin": true, "future": true, "swap": true, "option": false, "fetchTicker": true, "fetchTickers": true, "fetchOrderBook": true, "fetchTrades": true, "fetchOHLCV": true, "createOrder": true, "cancelOrder": true }, "timeframes": { "1m": "1m", "5m": "5m", "1h": "1h", "1d": "1d", ... }, "requiredCredentials": { "apiKey": true, "secret": true, "password": false }, "precisionMode": "DECIMAL_PLACES", "limitRate": 1200, "fees": { "trading": { "maker": 0.001, "taker": 0.001 } } } ``` -------------------------------- ### Production Startup Script for CCXT MCP Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/cli.md A bash script to manage the startup and shutdown of the CCXT MCP server in a production environment. It handles logging and PID file management. ```bash #!/bin/bash # start-ccxt-mcp.sh CCXT_HOME="/opt/ccxt-mcp" CONFIG_FILE="/opt/ccxt-mcp/config.json" LOG_FILE="/var/log/ccxt-mcp.log" PID_FILE="/var/run/ccxt-mcp.pid" start() { echo "Starting CCXT MCP Server..." npx @lazydino/ccxt-mcp \ --sse \ --host 127.0.0.1 \ --port 2298 \ --config "$CONFIG_FILE" \ > "$LOG_FILE" 2>&1 & echo $! > "$PID_FILE" echo "Started with PID: $(cat $PID_FILE)" } stop() { if [ -f "$PID_FILE" ]; then kill $(cat "$PID_FILE") rm "$PID_FILE" echo "Stopped CCXT MCP Server" fi } case "$1" in start) start ;; stop) stop ;; *) echo "Usage: $0 {start|stop}" ;; esac ``` -------------------------------- ### Test Bybit API Connectivity Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md Send a request to the Bybit API to get the current market time, verifying connectivity to the Bybit exchange. ```bash # Test Bybit API curl https://api.bybit.com/v5/market/time ``` -------------------------------- ### Analyze Trading Performance Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md Get an overview of trading performance for a specified account and period, including win rate, profit factor, and net profit. ```javascript Tool: analyzeTradingPerformance Parameters: { accountName: "bybit_main", period: "30d" } Returns: Win rate, profit factor, total trades, net profit ``` -------------------------------- ### Simple Spot Trading Account Configuration Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Basic configuration for a single spot trading account using CCXT MCP. ```json { "mcpBearerToken": "your_token_here", "accounts": [ { "name": "binance_main", "exchangeId": "binance", "apiKey": "your_api_key", "secret": "your_secret" } ] } ``` -------------------------------- ### Check Specific Account Configuration Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md Use 'jq' to inspect the configuration of a specific account within the JSON file. This is useful for verifying account details. ```bash # Check for specific issues jq '.accounts[0]' config.json ``` -------------------------------- ### Get Exchange Capabilities Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Retrieves detailed information about an exchange's capabilities, including supported features like fetching OHLCV data and spot trading. ```APIDOC ## exchange://info/{exchangeId} ### Description Get detailed information about an exchange's capabilities. ### Method GET ### Endpoint exchange://info/{exchangeId} ### Parameters #### Path Parameters - **exchangeId** (string): Exchange identifier ### Response #### Success Response Returns detailed info including `has.fetchOHLCV`, `has.spot`, etc. ### Response Example ```json { "id": "binance", "name": "Binance", "countries": ["CN"], "urls": { "api": { "public": "https://api.binance.com", "private": "https://api.binance.com", "ws": "wss://stream.binance.com:9600/ws" }, "www": "https://www.binance.com", "referral": "https://www.binance.com/en/register?ref=12345678" }, "has": { "fetchOHLCV": true, "spot": true, "margin": true, "future": true, "fundingFees": true, "fetchMyTrades": true, "fetchOrderBook": true }, "timeframes": { "1m": "1m", "3m": "3m", "5m": "5m" } } ``` ``` -------------------------------- ### Get Specific Market Information Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Fetch detailed information for a specific market/symbol on an exchange, including trading parameters, precision, and limits. Requires exchangeId and symbol. ```json { "id": "BTCUSDT", "symbol": "BTC/USDT", "base": "BTC", "quote": "USDT", "baseId": "BTC", "quoteId": "USDT", "active": true, "type": "spot", "spot": true, "margin": false, "swap": false, "future": false, "option": false, "maker": 0.001, "taker": 0.001, "precision": { "amount": 5, "base": 8, "quote": 8, "price": 2 }, "limits": { "amount": { "min": 0.00001, "max": 10000 }, "price": { "min": 0.01, "max": 1000000 }, "cost": { "min": 10, "max": 500000 } } } ``` -------------------------------- ### Verify Config File Existence Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md Use the 'ls -l' command to check if the configuration file exists at the specified path and verify read permissions. ```bash ls -l /path/to/config.json ``` ```bash chmod 600 config.json ``` -------------------------------- ### Get Authenticated CCXT Exchange Instance Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Retrieve an authenticated CCXT exchange instance for a configured account. The account name must exist in the loaded configuration. ```typescript const exchange = server.getExchangeInstance('bybit_main'); const balance = await exchange.fetchBalance(); ``` -------------------------------- ### Set Exchange-Specific Options Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/configuration.md Passes exchange-specific options directly to CCXT. This example enables fetching account trading fees and overrides the default market type to 'spot'. ```json { "name": "binance_main", "exchangeId": "binance", "apiKey": "xxx", "secret": "yyy", "options": { "fetchAccountTradingFees": true, "defaultType": "spot" } } ``` -------------------------------- ### CCXT MCP Server Configuration - Separate File Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/README.md Set up account information in a separate configuration file (e.g., ccxt-config.json) for better organization and security. This file should contain an 'accounts' array at the root. ```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" } ] } ``` -------------------------------- ### Resource Quick Reference Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/quick-reference.md URIs for accessing various resources related to exchanges and market data. ```APIDOC ## Exchanges List ### URI Template `exchanges://list` ### Purpose Retrieve a list of all supported exchanges. ``` ```APIDOC ## Exchange Info ### URI Template `exchange://info/{exchangeId}` ### Purpose Get detailed information about a specific exchange's capabilities. ``` ```APIDOC ## Markets ### URI Template `markets://exchange/{exchangeId}` ### Purpose Retrieve all trading markets available on a specific exchange. ``` ```APIDOC ## Market ### URI Template `market://exchange/{exchangeId}/{symbol}` ### Purpose Get details for a single trading market on an exchange. ``` ```APIDOC ## Ticker ### URI Template `ticker://exchange/{exchangeId}/{symbol}` ### Purpose Get the current ticker information for a specific trading symbol. ``` ```APIDOC ## Tickers ### URI Template `tickers://exchange/{exchangeId}` ### Purpose Get ticker information for all trading symbols on an exchange. ``` ```APIDOC ## Order Book ### URI Template `orderbook://exchange/{exchangeId}/{symbol}/{limit?}` ### Purpose Get the order book (bid/ask depth) for a specific trading symbol. ``` ```APIDOC ## L2 Order Book ### URI Template `l2orderbook://exchange/{exchangeId}/{symbol}` ### Purpose Get the Level 2 order book depth for a specific trading symbol. ``` -------------------------------- ### Ticker Data for All Markets on an Exchange Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Retrieves ticker data for all available trading pairs on a specified exchange. This is useful for getting a comprehensive overview of market activity on an exchange. ```APIDOC ## tickers://exchange/{exchangeId} ### Description Ticker data for all markets on an exchange. ### Method GET ### Endpoint tickers://exchange/{exchangeId} ### Parameters #### Path Parameters - **exchangeId** (string): Exchange identifier ### Response #### Success Response Returns a JSON object mapping all symbols to ticker objects (same format as single ticker above). ### Response Example ```json { "BTC/USDT": { "symbol": "BTC/USDT", "timestamp": 1623369600000, "datetime": "2021-06-10T14:00:00Z", "high": 35200.00, "low": 34200.00, "bid": 34989.50, "bidVolume": 2.5, "ask": 34989.51, "askVolume": 3.2, "open": 34500.00, "close": 34800.00, "last": 34800.00, "previousClose": 34500.00, "change": 300.00, "percentage": 0.87, "average": 34894.75, "baseVolume": 250.5, "quoteVolume": 8721375.25, "vwap": 34850.30 }, "ETH/USDT": { ... } } ``` ``` -------------------------------- ### Fetch Recent Withdrawals Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/account-tools.md Retrieves recent withdrawal history based on a timestamp. Use this to get withdrawals made within a specific recent period, like the last week. ```typescript const recent = await account.fetchWithdrawals({ accountName: 'bybit_main', since: Date.now() - 7 * 24 * 60 * 60 * 1000 }); ``` -------------------------------- ### Validate Configuration JSON Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md Use the 'jq' command-line tool to validate the format of your configuration JSON file. This helps catch syntax errors before deployment. ```bash # Validate JSON jq . config.json ``` -------------------------------- ### Get Public CCXT Exchange Instance Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/ccxt-mcp-server.md Create or retrieve a public, unauthenticated CCXT exchange instance. Specify the exchange ID and optionally the market type ('spot' or 'futures'). ```typescript const exchange = server.getPublicExchangeInstance('binance', 'spot'); const ticker = await exchange.fetchTicker('BTC/USDT'); const futuresExchange = server.getPublicExchangeInstance('bybit', 'futures'); const markets = await futuresExchange.loadMarkets(); ``` -------------------------------- ### Account Configuration Not Found Error Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/errors.md This error occurs when the tool attempts to use an account name that was not successfully loaded. Verify the account name spelling and ensure the configuration was loaded correctly. ```text Error creating order for account 'nonexistent': Account configuration not found or failed to load for: nonexistent ``` -------------------------------- ### Create Order with Exchange-Specific Parameters (Binance) Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/order-tools.md Creates an order, passing exchange-specific parameters like stop price for Binance. ```typescript const order = await orders.createOrder({ accountName: 'binance_main', symbol: 'BTC/USDT', type: 'limit', side: 'buy', amount: 0.01, price: 45000, params: { stopPrice: 44000 // Stop loss price } }); ``` -------------------------------- ### Get Ticker Data for a Specific Symbol Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/resources.md Fetches current price and volume data for a given trading pair on an exchange. Use this to monitor real-time market conditions for a single symbol. ```text ticker://exchange/binance/BTC/USDT ticker://exchange/bybit/ETH/USDT ticker://exchange/coinbase/XRP/USD ``` -------------------------------- ### Analyze Trading Performance Source: https://github.com/lazy-dinosaur/ccxt-mcp/blob/master/_autodocs/api-reference/analysis-tools.md Use this tool to get a comprehensive performance analysis for a specified period. You can filter by symbol and choose analysis periods like '7d', '30d', '90d', or 'all'. ```typescript const analysis = await analysis.analyzeTradingPerformance({ accountName: 'bybit_main', period: '30d' }); ``` ```typescript const btcAnalysis = await analysis.analyzeTradingPerformance({ accountName: 'bybit_main', symbol: 'BTC/USDT', period: '90d' }); ``` ```typescript const allTime = await analysis.analyzeTradingPerformance({ accountName: 'bybit_main', period: 'all' }); ```