⚠️ Work in Progress: This project is currently under active development. Features and APIs may change without notice. Use in production environments at your own risk.
MCP (Model Context Protocol) server that exposes CCXT cryptocurrency exchange APIs via Server-Sent Events (SSE). This server provides 24 comprehensive tools for interacting with multiple cryptocurrency exchanges.
IMPORTANT: This server includes multiple layers of security to prevent accidental or malicious trading operations:
- 🛡️ SAFE_MODE: Disable all trading operations, only read-only access
- ⏱️ Rate Limiting: Prevent burst of orders (max 10 orders/minute per session)
- 📝 Enhanced Logging: Full audit trail of all trading operations
- 🔍 Tool Classification: Clear separation between safe vs dangerous tools
- 🚨 Security Checks: Multiple validation layers before executing trades
See SECURITY.md for complete security documentation.
For maximum security (recommended for production):
# .env
SAFE_MODE=true # Disables ALL trading operationsWith SAFE_MODE enabled:
- ✅ Can read: balances, markets, prices, orders, history
- ❌ Cannot: place orders, cancel orders, transfer funds
- 🌐 Web-based MCP server using SSE transport
- 💱 Multiple exchange support: Binance, Coinbase, Kraken, Bitfinex, Bybit
- 🔧 24 comprehensive tools (13 public + 11 private)
- 🔐 Environment-based credentials management
- 🛡️ Advanced security features (SAFE_MODE, rate limiting, audit logs)
- 📊 Public APIs: Market data, tickers, orderbooks, OHLCV, trades, funding rates
- 💰 Private APIs: Account balance, order management, futures trading, fund transfers
- 🔄 Session-based transport with UUID tracking
- 📝 Detailed logging for debugging
npm installCreate a .env file in the root directory:
# ==========================================
# Security Configuration
# ==========================================
# SAFE_MODE: Disable ALL trading operations
# Recommended: true for production
SAFE_MODE=false
# ==========================================
# Server Configuration
# ==========================================
HOST=0.0.0.0
PORT=3000
LOG_LEVEL=info
DEFAULT_EXCHANGE=coinbase
# ==========================================
# Exchange API Credentials
# ==========================================
# Only needed for private tools (balance, orders, etc)
# Leave empty to use public tools only
BINANCE_API_KEY=your_binance_api_key
BINANCE_SECRET=your_binance_secret
COINBASE_API_KEY=your_coinbase_api_key
COINBASE_SECRET=your_coinbase_secret
KRAKEN_API_KEY=your_kraken_api_key
KRAKEN_SECRET=your_kraken_secret
# Add credentials for other exchanges as neededSecurity Recommendations:
- Always enable SAFE_MODE unless trading is explicitly required
- Use separate API keys for read-only vs trading operations
- Enable IP restrictions on exchange API keys
- Never commit
.envfile to version control - See SECURITY.md for complete security guide
npm startThe server will start on http://0.0.0.0:3000 (or your configured HOST/PORT).
- SSE Stream:
GET http://localhost:3000/sse- Establishes SSE connection - Messages:
POST http://localhost:3000/message?sessionId=<uuid>- Handles MCP messages - Health Check:
GET http://localhost:3000/health- Server health status - Info:
GET http://localhost:3000/- Server information - Stats:
GET http://localhost:3000/stats- Server statistics
- list_exchanges - List all available exchanges
- get_ticker - Get current ticker for a trading pair
- batch_get_tickers - Get multiple tickers at once
- get_orderbook - Get market order book
- get_ohlcv - Get candlestick data
- get_trades - Get recent trades
- get_markets - List all available markets
- get_exchange_info - Get exchange information
- get_leverage_tiers - Get futures leverage tiers
- get_funding_rates - Get perpetual futures funding rates
- get_positions - Get open positions (public data)
- get_open_orders - Get open orders (public data)
- get_order_history - Get order history (public data)
- account_balance - Get account balance
- place_market_order - Place market order
⚠️ - place_limit_order - Place limit order
⚠️ - cancel_order - Cancel specific order
- cancel_all_orders - Cancel all orders
- set_leverage - Set futures leverage
- set_margin_mode - Set margin mode (isolated/cross)
- place_futures_market_order - Place futures market order
⚠️ - place_futures_limit_order - Place futures limit order
⚠️ - transfer_funds - Transfer funds between accounts
npm testnode test-extended.js{
"name": "get_ticker",
"arguments": {
"symbol": "BTC/USDT",
"exchange": "binance"
}
}{
"name": "batch_get_tickers",
"arguments": {
"symbols": ["BTC/USDT", "ETH/USDT", "BNB/USDT"]
}
}{
"name": "list_exchanges",
"arguments": {
"certified": false
}
}{
"name": "account_balance",
"arguments": {
"exchange": "binance"
}
}{
"name": "place_limit_order",
"arguments": {
"symbol": "BTC/USDT",
"side": "buy",
"amount": 0.001,
"price": 50000
}
}mcp-server-ccxt/
├── index.js # Main server
├── src/
│ ├── mcpServer.js # MCP server
│ ├── config/
│ │ └── config.js # Configuration
│ ├── tools/
│ │ ├── publicTools.js # 13 public tools
│ │ └── privateTools.js # 10 private tools
│ └── utils/
│ └── exchangeManager.js # Exchange manager
├── test-mcp-client.js # Basic tests
├── test-extended.js # Extended tests
└── .env # Environment variables
- Install MCP connector in n8n
- Configure server URL:
http://your-server:3000 - Use tools in workflows
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
const client = new Client({
name: "my-client",
version: "1.0.0",
}, { capabilities: {} });
const transport = new SSEClientTransport(
new URL("http://localhost:3000/sse")
);
await client.connect(transport);
const result = await client.callTool({
name: "get_ticker",
arguments: { symbol: "BTC/USDT" },
});
console.log(result.content[0].text);- Never commit
.envfile to version control - Trading tools execute real trades with real money
- Use HTTPS in production
- Restrict access with firewall rules
- Be aware of rate limits on exchanges
- Coinbase (default)
- Binance
- Kraken
- Bitfinex
- Bybit
CCXT supports 100+ exchanges. Add credentials in .env to enable more.
- Check port 3000 is not in use
- Verify
.envfile exists - Check logs for errors
- Restart server after code changes
- Check tool definitions
- Review server logs
- Verify API keys in
.env - Check exchange name (lowercase)
- Ensure proper API permissions
MIT
Contributions welcome! Please:
- Fork the repository
- Create feature branch
- Add tests
- Submit pull request