Crypto Portfolio MCP Server

Crypto Portfolio MCP Server

Provides read-only portfolio management and analytics across Binance, Coinbase, and Kraken exchanges. It enables users to track holdings, analyze risk, and monitor market intelligence through 18 specialized tools.

Category
访问服务器

README

Crypto Portfolio MCP Server

A comprehensive read-only cryptocurrency portfolio management server built on the Model Context Protocol (MCP). Supports Binance, Coinbase, and Kraken exchanges with 18+ analytics tools for portfolio tracking, risk assessment, and market intelligence.

Overview

This MCP server provides real-time cryptocurrency portfolio analytics through Claude Desktop or any MCP-compatible client. It offers read-only access to your exchange accounts, ensuring your funds remain secure while providing deep insights into your holdings.

Key Features

  • Multi-exchange portfolio aggregation (Binance, Coinbase, Kraken)
  • Real-time price tracking and alerts
  • Risk and diversification analysis
  • Market intelligence and sentiment indicators
  • Arbitrage opportunity detection
  • Portfolio performance metrics

Quick Start

Prerequisites

  • Python 3.10 or higher
  • API keys from supported exchanges (read-only permissions only)
  • Claude Desktop (optional, for AI-powered queries)

Installation

  1. Clone the repository:
git clone https://github.com/lev-corrupted/CryptoPortfolioMCPServer.git
cd CryptoPortfolioMCPServer
  1. Run the setup script:
chmod +x setup.sh
./setup.sh
  1. Configure API credentials:
cp .env.example .env
# Edit .env with your exchange API keys
  1. Test the configuration:
source venv/bin/activate
python test_config.py

Claude Desktop Configuration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "crypto-portfolio": {
      "command": "/absolute/path/to/CryptoPortfolioMCPServer/venv/bin/python",
      "args": ["-m", "src.server"],
      "cwd": "/absolute/path/to/CryptoPortfolioMCPServer"
    }
  }
}

Replace /absolute/path/to/ with your actual installation path.

API Key Setup

IMPORTANT: Read-Only Permissions Only

Create API keys with read/view permissions only. Never enable trading or withdrawal permissions.

Binance

  1. Log in to Binance and navigate to API Management
  2. Create a new API key with only "Read" permissions
  3. Copy the API Key and Secret to your .env file

Coinbase

  1. Log in to Coinbase and go to Settings > API
  2. Create a new API key with only "wallet:accounts:read" and "wallet:transactions:read"
  3. Copy credentials to .env

Kraken

  1. Log in to Kraken and go to Settings > API
  2. Generate a new key with only "Query Funds" and "Query Open Orders & Trades"
  3. Copy credentials to .env

Available Tools

The server provides 18 MCP tools across 7 categories:

Portfolio Management (5 tools)

  • get_total_portfolio_value - Aggregate portfolio value across all exchanges
  • get_all_balances - Detailed balance breakdown with USD values
  • get_portfolio_allocation - Asset allocation percentages
  • get_current_prices - Real-time cryptocurrency prices
  • calculate_portfolio_pnl - Profit/loss calculations

Analytics (2 tools)

  • get_biggest_movers - Top gaining and losing assets
  • get_portfolio_performance - Historical performance metrics

Price Alerts (2 tools)

  • check_price_alert - Single price condition monitoring
  • check_multiple_alerts - Batch alert checking

Risk Management (3 tools)

  • get_diversification_score - Portfolio diversification rating (1-10)
  • get_volatility_risk - Risk assessment based on asset volatility
  • get_stablecoin_ratio - Percentage in stablecoins

Market Intelligence (3 tools)

  • check_arbitrage_opportunities - Cross-exchange price differences
  • check_liquidity - Trading volume and liquidity analysis
  • get_fear_greed_index - Crypto market sentiment indicator

Portfolio Insights (2 tools)

  • detect_dust - Identify small-value holdings
  • get_exchange_distribution - Portfolio distribution across exchanges

Practical Tools (1 tool)

  • calculate_withdrawal_fees - Estimate transfer costs

Usage Examples

With Claude Desktop

After configuration, ask Claude natural language questions:

"What is my total portfolio value?"
"Show me my portfolio allocation"
"What are the biggest movers in my portfolio today?"
"Is Bitcoin above $50,000?"
"What is my diversification score?"
"Are there any arbitrage opportunities?"
"What is the current crypto fear and greed index?"

Architecture

CryptoPortfolioMCPServer/
├── src/
│   ├── server.py              # Main MCP server
│   ├── exchanges/             # Exchange client implementations
│   │   ├── base_exchange.py
│   │   ├── binance_client.py
│   │   ├── coinbase_client.py
│   │   └── kraken_client.py
│   ├── analytics/             # Analytics engines
│   │   ├── portfolio.py
│   │   ├── risk.py
│   │   └── market.py
│   └── utils/                 # Utilities
│       ├── config.py
│       └── helpers.py
├── .github/                   # GitHub templates
├── requirements.txt
├── setup.sh
├── test_config.py
└── .env.example

Technical Details

  • Exchange API Integration: CCXT library for unified exchange access
  • Caching: In-memory with configurable TTL (30s prices, 60s balances)
  • Rate Limiting: Per-exchange limits (Binance: 15/s, Coinbase: 8/s, Kraken: 1/s)
  • Error Handling: Automatic retry with exponential backoff (3 attempts)
  • Security: Read-only operations, no trading or withdrawal capabilities

Configuration

Environment variables in .env:

# Exchange API credentials
BINANCE_API_KEY=your_binance_api_key
BINANCE_API_SECRET=your_binance_secret

COINBASE_API_KEY=your_coinbase_api_key
COINBASE_API_SECRET=your_coinbase_secret

KRAKEN_API_KEY=your_kraken_api_key
KRAKEN_API_SECRET=your_kraken_secret

# Optional settings
MOCK_MODE=false
PRICE_CACHE_DURATION=30
BALANCE_CACHE_DURATION=60

Troubleshooting

"No exchanges initialized"

Check that API keys are correctly set in .env file.

"Failed to initialize [Exchange]"

Verify API key permissions are set to read-only and credentials are correct.

Rate Limiting Errors

The server implements automatic rate limiting and retry logic.

Security

Important Security Practices:

  1. Use read-only API keys exclusively
  2. Never commit .env file to version control
  3. Enable IP whitelisting on exchange API keys (recommended)
  4. Rotate API keys periodically
  5. Keep dependencies updated

This server cannot execute trades or withdrawals - it only reads portfolio data.

Contributing

See CONTRIBUTING.md for guidelines.

Contributions must:

  • Follow existing code patterns
  • Include documentation
  • Maintain security best practices
  • Never add trading/withdrawal functionality

License

MIT License - See LICENSE file for details.

Disclaimer

This software is for informational purposes only and does not constitute financial advice. Users are solely responsible for their investment decisions. The server operates in read-only mode and cannot execute trades or transfers.

Support

For issues or questions:

  1. Check the troubleshooting section above
  2. Review CONTRIBUTING.md
  3. Check server logs in logs/crypto_mcp.log
  4. Open an issue on GitHub

Built With

  • CCXT - Cryptocurrency exchange trading library
  • MCP Python SDK - Model Context Protocol
  • Python 3.10+

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选