crypto-mcp-server

cryptomcp/crypto-mcp-server

3.3

If you are the rightful owner of crypto-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

MCP Crypto Bot is a production-ready Model Context Protocol (MCP) server designed for automating crypto trading with AI decision support.

Tools
5
Resources
0
Prompts
0

MCP Crypto Bot (Python)

MCP

Production-ready Model Context Protocol (MCP) server for crypto trading automation with AI decision support.

๐Ÿš€ Features

Core Functionality

  • Multi-Exchange Support: CEX (Binance, etc.), EVM chains, Solana
  • AI Decision Engine: OpenAI GPT-4, Google Gemini, DeepSeek integration
  • Telegram Bot: Real-time management and notifications
  • Risk Management: Configurable limits and safety checks
  • Wallet Management: EVM and Solana wallet creation/import/export
  • Portfolio Tracking: Real-time balance and position monitoring

Trading Features

  • CEX Trading: Spot orders, OHLCV data, balance management
  • DEX Integration: 0x swaps on EVM, Jupiter swaps on Solana
  • Token Transfers: ERC20 and SPL token transfers
  • AI Trading Assistant: Intelligent trade recommendations with risk assessment
  • News Trading: Real-time news monitoring, sentiment analysis, and AI-powered trading decisions

๐Ÿ“‹ Requirements

  • Python 3.11+
  • Linux/macOS/Windows
  • API keys for exchanges and AI providers

๐Ÿ› ๏ธ Installation

Option 1: One-liner Installation (Recommended)

# Install with pipx (isolated environment)
pipx install mcp-crypto-bot

# Or with uv (fast package manager)
uvx install mcp-crypto-bot

# Run from anywhere
mcp-crypto-bot

Option 2: Manual Installation

# Clone repository
git clone https://github.com/cryptomcp/crypto-ai-mcp-server.git
cd crypto-ai-mcp-server

# Install in development mode
pip install -e .

# Or using uv (recommended)
uv pip install -e .

Environment Configuration

cp .env.example .env
# Edit .env with your API keys and settings

๐Ÿš€ Usage

Quick Start

# Start the MCP server
mcp-crypto-bot

# Or with custom environment
TELEGRAM_BOT_TOKEN=your_token mcp-crypto-bot

MCP Inspector Integration

# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector

# Run with Inspector
npx @modelcontextprotocol/inspector -- mcp-crypto-bot

# With environment injection
npx @modelcontextprotocol/inspector --env-file .env -- mcp-crypto-bot

๐Ÿ› ๏ธ MCP Tools & Resources

Available Tools

  • CEX Trading: Price checks, order placement, balance management
  • EVM Operations: Token transfers, DEX swaps, NFT operations
  • Solana Support: SPL token transfers, Jupiter swaps, wallet management
  • AI Decision Engine: Intelligent trading recommendations
  • Portfolio Management: Balance tracking and portfolio snapshots
  • News Trading: News monitoring, sentiment analysis, trending analysis, custom conditions

Available Resources

  • resource: wallets: List current EVM and Solana wallets
  • resource: candles://{venue}/{symbol}/{timeframe}: Real-time OHLCV data

News Trading Features

  • Real-time News Monitoring: RSS feeds, APIs, web scraping from multiple sources
  • Sentiment Analysis: AI-powered sentiment analysis with OpenAI, Gemini, and TextBlob
  • Custom Trading Conditions: Rule-based trading with sentiment, frequency, keyword, and trending conditions
  • Trending Analysis: Multi-platform trending coin detection and ranking
  • AI Decision Making: Intelligent trading decisions based on news and market data
  • Risk Management: Position sizing, stop-loss, take-profit, and daily limits
  • Trading Modes: Manual, AI-assisted, and fully automated trading

Example Usage

from mcp import ClientSession

async with ClientSession() as session:
    # Get wallet information
    wallets = await session.read_resource("resource: wallets")
    
    # Get market data
    candles = await session.read_resource("resource: candles://binance/BTC/USDT/1h")
    
    # Execute trading operations
    result = await session.call_tool("cex_get_price", {"symbol": "BTC/USDT"})

โš™๏ธ Configuration

Environment Variables

VariableDescriptionRequiredDefault
LIVEEnable live trading (0=test, 1=live)Yes0
AM_I_SURESafety confirmation for live tradingYesNO
MAX_ORDER_USDMaximum order size in USDYes100
DAILY_LOSS_LIMIT_USDDaily loss limit in USDYes200
TELEGRAM_BOT_TOKENTelegram bot tokenNo-
OWNER_TELEGRAM_IDYour Telegram user IDNo-
OPENAI_API_KEYOpenAI API key for AI decisionsNo-
GOOGLE_API_KEYGoogle AI API keyNo-
DEEPSEEK_API_KEYDeepSeek API keyNo-
BINANCE_API_KEYBinance API keyNo-
BINANCE_SECRETBinance secret keyNo-
ETHEREUM_RPC_URLEthereum RPC endpointNo-
SOLANA_RPC_URLSolana RPC endpointNo-

Safety Configuration

# Test mode (safe)
LIVE=0
AM_I_SURE=NO
MAX_ORDER_USD=100
DAILY_LOSS_LIMIT_USD=200

# Live trading (dangerous - only if you know what you're doing)
LIVE=1
AM_I_SURE=YES
MAX_ORDER_USD=1000
DAILY_LOSS_LIMIT_USD=1000

๐Ÿ“š Documentation

View the full documentation at docs.cryptomcp.github.io

๐Ÿƒโ€โ™‚๏ธ Running Documentation Locally

# 1. Navigate to docs directory
cd docs

# 2. Install dependencies
npm install

# 3. Start development server
npm run start

# 4. Open browser to http://localhost:3000

๐Ÿ—๏ธ Building Documentation

# Build for production
npm run build

# Serve built documentation locally
npm run serve

๐Ÿš€ Deploying to GitHub Pages

# Deploy to GitHub Pages
npm run deploy

# Documentation will be available at:
# https://cryptomcp.github.io/crypto-ai-mcp-server/

โš ๏ธ Risk Management

Safety Features

  • Double Confirmation: LIVE=1 AND AM_I_SURE=YES required
  • Order Limits: MAX_ORDER_USD enforces maximum trade size
  • Loss Limits: DAILY_LOSS_LIMIT_USD prevents excessive losses
  • Dry Run Mode: Test all operations with dry_run: true
  • Risk Assessment: AI evaluates all trade recommendations

Critical Safety Rules

  1. Never set LIVE=1 without AM_I_SURE=YES
  2. Always test with dry_run: true first
  3. Monitor daily loss limits
  4. Backup wallet private keys securely
  5. Start Small: Begin with small amounts

๐Ÿงช Testing

Unit Tests

pytest tests/

Integration Tests

pytest tests/ -m integration

Manual Testing

# Start server in test mode
LIVE=0 python src/server.py

# Use MCP inspector
npx @modelcontextprotocol/inspector -- python src/server.py

๐Ÿ—๏ธ Architecture

src/
โ”œโ”€โ”€ server.py              # MCP server bootstrap
โ”œโ”€โ”€ mcp_tools.py           # All MCP tool definitions
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ env.py            # Environment configuration
โ”œโ”€โ”€ cex/
โ”‚   โ””โ”€โ”€ ccxt_client.py    # CEX trading client
โ”œโ”€โ”€ evm/
โ”‚   โ””โ”€โ”€ evm_client.py     # EVM blockchain client
โ”œโ”€โ”€ solana/
โ”‚   โ””โ”€โ”€ solana_client.py  # Solana blockchain client
โ”œโ”€โ”€ wallets/              # Wallet management
โ”œโ”€โ”€ portfolio/            # Portfolio tracking
โ”œโ”€โ”€ ai/                   # AI decision engine
โ”‚   โ”œโ”€โ”€ engine.py
โ”‚   โ””โ”€โ”€ prompts.py
โ”œโ”€โ”€ telegram/
โ”‚   โ””โ”€โ”€ bot.py           # Telegram bot
โ””โ”€โ”€ logging.py           # Logging configuration

๐Ÿ”ง Development

Adding New Tools

  1. Define Pydantic model in mcp_tools.py
  2. Implement tool function with @mcp.tool() decorator
  3. Add error handling and logging
  4. Update tests

Adding New AI Providers

  1. Add provider to AIProvider enum
  2. Implement query method in AIDecisionEngine
  3. Add to ensemble logic if desired
  4. Update configuration

๐Ÿ“ API Reference

Response Format

All tools return structured JSON:

{
  "success": true|false,
  "data": { ... } | null,
  "error": "error message" | null
}

Error Handling

  • Network errors are automatically retried
  • Validation errors return descriptive messages
  • Risk violations prevent execution
  • All errors are logged with context

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit pull request

24/7 Live Support

We provide 24/7 live support with guaranteed instant response to all requests.

  • All requests are acknowledged within 5 minutes.
  • Support is available 7 days a week, 24 hours a day without interruption.
  • Resolution time may vary depending on the type of issue, but initial response is always instant.
  • We provide multilingual support, but our primary language is English.

Contact Us

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

โš ๏ธ Disclaimer

This software is for educational and research purposes only. Crypto trading involves substantial risk of loss and is not suitable for every investor. Past performance does not guarantee future results. You should not trade with money you cannot afford to lose.

The authors and contributors of this project are not responsible for any financial losses incurred through the use of this software.