# Crypto PowerData MCP Service
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/downloads/)
[](https://modelcontextprotocol.io/)
> **A comprehensive MCP (Model Context Protocol) service for cryptocurrency data acquisition with advanced technical analysis capabilities**
## ๐ Quick Start with uvx (Recommended)
**No installation required!** Run directly with uvx:
```bash
# Run MCP server for Claude Desktop/MCP Studio
uvx crypto-powerdata-mcp
# Run HTTP server for web access
uvx crypto-powerdata-mcp --http
# Run with OKX API credentials
uvx crypto-powerdata-mcp --env OKX_API_KEY=your_key --env OKX_SECRET_KEY=your_secret
```
**Claude Desktop Configuration:**
```json
{
"mcpServers": {
"crypto-powerdata": {
"command": "uvx",
"args": ["crypto-powerdata-mcp"],
"env": {
"OKX_PROJECT_ID": "your_okx_project_id",
"OKX_API_KEY": "your_okx_api_key",
"OKX_SECRET_KEY": "your_okx_secret_key",
"OKX_PASSPHRASE": "your_okx_passphrase"
}
}
}
}
```
๐ **[See QUICK_START.md for complete uvx usage guide](QUICK_START.md)**
## ๐ Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Architecture](#architecture)
- [Installation Methods](#installation-methods)
- [Configuration](#configuration)
- [Usage Examples](#usage-examples)
- [API Documentation](#api-documentation)
- [Supported Indicators](#supported-indicators)
- [Data Sources](#data-sources)
- [Development](#development)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)
## ๐ฏ Overview
The Crypto PowerData MCP Service is an advanced cryptocurrency data acquisition service that provides:
- **Comprehensive TA-Lib Integration**: 158 technical indicators across 10 categories
- **Dual Transport Support**: Both stdio and HTTP/SSE protocols
- **Multi-Exchange Access**: 100+ centralized exchanges via CCXT
- **DEX Integration**: Real-time decentralized exchange data via OKX DEX API
- **Flexible Parameters**: Multiple instances of indicators with different parameters
- **Intelligent Labeling**: Automatic column naming based on parameters
### Key Capabilities
๐ **Dual Transport Protocols**
- **stdio transport** - Standard input/output for command-line and programmatic access
- **HTTP/SSE transport** - Server-Sent Events for web applications and real-time data feeds
- **Auto-detection** - Automatically chooses appropriate transport method
- **Identical functionality** - Same tools and features across both protocols
๐ **Data Sources**
1. **CEX Data** - Candlestick data from 100+ centralized exchanges (CCXT)
2. **DEX Data** - Candlestick data from decentralized exchanges (OKX DEX API)
3. **Real-time Prices** - Current token prices from DEX markets
๐งฎ **Technical Analysis**
- **158 TA-Lib indicators** with flexible multi-parameter support
- **Enhanced parameter format**: `{'ema': [{'timeperiod': 12}, {'timeperiod': 26}]}`
- **Intelligent result labeling**: `ema_12`, `ema_26`, `macd_12_26_9`
## โจ Features
### ๐ Dual Transport Architecture
- **stdio Transport**: Standard MCP protocol for command-line tools and local integrations
- **HTTP/SSE Transport**: RESTful API with Server-Sent Events for web applications
- **Auto-Detection**: Intelligent transport selection based on environment
- **Session Management**: Persistent sessions with proper cleanup
### ๐ Comprehensive Technical Analysis
- **158 TA-Lib Indicators** across 10 categories (Momentum, Overlap, Pattern Recognition, etc.)
- **Multi-Parameter Support**: Multiple instances of same indicator with different parameters
- **Flexible Configuration**: JSON-based parameter specification with validation
- **Intelligent Labeling**: Automatic column naming (e.g., `ema_12`, `macd_12_26_9`)
### ๐ Multi-Exchange Support
- **100+ CEX Exchanges**: Via CCXT library (Binance, Coinbase, Kraken, etc.)
- **DEX Integration**: OKX DEX API for decentralized exchange data
- **Real-time Data**: Current prices and historical candlestick data
- **Multiple Timeframes**: From 1 minute to 1 month intervals
### ๐ก๏ธ Robust Parameter Handling
- **String Parameter Processing**: Handles MCP client string inputs
- **JSON Parsing**: Supports various JSON formats and error correction
- **Validation**: Comprehensive parameter validation with helpful error messages
- **Type Conversion**: Automatic conversion between string and native types
## ๐๏ธ Architecture
```mermaid
graph TB
A[MCP Client] --> B{Transport Layer}
B -->|stdio| C[FastMCP Server]
B -->|HTTP/SSE| D[Dual Transport Server]
C --> E[MCP Bridge]
D --> E
E --> F[Tool Functions]
F --> G[Data Provider]
F --> H[Enhanced Indicators]
G --> I[CCXT - CEX Data]
G --> J[OKX DEX API]
H --> K[TA-Lib Registry]
I --> L[100+ Exchanges]
J --> M[DEX Markets]
K --> N[158 Indicators]
```
### Core Components
- **MCP Bridge**: Unified interface between transport protocols and business logic
- **Data Provider**: Handles data fetching from CEX and DEX sources
- **Enhanced Indicators**: Advanced technical analysis with flexible parameters
- **TA-Lib Registry**: Complete registry of all available indicators with metadata
- **Dual Transport Server**: HTTP/SSE server with session management
## ๐ Quick Start
### Prerequisites
- **Python 3.10+** installed on your system
- **UV package manager** ([installation guide](https://docs.astral.sh/uv/getting-started/installation/))
- **Git** for cloning the repository
### 1. Installation
```bash
# Clone the repository
git clone https://github.com/veithly/crypto-powerdata-mcp.git
cd crypto-powerdata-mcp
# Install dependencies using UV
uv sync
# Verify installation
uv run python -c "import src.main; print('โ
Installation successful!')"
```
### 2. Basic Usage
#### Option A: stdio Transport (Default)
```bash
# Start the MCP service
uv run python -m src.main
# Test with the provided test script
uv run python test_mcp_functionality.py
```
#### Option B: HTTP/SSE Transport
```bash
# Start HTTP server
uv run python -m src.main --http
# Access endpoints:
# - API: http://localhost:8000/mcp
# - Health: http://localhost:8000/health
# - Documentation: http://localhost:8000/
```
#### Option C: Auto-Detection Mode
```bash
# Let the server choose the best transport
uv run python -m src.dual_transport_server --mode auto
```
### 3. First API Call
```python
import asyncio
import json
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def test_basic_functionality():
server_params = StdioServerParameters(
command="uv",
args=["run", "python", "-m", "src.main"],
cwd=".",
env={"PYTHONPATH": "."}
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Get available indicators
result = await session.call_tool("get_available_indicators", {})
print(f"Available indicators: {len(json.loads(result.content[0].text))}")
if __name__ == "__main__":
asyncio.run(test_basic_functionality())
```
## ๐ฆ Installation
### System Requirements
- **Operating System**: Windows 10+, macOS 10.15+, or Linux (Ubuntu 18.04+)
- **Python**: 3.10 or higher
- **Memory**: Minimum 2GB RAM (4GB recommended for large datasets)
- **Storage**: 500MB free space for dependencies
### Dependencies
The service automatically installs the following key dependencies:
- **MCP Framework**: `mcp>=1.0.0` - Model Context Protocol implementation
- **CCXT**: `ccxt>=4.0.0` - Cryptocurrency exchange trading library
- **TA-Lib**: `ta-lib>=0.4.25` - Technical analysis library
- **FastAPI**: `fastapi>=0.104.0` - Modern web framework for HTTP transport
- **Pandas**: `pandas>=2.0.0` - Data manipulation and analysis
- **NumPy**: `numpy>=1.24.0` - Numerical computing
### Installation Methods
#### Method 1: Direct Usage with uvx (Recommended) โญ
**No installation required!** Run directly without cloning:
```bash
# Run MCP server (stdio mode for Claude Desktop)
uvx crypto-powerdata-mcp
# Run HTTP server for web access
uvx crypto-powerdata-mcp --http
# Run with environment variables
uvx crypto-powerdata-mcp --env OKX_API_KEY=your_key --env OKX_SECRET_KEY=your_secret
```
**Advantages:**
- โ
No repository cloning needed
- โ
No dependency management
- โ
Always uses latest published version
- โ
Automatic isolation
- โ
Works across different environments
#### Method 2: Local Development Installation
```bash
# Install UV if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and install
git clone https://github.com/veithly/crypto-powerdata-mcp.git
cd crypto-powerdata-mcp
uv sync
```
#### Method 3: Using pip
```bash
git clone https://github.com/veithly/crypto-powerdata-mcp.git
cd crypto-powerdata-mcp
pip install -e .
```
#### Method 4: Development Installation with Testing
```bash
git clone https://github.com/veithly/crypto-powerdata-mcp.git
cd crypto-powerdata-mcp
uv sync --dev # Includes development dependencies
```
### TA-Lib Installation
TA-Lib requires additional system-level installation:
#### Windows
```bash
# Using conda (recommended)
conda install -c conda-forge ta-lib
# Or download pre-compiled wheels
pip install TA-Lib
```
#### macOS
```bash
brew install ta-lib
pip install TA-Lib
```
#### Linux (Ubuntu/Debian)
**Quick Solution - Pre-compiled Binary (Recommended):**
```bash
# Install pre-compiled TA-Lib binary - no system dependencies needed
pip install ta-lib-bin
```
**Official Installation - Latest Version:**
```bash
# Download and compile from source
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
sudo apt-get install build-essential
./configure --prefix=/usr
make
sudo make install
sudo ldconfig
# Install Python wrapper
pip install TA-Lib
```
**Ubuntu 22.04 and older:**
```bash
sudo apt-get install libta-lib-dev
pip install TA-Lib
```
## โ๏ธ Configuration
### Environment Variables
Create a `.env` file in the project root for configuration:
```bash
# OKX DEX API Configuration (Required for DEX features)
OKX_API_KEY=your_api_key_here
OKX_SECRET_KEY=your_secret_key_here
OKX_API_PASSPHRASE=your_passphrase_here
OKX_PROJECT_ID=your_project_id_here
# Optional Performance Settings
RATE_LIMIT_REQUESTS_PER_SECOND=10
TIMEOUT_SECONDS=30
LOG_LEVEL=INFO
# Optional Transport Settings
DEFAULT_TRANSPORT=stdio
HTTP_HOST=127.0.0.1
HTTP_PORT=8000
```
### OKX API Setup
1. **Create OKX Account**: Visit [OKX](https://www.okx.com/) and create an account
2. **Generate API Keys**: Go to API Management in your account settings
3. **Enable DEX API**: Ensure DEX API access is enabled for your API key
4. **Configure Permissions**: Set appropriate permissions for market data access
### MCP Client Configuration
#### Claude Desktop Configuration
Add to your Claude Desktop configuration file:
```json
{
"mcpServers": {
"crypto-powerdata-mcp": {
"command": "uv",
"args": ["run", "python", "-m", "src.main"],
"cwd": "/absolute/path/to/crypto-powerdata-mcp",
"env": {
"PYTHONPATH": ".",
"OKX_API_KEY": "your_api_key",
"OKX_SECRET_KEY": "your_secret_key",
"OKX_API_PASSPHRASE": "your_passphrase",
"OKX_PROJECT_ID": "your_project_id"
}
}
}
}
```
#### MCP Studio Configuration
```json
{
"name": "Crypto PowerData MCP",
"command": ["uv", "run", "python", "-m", "src.main"],
"env": {
"PYTHONPATH": "/path/to/crypto-powerdata-mcp"
}
}
```
## ๐ก Usage Examples
### Basic Examples
#### 1. Get Real-time Token Price
```python
# Get current USDC price on Ethereum
result = await session.call_tool("get_dex_token_price", {
"chain_index": "1", # Ethereum
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" # USDC
})
```
#### 2. Fetch CEX Data with Indicators
```python
# Get BTC/USDT data from Binance with technical indicators
result = await session.call_tool("get_cex_data_with_indicators", {
"exchange": "binance",
"symbol": "BTC/USDT",
"timeframe": "1h",
"limit": 100,
"indicators_config": '{"ema": [{"timeperiod": 12}, {"timeperiod": 26}], "rsi": [{"timeperiod": 14}]}'
})
```
#### 3. Advanced Multi-Indicator Analysis
```python
# Complex indicator configuration
indicators_config = {
"ema": [{"timeperiod": 12}, {"timeperiod": 26}, {"timeperiod": 50}],
"macd": [{"fastperiod": 12, "slowperiod": 26, "signalperiod": 9}],
"rsi": [{"timeperiod": 14}, {"timeperiod": 21}],
"bbands": [{"timeperiod": 20, "nbdevup": 2, "nbdevdn": 2}],
"stoch": [{"fastkperiod": 5, "slowkperiod": 3, "slowdperiod": 3}]
}
result = await session.call_tool("get_enhanced_dex_data_with_indicators", {
"chain_index": "1",
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"timeframe": "1h",
"limit": 200,
"indicators_config": json.dumps(indicators_config)
})
```
### Advanced Usage Patterns
#### Pattern Recognition Analysis
```python
# Candlestick pattern recognition
pattern_config = {
"cdldoji": [{}],
"cdlhammer": [{}],
"cdlengulfing": [{}],
"cdl3blackcrows": [{}],
"cdlmorningstar": [{}]
}
result = await session.call_tool("get_enhanced_dex_data_with_indicators", {
"chain_index": "1",
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"timeframe": "4h",
"limit": 100,
"indicators_config": json.dumps(pattern_config)
})
```
#### Multi-Timeframe Analysis
```python
# Analyze same asset across different timeframes
timeframes = ["1h", "4h", "1d"]
results = {}
for tf in timeframes:
result = await session.call_tool("get_enhanced_dex_data_with_indicators", {
"chain_index": "1",
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"timeframe": tf,
"limit": 50,
"indicators_config": '{"ema": [{"timeperiod": 20}], "rsi": [{"timeperiod": 14}]}'
})
results[tf] = result
```
## ๐ API Documentation
### Available Tools
| Tool Name | Description | Transport Support |
|-----------|-------------|-------------------|
| `get_enhanced_dex_data_with_indicators` | Advanced DEX data with flexible indicators | stdio, HTTP/SSE |
| `get_available_indicators` | Complete indicator registry | stdio, HTTP/SSE |
| `get_cex_data_with_indicators` | CEX data with enhanced indicators | stdio, HTTP/SSE |
| `get_dex_data_with_indicators` | DEX data with indicators (legacy) | stdio, HTTP/SSE |
| `get_dex_token_price` | Current DEX token price | stdio, HTTP/SSE |
| `get_cex_price` | Current CEX price | stdio, HTTP/SSE |
### Tool Specifications
#### `get_enhanced_dex_data_with_indicators`
**Purpose**: Fetch DEX candlestick data with comprehensive technical indicators
**Parameters**:
- `chain_index` (string, required): Blockchain identifier ("1" for Ethereum, "56" for BSC, etc.)
- `token_address` (string, required): Token contract address (42-character hex string)
- `timeframe` (string, optional): Time interval ("1m", "5m", "15m", "1h", "4h", "1d", "1w")
- `limit` (integer, optional): Number of candles to fetch (default: 100, max: 1000)
- `indicators_config` (string, required): JSON string with indicator configurations
**Example Request**:
```json
{
"chain_index": "1",
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"timeframe": "1h",
"limit": 100,
"indicators_config": "{\"ema\": [{\"timeperiod\": 12}, {\"timeperiod\": 26}], \"rsi\": [{\"timeperiod\": 14}]}"
}
```
**Response Format**:
```json
{
"success": true,
"data": {
"candles": [...],
"indicators": {
"ema_12": [...],
"ema_26": [...],
"rsi_14": [...]
},
"metadata": {
"symbol": "USDC",
"timeframe": "1h",
"count": 100
}
}
}
```
## ๐ Supported Indicators
### Indicator Categories (158 Total)
| Category | Count | Examples |
|----------|-------|----------|
| **Momentum Indicators** | 30 | RSI, MACD, Stochastic, ADX, CCI, Williams %R, ROC |
| **Overlap Studies** | 17 | SMA, EMA, Bollinger Bands, KAMA, T3, TEMA |
| **Pattern Recognition** | 61 | Doji, Hammer, Engulfing, Three Black Crows, Morning Star |
| **Volume Indicators** | 3 | OBV, A/D Line, Chaikin A/D Oscillator |
| **Volatility Indicators** | 3 | ATR, NATR, True Range |
| **Price Transform** | 4 | Average Price, Median Price, Typical Price, Weighted Close |
| **Cycle Indicators** | 5 | Hilbert Transform Dominant Cycle Period, Trend Mode |
| **Statistic Functions** | 9 | Beta, Correlation, Linear Regression, Standard Deviation |
| **Math Transform** | 15 | ACOS, ASIN, ATAN, COS, SIN, TAN, SQRT, LN, LOG10 |
| **Math Operators** | 11 | ADD, SUB, MULT, DIV, MIN, MAX, SUM |
### Parameter Format Examples
#### Basic Indicators
```json
{
"sma": [{"timeperiod": 20}],
"ema": [{"timeperiod": 12}, {"timeperiod": 26}],
"rsi": [{"timeperiod": 14}]
}
```
#### Advanced Indicators
```json
{
"macd": [{"fastperiod": 12, "slowperiod": 26, "signalperiod": 9}],
"bbands": [{"timeperiod": 20, "nbdevup": 2, "nbdevdn": 2}],
"stoch": [{"fastkperiod": 5, "slowkperiod": 3, "slowdperiod": 3}]
}
```
#### Pattern Recognition
```json
{
"cdldoji": [{}],
"cdlhammer": [{}],
"cdlengulfing": [{}]
}
```
### Result Column Naming
The service automatically generates descriptive column names based on parameters:
- **Single Parameter**: `indicator_value` (e.g., `rsi_14`, `sma_20`)
- **Multiple Parameters**: `indicator_param1_param2_...` (e.g., `macd_12_26_9`)
- **Multiple Outputs**: `indicator_params_output` (e.g., `bbands_2_2_20_upperband`)
### Popular Indicator Combinations
#### Trend Following Strategy
```json
{
"ema": [{"timeperiod": 12}, {"timeperiod": 26}, {"timeperiod": 50}],
"macd": [{"fastperiod": 12, "slowperiod": 26, "signalperiod": 9}],
"adx": [{"timeperiod": 14}]
}
```
#### Mean Reversion Strategy
```json
{
"rsi": [{"timeperiod": 14}],
"bbands": [{"timeperiod": 20, "nbdevup": 2, "nbdevdn": 2}],
"stoch": [{"fastkperiod": 5, "slowkperiod": 3, "slowdperiod": 3}]
}
```
#### Momentum Analysis
```json
{
"rsi": [{"timeperiod": 14}, {"timeperiod": 21}],
"cci": [{"timeperiod": 14}],
"willr": [{"timeperiod": 14}],
"roc": [{"timeperiod": 10}]
}
```
## ๐ Data Sources
### Centralized Exchanges (CEX)
**Supported via CCXT Library (100+ exchanges)**:
#### Major Exchanges
- **Binance** - World's largest cryptocurrency exchange
- **Coinbase** - Leading US-based exchange
- **Kraken** - Established European exchange
- **Bitfinex** - Advanced trading features
- **Huobi** - Global cryptocurrency exchange
- **OKX** - Comprehensive trading platform
#### Regional Exchanges
- **Bitstamp** - European exchange
- **Gemini** - Regulated US exchange
- **KuCoin** - Global altcoin exchange
- **Gate.io** - Wide variety of trading pairs
- **Bybit** - Derivatives trading platform
### Decentralized Exchanges (DEX)
**Supported via OKX DEX API**:
#### Supported Blockchains
| Chain | Chain Index | Native Token | Popular DEXs |
|-------|-------------|--------------|--------------|
| **Ethereum** | 1 | ETH | Uniswap, SushiSwap, 1inch |
| **BSC** | 56 | BNB | PancakeSwap, Venus |
| **Polygon** | 137 | MATIC | QuickSwap, SushiSwap |
| **Avalanche** | 43114 | AVAX | Trader Joe, Pangolin |
| **Arbitrum** | 42161 | ETH | Uniswap V3, SushiSwap |
| **Optimism** | 10 | ETH | Uniswap V3, Synthetix |
#### Popular Token Addresses
**Ethereum (chain_index: "1")**:
```
USDC: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
USDT: 0xdac17f958d2ee523a2206206994597c13d831ec7
WETH: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
DAI: 0x6b175474e89094c44da98b954eedeac495271d0f
```
**BSC (chain_index: "56")**:
```
WBNB: 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c
BUSD: 0xe9e7cea3dedca5984780bafc599bd69add087d56
CAKE: 0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82
```
## ๐ ๏ธ Development
### Project Structure
```
crypto-powerdata-mcp/
โโโ src/
โ โโโ main.py # Main MCP server entry point
โ โโโ data_provider.py # Data fetching and processing
โ โโโ enhanced_indicators.py # Advanced technical analysis
โ โโโ talib_registry.py # TA-Lib indicator registry
โ โโโ mcp_bridge.py # Transport protocol bridge
โ โโโ dual_transport_server.py # HTTP/SSE server
โโโ tests/
โ โโโ test_enhanced_mcp.py # Comprehensive test suite
โ โโโ test_mcp_functionality.py # Basic functionality tests
โ โโโ comprehensive_mcp_test.py # Advanced testing
โโโ docs/
โ โโโ API_DOCUMENTATION.md # Detailed API reference
โ โโโ CONFIGURATION.md # Configuration guide
โ โโโ TESTING_REPORT.md # Testing documentation
โโโ config_examples.py # Configuration examples
โโโ pyproject.toml # Project dependencies
โโโ README.md # This file
โโโ LICENSE # MIT license
```
### Development Setup
```bash
# Clone repository
git clone https://github.com/veithly/crypto-powerdata-mcp.git
cd crypto-powerdata-mcp
# Install development dependencies
uv sync --dev
# Install pre-commit hooks
pre-commit install
# Run tests
pytest
# Run linting
black src/ tests/
isort src/ tests/
flake8 src/ tests/
mypy src/
```
### Adding New Indicators
1. **Register in TA-Lib Registry** (`src/talib_registry.py`):
```python
def register_custom_indicator(self):
self.indicators["custom_indicator"] = IndicatorDefinition(
name="custom_indicator",
category=IndicatorCategory.MOMENTUM,
description="Custom indicator description",
# ... other parameters
)
```
2. **Implement Calculation** (`src/enhanced_indicators.py`):
```python
def calculate_custom_indicator(self, data, params):
# Implementation here
return result
```
3. **Add Tests** (`tests/test_enhanced_mcp.py`):
```python
def test_custom_indicator():
# Test implementation
pass
```
## ๐งช Testing
### Test Suite Overview
The project includes comprehensive testing to ensure reliability and functionality:
#### Available Test Files
1. **`test_enhanced_mcp.py`** - Comprehensive test suite for enhanced MCP features
- Tests all 158 TA-Lib indicators
- Validates multi-parameter support
- Checks transport protocols
- Error handling scenarios
2. **`test_mcp_functionality.py`** - Basic functionality demonstration
- Simple usage examples
- Integration testing
- Client-server communication
3. **`comprehensive_mcp_test.py`** - Advanced testing scenarios
- Performance testing
- Edge case handling
- Real-world usage patterns
### Running Tests
#### Quick Test
```bash
# Run basic functionality test
uv run python test_mcp_functionality.py
```
#### Comprehensive Testing
```bash
# Run all tests with pytest
pytest tests/ -v
# Run specific test file
pytest test_enhanced_mcp.py -v
# Run with coverage
pytest --cov=src --cov-report=html
```
#### Manual Testing
```bash
# Test enhanced indicators system
uv run python -c "
import asyncio
from src.enhanced_indicators import EnhancedTechnicalAnalysis
import pandas as pd
import numpy as np
async def test():
ta = EnhancedTechnicalAnalysis()
# Create sample data
dates = pd.date_range('2024-01-01', periods=100, freq='1H')
data = pd.DataFrame({
'open': np.random.uniform(50000, 51000, 100),
'high': np.random.uniform(50500, 51500, 100),
'low': np.random.uniform(49500, 50500, 100),
'close': np.random.uniform(50000, 51000, 100),
'volume': np.random.uniform(100, 1000, 100)
}, index=dates)
# Test indicators
config = {
'ema': [{'timeperiod': 12}, {'timeperiod': 26}],
'rsi': [{'timeperiod': 14}],
'macd': [{'fastperiod': 12, 'slowperiod': 26, 'signalperiod': 9}]
}
result = ta.calculate_indicators(data, config)
print(f'โ
Calculated {len(result.columns)} columns')
print(f'๐ Indicators: {[col for col in result.columns if col not in data.columns]}')
asyncio.run(test())
"
```
### Performance Testing
```bash
# Test HTTP transport performance
curl -X POST http://localhost:8000/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "initialize",
"params": {"protocolVersion": "2024-11-05"},
"id": 1
}'
```
### Troubleshooting Tests
#### Common Issues
1. **Import Errors**
```bash
# Solution: Set PYTHONPATH
export PYTHONPATH=/path/to/crypto-powerdata-mcp
```
2. **TA-Lib Installation Issues**
```bash
# Windows
conda install -c conda-forge ta-lib
# macOS
brew install ta-lib
pip install ta-lib
# Linux - Quick Solution (Recommended)
pip install ta-lib-bin
# Linux - From Source (Latest Version)
sudo apt-get install build-essential
# Download and compile from source - see installation section above
# Linux (Ubuntu 22.04 and older)
sudo apt-get install libta-lib-dev
pip install ta-lib
```
3. **API Rate Limits**
```bash
# Solution: Reduce request rate
export RATE_LIMIT_REQUESTS_PER_SECOND=5
```
4. **Memory Issues**
```bash
# Solution: Use smaller datasets
# Reduce limit parameter in API calls
```
### Debug Mode
```bash
# Enable detailed logging
export LOG_LEVEL=DEBUG
uv run python -m src.main
```
## ๐ค Contributing
We welcome contributions to the Crypto PowerData MCP service! Here's how you can help:
### Ways to Contribute
1. **Bug Reports** - Report issues via GitHub Issues
2. **Feature Requests** - Suggest new features or improvements
3. **Code Contributions** - Submit pull requests for bug fixes or new features
4. **Documentation** - Improve documentation and examples
5. **Testing** - Add test cases or improve existing tests
### Development Workflow
1. **Fork the Repository**
```bash
git clone https://github.com/veithly/crypto-powerdata-mcp.git
cd crypto-powerdata-mcp
```
2. **Create a Feature Branch**
```bash
git checkout -b feature/your-feature-name
```
3. **Set Up Development Environment**
```bash
uv sync --dev
pre-commit install
```
4. **Make Your Changes**
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
5. **Run Tests**
```bash
pytest tests/ -v
black src/ tests/
isort src/ tests/
flake8 src/ tests/
mypy src/
```
6. **Commit and Push**
```bash
git add .
git commit -m "feat: add your feature description"
git push origin feature/your-feature-name
```
7. **Create Pull Request**
- Provide clear description of changes
- Reference any related issues
- Ensure all tests pass
### Code Style Guidelines
- **Python Style**: Follow PEP 8 with Black formatting
- **Type Hints**: Use type hints for all function parameters and returns
- **Documentation**: Add docstrings for all public functions and classes
- **Testing**: Maintain test coverage above 80%
### Adding New Features
#### Adding Exchange Support
1. Extend `data_provider.py` with new exchange integration
2. Add configuration options in `main.py`
3. Create comprehensive tests
4. Update documentation
#### Adding New Indicators
1. Register in `talib_registry.py`
2. Implement calculation in `enhanced_indicators.py`
3. Add parameter validation
4. Create test cases
5. Update API documentation
### Reporting Issues
When reporting bugs, please include:
- Python version and operating system
- Complete error messages and stack traces
- Steps to reproduce the issue
- Expected vs actual behavior
- Relevant configuration details
### Feature Requests
For feature requests, please provide:
- Clear description of the proposed feature
- Use cases and benefits
- Potential implementation approach
- Any relevant examples or references
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
### MIT License Summary
- โ
**Commercial Use** - Use in commercial projects
- โ
**Modification** - Modify the source code
- โ
**Distribution** - Distribute the software
- โ
**Private Use** - Use for private projects
- โ **Liability** - No warranty or liability
- โ **Warranty** - No warranty provided
### Third-Party Licenses
This project uses several open-source libraries:
- **TA-Lib** - BSD License
- **CCXT** - MIT License
- **FastAPI** - MIT License
- **Pandas** - BSD License
- **NumPy** - BSD License
## ๐ Acknowledgments
Special thanks to the following projects and communities:
- **[TA-Lib](https://ta-lib.org/)** - Technical Analysis Library for comprehensive indicator calculations
- **[CCXT](https://github.com/ccxt/ccxt)** - Cryptocurrency Exchange Trading Library for multi-exchange support
- **[OKX](https://www.okx.com/)** - DEX API provider for decentralized exchange data
- **[FastMCP](https://github.com/jlowin/fastmcp)** - Model Context Protocol framework
- **[FastAPI](https://fastapi.tiangolo.com/)** - Modern web framework for HTTP transport
- **[Model Context Protocol](https://modelcontextprotocol.io/)** - Protocol specification and community
### Contributors
- Initial development and architecture
- Technical analysis system design
- Dual transport protocol implementation
- Comprehensive testing framework
- Documentation and examples
---
## ๐ Support
- **Documentation**: [API Documentation](API_DOCUMENTATION.md) | [Configuration Guide](CONFIGURATION.md)
- **Issues**: [GitHub Issues](https://github.com/veithly/crypto-powerdata-mcp/issues)
- **Discussions**: [GitHub Discussions](https://github.com/veithly/crypto-powerdata-mcp/discussions)
- **Email**: dev@example.com
---
**Made with โค๏ธ for the cryptocurrency and AI communities**
Raw data
{
"_id": null,
"home_page": null,
"name": "crypto-powerdata-mcp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "ccxt, cryptocurrency, mcp, okx, technical-analysis, trading",
"author": null,
"author_email": "Crypto PowerData MCP <dev@example.com>",
"download_url": "https://files.pythonhosted.org/packages/c0/d6/f632635c9621aba13b70fc5b4e45228238a3d5c377e4276fea546bccfffb/crypto_powerdata_mcp-0.1.0.tar.gz",
"platform": null,
"description": "# Crypto PowerData MCP Service\n\n[](https://opensource.org/licenses/MIT)\n[](https://www.python.org/downloads/)\n[](https://modelcontextprotocol.io/)\n\n> **A comprehensive MCP (Model Context Protocol) service for cryptocurrency data acquisition with advanced technical analysis capabilities**\n\n## \ud83d\ude80 Quick Start with uvx (Recommended)\n\n**No installation required!** Run directly with uvx:\n\n```bash\n# Run MCP server for Claude Desktop/MCP Studio\nuvx crypto-powerdata-mcp\n\n# Run HTTP server for web access\nuvx crypto-powerdata-mcp --http\n\n# Run with OKX API credentials\nuvx crypto-powerdata-mcp --env OKX_API_KEY=your_key --env OKX_SECRET_KEY=your_secret\n```\n\n**Claude Desktop Configuration:**\n```json\n{\n \"mcpServers\": {\n \"crypto-powerdata\": {\n \"command\": \"uvx\",\n \"args\": [\"crypto-powerdata-mcp\"],\n \"env\": {\n \"OKX_PROJECT_ID\": \"your_okx_project_id\",\n \"OKX_API_KEY\": \"your_okx_api_key\",\n \"OKX_SECRET_KEY\": \"your_okx_secret_key\",\n \"OKX_PASSPHRASE\": \"your_okx_passphrase\"\n }\n }\n }\n}\n```\n\n\ud83d\udcd6 **[See QUICK_START.md for complete uvx usage guide](QUICK_START.md)**\n\n## \ud83d\udccb Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Architecture](#architecture)\n- [Installation Methods](#installation-methods)\n- [Configuration](#configuration)\n- [Usage Examples](#usage-examples)\n- [API Documentation](#api-documentation)\n- [Supported Indicators](#supported-indicators)\n- [Data Sources](#data-sources)\n- [Development](#development)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n## \ud83c\udfaf Overview\n\nThe Crypto PowerData MCP Service is an advanced cryptocurrency data acquisition service that provides:\n\n- **Comprehensive TA-Lib Integration**: 158 technical indicators across 10 categories\n- **Dual Transport Support**: Both stdio and HTTP/SSE protocols\n- **Multi-Exchange Access**: 100+ centralized exchanges via CCXT\n- **DEX Integration**: Real-time decentralized exchange data via OKX DEX API\n- **Flexible Parameters**: Multiple instances of indicators with different parameters\n- **Intelligent Labeling**: Automatic column naming based on parameters\n\n### Key Capabilities\n\n\ud83d\udd04 **Dual Transport Protocols**\n- **stdio transport** - Standard input/output for command-line and programmatic access\n- **HTTP/SSE transport** - Server-Sent Events for web applications and real-time data feeds\n- **Auto-detection** - Automatically chooses appropriate transport method\n- **Identical functionality** - Same tools and features across both protocols\n\n\ud83d\udcca **Data Sources**\n1. **CEX Data** - Candlestick data from 100+ centralized exchanges (CCXT)\n2. **DEX Data** - Candlestick data from decentralized exchanges (OKX DEX API)\n3. **Real-time Prices** - Current token prices from DEX markets\n\n\ud83e\uddee **Technical Analysis**\n- **158 TA-Lib indicators** with flexible multi-parameter support\n- **Enhanced parameter format**: `{'ema': [{'timeperiod': 12}, {'timeperiod': 26}]}`\n- **Intelligent result labeling**: `ema_12`, `ema_26`, `macd_12_26_9`\n\n## \u2728 Features\n\n### \ud83d\udd04 Dual Transport Architecture\n- **stdio Transport**: Standard MCP protocol for command-line tools and local integrations\n- **HTTP/SSE Transport**: RESTful API with Server-Sent Events for web applications\n- **Auto-Detection**: Intelligent transport selection based on environment\n- **Session Management**: Persistent sessions with proper cleanup\n\n### \ud83d\udcca Comprehensive Technical Analysis\n- **158 TA-Lib Indicators** across 10 categories (Momentum, Overlap, Pattern Recognition, etc.)\n- **Multi-Parameter Support**: Multiple instances of same indicator with different parameters\n- **Flexible Configuration**: JSON-based parameter specification with validation\n- **Intelligent Labeling**: Automatic column naming (e.g., `ema_12`, `macd_12_26_9`)\n\n### \ud83c\udf10 Multi-Exchange Support\n- **100+ CEX Exchanges**: Via CCXT library (Binance, Coinbase, Kraken, etc.)\n- **DEX Integration**: OKX DEX API for decentralized exchange data\n- **Real-time Data**: Current prices and historical candlestick data\n- **Multiple Timeframes**: From 1 minute to 1 month intervals\n\n### \ud83d\udee1\ufe0f Robust Parameter Handling\n- **String Parameter Processing**: Handles MCP client string inputs\n- **JSON Parsing**: Supports various JSON formats and error correction\n- **Validation**: Comprehensive parameter validation with helpful error messages\n- **Type Conversion**: Automatic conversion between string and native types\n\n## \ud83c\udfd7\ufe0f Architecture\n\n```mermaid\ngraph TB\n A[MCP Client] --> B{Transport Layer}\n B -->|stdio| C[FastMCP Server]\n B -->|HTTP/SSE| D[Dual Transport Server]\n\n C --> E[MCP Bridge]\n D --> E\n\n E --> F[Tool Functions]\n F --> G[Data Provider]\n F --> H[Enhanced Indicators]\n\n G --> I[CCXT - CEX Data]\n G --> J[OKX DEX API]\n H --> K[TA-Lib Registry]\n\n I --> L[100+ Exchanges]\n J --> M[DEX Markets]\n K --> N[158 Indicators]\n```\n\n### Core Components\n\n- **MCP Bridge**: Unified interface between transport protocols and business logic\n- **Data Provider**: Handles data fetching from CEX and DEX sources\n- **Enhanced Indicators**: Advanced technical analysis with flexible parameters\n- **TA-Lib Registry**: Complete registry of all available indicators with metadata\n- **Dual Transport Server**: HTTP/SSE server with session management\n\n## \ud83d\ude80 Quick Start\n\n### Prerequisites\n\n- **Python 3.10+** installed on your system\n- **UV package manager** ([installation guide](https://docs.astral.sh/uv/getting-started/installation/))\n- **Git** for cloning the repository\n\n### 1. Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/veithly/crypto-powerdata-mcp.git\ncd crypto-powerdata-mcp\n\n# Install dependencies using UV\nuv sync\n\n# Verify installation\nuv run python -c \"import src.main; print('\u2705 Installation successful!')\"\n```\n\n### 2. Basic Usage\n\n#### Option A: stdio Transport (Default)\n```bash\n# Start the MCP service\nuv run python -m src.main\n\n# Test with the provided test script\nuv run python test_mcp_functionality.py\n```\n\n#### Option B: HTTP/SSE Transport\n```bash\n# Start HTTP server\nuv run python -m src.main --http\n\n# Access endpoints:\n# - API: http://localhost:8000/mcp\n# - Health: http://localhost:8000/health\n# - Documentation: http://localhost:8000/\n```\n\n#### Option C: Auto-Detection Mode\n```bash\n# Let the server choose the best transport\nuv run python -m src.dual_transport_server --mode auto\n```\n\n### 3. First API Call\n\n```python\nimport asyncio\nimport json\nfrom mcp import ClientSession, StdioServerParameters\nfrom mcp.client.stdio import stdio_client\n\nasync def test_basic_functionality():\n server_params = StdioServerParameters(\n command=\"uv\",\n args=[\"run\", \"python\", \"-m\", \"src.main\"],\n cwd=\".\",\n env={\"PYTHONPATH\": \".\"}\n )\n\n async with stdio_client(server_params) as (read, write):\n async with ClientSession(read, write) as session:\n await session.initialize()\n\n # Get available indicators\n result = await session.call_tool(\"get_available_indicators\", {})\n print(f\"Available indicators: {len(json.loads(result.content[0].text))}\")\n\nif __name__ == \"__main__\":\n asyncio.run(test_basic_functionality())\n```\n\n## \ud83d\udce6 Installation\n\n### System Requirements\n\n- **Operating System**: Windows 10+, macOS 10.15+, or Linux (Ubuntu 18.04+)\n- **Python**: 3.10 or higher\n- **Memory**: Minimum 2GB RAM (4GB recommended for large datasets)\n- **Storage**: 500MB free space for dependencies\n\n### Dependencies\n\nThe service automatically installs the following key dependencies:\n\n- **MCP Framework**: `mcp>=1.0.0` - Model Context Protocol implementation\n- **CCXT**: `ccxt>=4.0.0` - Cryptocurrency exchange trading library\n- **TA-Lib**: `ta-lib>=0.4.25` - Technical analysis library\n- **FastAPI**: `fastapi>=0.104.0` - Modern web framework for HTTP transport\n- **Pandas**: `pandas>=2.0.0` - Data manipulation and analysis\n- **NumPy**: `numpy>=1.24.0` - Numerical computing\n\n### Installation Methods\n\n#### Method 1: Direct Usage with uvx (Recommended) \u2b50\n\n**No installation required!** Run directly without cloning:\n\n```bash\n# Run MCP server (stdio mode for Claude Desktop)\nuvx crypto-powerdata-mcp\n\n# Run HTTP server for web access\nuvx crypto-powerdata-mcp --http\n\n# Run with environment variables\nuvx crypto-powerdata-mcp --env OKX_API_KEY=your_key --env OKX_SECRET_KEY=your_secret\n```\n\n**Advantages:**\n- \u2705 No repository cloning needed\n- \u2705 No dependency management\n- \u2705 Always uses latest published version\n- \u2705 Automatic isolation\n- \u2705 Works across different environments\n\n#### Method 2: Local Development Installation\n\n```bash\n# Install UV if not already installed\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# Clone and install\ngit clone https://github.com/veithly/crypto-powerdata-mcp.git\ncd crypto-powerdata-mcp\nuv sync\n```\n\n#### Method 3: Using pip\n\n```bash\ngit clone https://github.com/veithly/crypto-powerdata-mcp.git\ncd crypto-powerdata-mcp\npip install -e .\n```\n\n#### Method 4: Development Installation with Testing\n\n```bash\ngit clone https://github.com/veithly/crypto-powerdata-mcp.git\ncd crypto-powerdata-mcp\nuv sync --dev # Includes development dependencies\n```\n\n### TA-Lib Installation\n\nTA-Lib requires additional system-level installation:\n\n#### Windows\n```bash\n# Using conda (recommended)\nconda install -c conda-forge ta-lib\n\n# Or download pre-compiled wheels\npip install TA-Lib\n```\n\n#### macOS\n```bash\nbrew install ta-lib\npip install TA-Lib\n```\n\n#### Linux (Ubuntu/Debian)\n\n**Quick Solution - Pre-compiled Binary (Recommended):**\n```bash\n# Install pre-compiled TA-Lib binary - no system dependencies needed\npip install ta-lib-bin\n```\n\n**Official Installation - Latest Version:**\n```bash\n# Download and compile from source\nwget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz\ntar -xzf ta-lib-0.4.0-src.tar.gz\ncd ta-lib/\nsudo apt-get install build-essential\n./configure --prefix=/usr\nmake\nsudo make install\nsudo ldconfig\n\n# Install Python wrapper\npip install TA-Lib\n```\n\n**Ubuntu 22.04 and older:**\n```bash\nsudo apt-get install libta-lib-dev\npip install TA-Lib\n```\n\n## \u2699\ufe0f Configuration\n\n### Environment Variables\n\nCreate a `.env` file in the project root for configuration:\n\n```bash\n# OKX DEX API Configuration (Required for DEX features)\nOKX_API_KEY=your_api_key_here\nOKX_SECRET_KEY=your_secret_key_here\nOKX_API_PASSPHRASE=your_passphrase_here\nOKX_PROJECT_ID=your_project_id_here\n\n# Optional Performance Settings\nRATE_LIMIT_REQUESTS_PER_SECOND=10\nTIMEOUT_SECONDS=30\nLOG_LEVEL=INFO\n\n# Optional Transport Settings\nDEFAULT_TRANSPORT=stdio\nHTTP_HOST=127.0.0.1\nHTTP_PORT=8000\n```\n\n### OKX API Setup\n\n1. **Create OKX Account**: Visit [OKX](https://www.okx.com/) and create an account\n2. **Generate API Keys**: Go to API Management in your account settings\n3. **Enable DEX API**: Ensure DEX API access is enabled for your API key\n4. **Configure Permissions**: Set appropriate permissions for market data access\n\n### MCP Client Configuration\n\n#### Claude Desktop Configuration\n\nAdd to your Claude Desktop configuration file:\n\n```json\n{\n \"mcpServers\": {\n \"crypto-powerdata-mcp\": {\n \"command\": \"uv\",\n \"args\": [\"run\", \"python\", \"-m\", \"src.main\"],\n \"cwd\": \"/absolute/path/to/crypto-powerdata-mcp\",\n \"env\": {\n \"PYTHONPATH\": \".\",\n \"OKX_API_KEY\": \"your_api_key\",\n \"OKX_SECRET_KEY\": \"your_secret_key\",\n \"OKX_API_PASSPHRASE\": \"your_passphrase\",\n \"OKX_PROJECT_ID\": \"your_project_id\"\n }\n }\n }\n}\n```\n\n#### MCP Studio Configuration\n\n```json\n{\n \"name\": \"Crypto PowerData MCP\",\n \"command\": [\"uv\", \"run\", \"python\", \"-m\", \"src.main\"],\n \"env\": {\n \"PYTHONPATH\": \"/path/to/crypto-powerdata-mcp\"\n }\n}\n```\n\n## \ud83d\udca1 Usage Examples\n\n### Basic Examples\n\n#### 1. Get Real-time Token Price\n\n```python\n# Get current USDC price on Ethereum\nresult = await session.call_tool(\"get_dex_token_price\", {\n \"chain_index\": \"1\", # Ethereum\n \"token_address\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\" # USDC\n})\n```\n\n#### 2. Fetch CEX Data with Indicators\n\n```python\n# Get BTC/USDT data from Binance with technical indicators\nresult = await session.call_tool(\"get_cex_data_with_indicators\", {\n \"exchange\": \"binance\",\n \"symbol\": \"BTC/USDT\",\n \"timeframe\": \"1h\",\n \"limit\": 100,\n \"indicators_config\": '{\"ema\": [{\"timeperiod\": 12}, {\"timeperiod\": 26}], \"rsi\": [{\"timeperiod\": 14}]}'\n})\n```\n\n#### 3. Advanced Multi-Indicator Analysis\n\n```python\n# Complex indicator configuration\nindicators_config = {\n \"ema\": [{\"timeperiod\": 12}, {\"timeperiod\": 26}, {\"timeperiod\": 50}],\n \"macd\": [{\"fastperiod\": 12, \"slowperiod\": 26, \"signalperiod\": 9}],\n \"rsi\": [{\"timeperiod\": 14}, {\"timeperiod\": 21}],\n \"bbands\": [{\"timeperiod\": 20, \"nbdevup\": 2, \"nbdevdn\": 2}],\n \"stoch\": [{\"fastkperiod\": 5, \"slowkperiod\": 3, \"slowdperiod\": 3}]\n}\n\nresult = await session.call_tool(\"get_enhanced_dex_data_with_indicators\", {\n \"chain_index\": \"1\",\n \"token_address\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"timeframe\": \"1h\",\n \"limit\": 200,\n \"indicators_config\": json.dumps(indicators_config)\n})\n```\n\n### Advanced Usage Patterns\n\n#### Pattern Recognition Analysis\n\n```python\n# Candlestick pattern recognition\npattern_config = {\n \"cdldoji\": [{}],\n \"cdlhammer\": [{}],\n \"cdlengulfing\": [{}],\n \"cdl3blackcrows\": [{}],\n \"cdlmorningstar\": [{}]\n}\n\nresult = await session.call_tool(\"get_enhanced_dex_data_with_indicators\", {\n \"chain_index\": \"1\",\n \"token_address\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"timeframe\": \"4h\",\n \"limit\": 100,\n \"indicators_config\": json.dumps(pattern_config)\n})\n```\n\n#### Multi-Timeframe Analysis\n\n```python\n# Analyze same asset across different timeframes\ntimeframes = [\"1h\", \"4h\", \"1d\"]\nresults = {}\n\nfor tf in timeframes:\n result = await session.call_tool(\"get_enhanced_dex_data_with_indicators\", {\n \"chain_index\": \"1\",\n \"token_address\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"timeframe\": tf,\n \"limit\": 50,\n \"indicators_config\": '{\"ema\": [{\"timeperiod\": 20}], \"rsi\": [{\"timeperiod\": 14}]}'\n })\n results[tf] = result\n```\n\n## \ud83d\udcda API Documentation\n\n### Available Tools\n\n| Tool Name | Description | Transport Support |\n|-----------|-------------|-------------------|\n| `get_enhanced_dex_data_with_indicators` | Advanced DEX data with flexible indicators | stdio, HTTP/SSE |\n| `get_available_indicators` | Complete indicator registry | stdio, HTTP/SSE |\n| `get_cex_data_with_indicators` | CEX data with enhanced indicators | stdio, HTTP/SSE |\n| `get_dex_data_with_indicators` | DEX data with indicators (legacy) | stdio, HTTP/SSE |\n| `get_dex_token_price` | Current DEX token price | stdio, HTTP/SSE |\n| `get_cex_price` | Current CEX price | stdio, HTTP/SSE |\n\n### Tool Specifications\n\n#### `get_enhanced_dex_data_with_indicators`\n\n**Purpose**: Fetch DEX candlestick data with comprehensive technical indicators\n\n**Parameters**:\n- `chain_index` (string, required): Blockchain identifier (\"1\" for Ethereum, \"56\" for BSC, etc.)\n- `token_address` (string, required): Token contract address (42-character hex string)\n- `timeframe` (string, optional): Time interval (\"1m\", \"5m\", \"15m\", \"1h\", \"4h\", \"1d\", \"1w\")\n- `limit` (integer, optional): Number of candles to fetch (default: 100, max: 1000)\n- `indicators_config` (string, required): JSON string with indicator configurations\n\n**Example Request**:\n```json\n{\n \"chain_index\": \"1\",\n \"token_address\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"timeframe\": \"1h\",\n \"limit\": 100,\n \"indicators_config\": \"{\\\"ema\\\": [{\\\"timeperiod\\\": 12}, {\\\"timeperiod\\\": 26}], \\\"rsi\\\": [{\\\"timeperiod\\\": 14}]}\"\n}\n```\n\n**Response Format**:\n```json\n{\n \"success\": true,\n \"data\": {\n \"candles\": [...],\n \"indicators\": {\n \"ema_12\": [...],\n \"ema_26\": [...],\n \"rsi_14\": [...]\n },\n \"metadata\": {\n \"symbol\": \"USDC\",\n \"timeframe\": \"1h\",\n \"count\": 100\n }\n }\n}\n```\n\n## \ud83d\udcca Supported Indicators\n\n### Indicator Categories (158 Total)\n\n| Category | Count | Examples |\n|----------|-------|----------|\n| **Momentum Indicators** | 30 | RSI, MACD, Stochastic, ADX, CCI, Williams %R, ROC |\n| **Overlap Studies** | 17 | SMA, EMA, Bollinger Bands, KAMA, T3, TEMA |\n| **Pattern Recognition** | 61 | Doji, Hammer, Engulfing, Three Black Crows, Morning Star |\n| **Volume Indicators** | 3 | OBV, A/D Line, Chaikin A/D Oscillator |\n| **Volatility Indicators** | 3 | ATR, NATR, True Range |\n| **Price Transform** | 4 | Average Price, Median Price, Typical Price, Weighted Close |\n| **Cycle Indicators** | 5 | Hilbert Transform Dominant Cycle Period, Trend Mode |\n| **Statistic Functions** | 9 | Beta, Correlation, Linear Regression, Standard Deviation |\n| **Math Transform** | 15 | ACOS, ASIN, ATAN, COS, SIN, TAN, SQRT, LN, LOG10 |\n| **Math Operators** | 11 | ADD, SUB, MULT, DIV, MIN, MAX, SUM |\n\n### Parameter Format Examples\n\n#### Basic Indicators\n```json\n{\n \"sma\": [{\"timeperiod\": 20}],\n \"ema\": [{\"timeperiod\": 12}, {\"timeperiod\": 26}],\n \"rsi\": [{\"timeperiod\": 14}]\n}\n```\n\n#### Advanced Indicators\n```json\n{\n \"macd\": [{\"fastperiod\": 12, \"slowperiod\": 26, \"signalperiod\": 9}],\n \"bbands\": [{\"timeperiod\": 20, \"nbdevup\": 2, \"nbdevdn\": 2}],\n \"stoch\": [{\"fastkperiod\": 5, \"slowkperiod\": 3, \"slowdperiod\": 3}]\n}\n```\n\n#### Pattern Recognition\n```json\n{\n \"cdldoji\": [{}],\n \"cdlhammer\": [{}],\n \"cdlengulfing\": [{}]\n}\n```\n\n### Result Column Naming\n\nThe service automatically generates descriptive column names based on parameters:\n\n- **Single Parameter**: `indicator_value` (e.g., `rsi_14`, `sma_20`)\n- **Multiple Parameters**: `indicator_param1_param2_...` (e.g., `macd_12_26_9`)\n- **Multiple Outputs**: `indicator_params_output` (e.g., `bbands_2_2_20_upperband`)\n\n### Popular Indicator Combinations\n\n#### Trend Following Strategy\n```json\n{\n \"ema\": [{\"timeperiod\": 12}, {\"timeperiod\": 26}, {\"timeperiod\": 50}],\n \"macd\": [{\"fastperiod\": 12, \"slowperiod\": 26, \"signalperiod\": 9}],\n \"adx\": [{\"timeperiod\": 14}]\n}\n```\n\n#### Mean Reversion Strategy\n```json\n{\n \"rsi\": [{\"timeperiod\": 14}],\n \"bbands\": [{\"timeperiod\": 20, \"nbdevup\": 2, \"nbdevdn\": 2}],\n \"stoch\": [{\"fastkperiod\": 5, \"slowkperiod\": 3, \"slowdperiod\": 3}]\n}\n```\n\n#### Momentum Analysis\n```json\n{\n \"rsi\": [{\"timeperiod\": 14}, {\"timeperiod\": 21}],\n \"cci\": [{\"timeperiod\": 14}],\n \"willr\": [{\"timeperiod\": 14}],\n \"roc\": [{\"timeperiod\": 10}]\n}\n```\n\n## \ud83c\udf10 Data Sources\n\n### Centralized Exchanges (CEX)\n\n**Supported via CCXT Library (100+ exchanges)**:\n\n#### Major Exchanges\n- **Binance** - World's largest cryptocurrency exchange\n- **Coinbase** - Leading US-based exchange\n- **Kraken** - Established European exchange\n- **Bitfinex** - Advanced trading features\n- **Huobi** - Global cryptocurrency exchange\n- **OKX** - Comprehensive trading platform\n\n#### Regional Exchanges\n- **Bitstamp** - European exchange\n- **Gemini** - Regulated US exchange\n- **KuCoin** - Global altcoin exchange\n- **Gate.io** - Wide variety of trading pairs\n- **Bybit** - Derivatives trading platform\n\n### Decentralized Exchanges (DEX)\n\n**Supported via OKX DEX API**:\n\n#### Supported Blockchains\n| Chain | Chain Index | Native Token | Popular DEXs |\n|-------|-------------|--------------|--------------|\n| **Ethereum** | 1 | ETH | Uniswap, SushiSwap, 1inch |\n| **BSC** | 56 | BNB | PancakeSwap, Venus |\n| **Polygon** | 137 | MATIC | QuickSwap, SushiSwap |\n| **Avalanche** | 43114 | AVAX | Trader Joe, Pangolin |\n| **Arbitrum** | 42161 | ETH | Uniswap V3, SushiSwap |\n| **Optimism** | 10 | ETH | Uniswap V3, Synthetix |\n\n#### Popular Token Addresses\n\n**Ethereum (chain_index: \"1\")**:\n```\nUSDC: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\nUSDT: 0xdac17f958d2ee523a2206206994597c13d831ec7\nWETH: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\nDAI: 0x6b175474e89094c44da98b954eedeac495271d0f\n```\n\n**BSC (chain_index: \"56\")**:\n```\nWBNB: 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c\nBUSD: 0xe9e7cea3dedca5984780bafc599bd69add087d56\nCAKE: 0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82\n```\n\n## \ud83d\udee0\ufe0f Development\n\n### Project Structure\n\n```\ncrypto-powerdata-mcp/\n\u251c\u2500\u2500 src/\n\u2502 \u251c\u2500\u2500 main.py # Main MCP server entry point\n\u2502 \u251c\u2500\u2500 data_provider.py # Data fetching and processing\n\u2502 \u251c\u2500\u2500 enhanced_indicators.py # Advanced technical analysis\n\u2502 \u251c\u2500\u2500 talib_registry.py # TA-Lib indicator registry\n\u2502 \u251c\u2500\u2500 mcp_bridge.py # Transport protocol bridge\n\u2502 \u2514\u2500\u2500 dual_transport_server.py # HTTP/SSE server\n\u251c\u2500\u2500 tests/\n\u2502 \u251c\u2500\u2500 test_enhanced_mcp.py # Comprehensive test suite\n\u2502 \u251c\u2500\u2500 test_mcp_functionality.py # Basic functionality tests\n\u2502 \u2514\u2500\u2500 comprehensive_mcp_test.py # Advanced testing\n\u251c\u2500\u2500 docs/\n\u2502 \u251c\u2500\u2500 API_DOCUMENTATION.md # Detailed API reference\n\u2502 \u251c\u2500\u2500 CONFIGURATION.md # Configuration guide\n\u2502 \u2514\u2500\u2500 TESTING_REPORT.md # Testing documentation\n\u251c\u2500\u2500 config_examples.py # Configuration examples\n\u251c\u2500\u2500 pyproject.toml # Project dependencies\n\u251c\u2500\u2500 README.md # This file\n\u2514\u2500\u2500 LICENSE # MIT license\n```\n\n### Development Setup\n\n```bash\n# Clone repository\ngit clone https://github.com/veithly/crypto-powerdata-mcp.git\ncd crypto-powerdata-mcp\n\n# Install development dependencies\nuv sync --dev\n\n# Install pre-commit hooks\npre-commit install\n\n# Run tests\npytest\n\n# Run linting\nblack src/ tests/\nisort src/ tests/\nflake8 src/ tests/\nmypy src/\n```\n\n### Adding New Indicators\n\n1. **Register in TA-Lib Registry** (`src/talib_registry.py`):\n```python\ndef register_custom_indicator(self):\n self.indicators[\"custom_indicator\"] = IndicatorDefinition(\n name=\"custom_indicator\",\n category=IndicatorCategory.MOMENTUM,\n description=\"Custom indicator description\",\n # ... other parameters\n )\n```\n\n2. **Implement Calculation** (`src/enhanced_indicators.py`):\n```python\ndef calculate_custom_indicator(self, data, params):\n # Implementation here\n return result\n```\n\n3. **Add Tests** (`tests/test_enhanced_mcp.py`):\n```python\ndef test_custom_indicator():\n # Test implementation\n pass\n```\n\n## \ud83e\uddea Testing\n\n### Test Suite Overview\n\nThe project includes comprehensive testing to ensure reliability and functionality:\n\n#### Available Test Files\n\n1. **`test_enhanced_mcp.py`** - Comprehensive test suite for enhanced MCP features\n - Tests all 158 TA-Lib indicators\n - Validates multi-parameter support\n - Checks transport protocols\n - Error handling scenarios\n\n2. **`test_mcp_functionality.py`** - Basic functionality demonstration\n - Simple usage examples\n - Integration testing\n - Client-server communication\n\n3. **`comprehensive_mcp_test.py`** - Advanced testing scenarios\n - Performance testing\n - Edge case handling\n - Real-world usage patterns\n\n### Running Tests\n\n#### Quick Test\n```bash\n# Run basic functionality test\nuv run python test_mcp_functionality.py\n```\n\n#### Comprehensive Testing\n```bash\n# Run all tests with pytest\npytest tests/ -v\n\n# Run specific test file\npytest test_enhanced_mcp.py -v\n\n# Run with coverage\npytest --cov=src --cov-report=html\n```\n\n#### Manual Testing\n```bash\n# Test enhanced indicators system\nuv run python -c \"\nimport asyncio\nfrom src.enhanced_indicators import EnhancedTechnicalAnalysis\nimport pandas as pd\nimport numpy as np\n\nasync def test():\n ta = EnhancedTechnicalAnalysis()\n\n # Create sample data\n dates = pd.date_range('2024-01-01', periods=100, freq='1H')\n data = pd.DataFrame({\n 'open': np.random.uniform(50000, 51000, 100),\n 'high': np.random.uniform(50500, 51500, 100),\n 'low': np.random.uniform(49500, 50500, 100),\n 'close': np.random.uniform(50000, 51000, 100),\n 'volume': np.random.uniform(100, 1000, 100)\n }, index=dates)\n\n # Test indicators\n config = {\n 'ema': [{'timeperiod': 12}, {'timeperiod': 26}],\n 'rsi': [{'timeperiod': 14}],\n 'macd': [{'fastperiod': 12, 'slowperiod': 26, 'signalperiod': 9}]\n }\n\n result = ta.calculate_indicators(data, config)\n print(f'\u2705 Calculated {len(result.columns)} columns')\n print(f'\ud83d\udcca Indicators: {[col for col in result.columns if col not in data.columns]}')\n\nasyncio.run(test())\n\"\n```\n\n### Performance Testing\n\n```bash\n# Test HTTP transport performance\ncurl -X POST http://localhost:8000/mcp \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"jsonrpc\": \"2.0\",\n \"method\": \"initialize\",\n \"params\": {\"protocolVersion\": \"2024-11-05\"},\n \"id\": 1\n }'\n```\n\n### Troubleshooting Tests\n\n#### Common Issues\n\n1. **Import Errors**\n ```bash\n # Solution: Set PYTHONPATH\n export PYTHONPATH=/path/to/crypto-powerdata-mcp\n ```\n\n2. **TA-Lib Installation Issues**\n ```bash\n # Windows\n conda install -c conda-forge ta-lib\n\n # macOS\n brew install ta-lib\n pip install ta-lib\n\n # Linux - Quick Solution (Recommended)\n pip install ta-lib-bin\n\n # Linux - From Source (Latest Version)\n sudo apt-get install build-essential\n # Download and compile from source - see installation section above\n\n # Linux (Ubuntu 22.04 and older)\n sudo apt-get install libta-lib-dev\n pip install ta-lib\n ```\n\n3. **API Rate Limits**\n ```bash\n # Solution: Reduce request rate\n export RATE_LIMIT_REQUESTS_PER_SECOND=5\n ```\n\n4. **Memory Issues**\n ```bash\n # Solution: Use smaller datasets\n # Reduce limit parameter in API calls\n ```\n\n### Debug Mode\n\n```bash\n# Enable detailed logging\nexport LOG_LEVEL=DEBUG\nuv run python -m src.main\n```\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions to the Crypto PowerData MCP service! Here's how you can help:\n\n### Ways to Contribute\n\n1. **Bug Reports** - Report issues via GitHub Issues\n2. **Feature Requests** - Suggest new features or improvements\n3. **Code Contributions** - Submit pull requests for bug fixes or new features\n4. **Documentation** - Improve documentation and examples\n5. **Testing** - Add test cases or improve existing tests\n\n### Development Workflow\n\n1. **Fork the Repository**\n ```bash\n git clone https://github.com/veithly/crypto-powerdata-mcp.git\n cd crypto-powerdata-mcp\n ```\n\n2. **Create a Feature Branch**\n ```bash\n git checkout -b feature/your-feature-name\n ```\n\n3. **Set Up Development Environment**\n ```bash\n uv sync --dev\n pre-commit install\n ```\n\n4. **Make Your Changes**\n - Follow the existing code style\n - Add tests for new features\n - Update documentation as needed\n\n5. **Run Tests**\n ```bash\n pytest tests/ -v\n black src/ tests/\n isort src/ tests/\n flake8 src/ tests/\n mypy src/\n ```\n\n6. **Commit and Push**\n ```bash\n git add .\n git commit -m \"feat: add your feature description\"\n git push origin feature/your-feature-name\n ```\n\n7. **Create Pull Request**\n - Provide clear description of changes\n - Reference any related issues\n - Ensure all tests pass\n\n### Code Style Guidelines\n\n- **Python Style**: Follow PEP 8 with Black formatting\n- **Type Hints**: Use type hints for all function parameters and returns\n- **Documentation**: Add docstrings for all public functions and classes\n- **Testing**: Maintain test coverage above 80%\n\n### Adding New Features\n\n#### Adding Exchange Support\n1. Extend `data_provider.py` with new exchange integration\n2. Add configuration options in `main.py`\n3. Create comprehensive tests\n4. Update documentation\n\n#### Adding New Indicators\n1. Register in `talib_registry.py`\n2. Implement calculation in `enhanced_indicators.py`\n3. Add parameter validation\n4. Create test cases\n5. Update API documentation\n\n### Reporting Issues\n\nWhen reporting bugs, please include:\n- Python version and operating system\n- Complete error messages and stack traces\n- Steps to reproduce the issue\n- Expected vs actual behavior\n- Relevant configuration details\n\n### Feature Requests\n\nFor feature requests, please provide:\n- Clear description of the proposed feature\n- Use cases and benefits\n- Potential implementation approach\n- Any relevant examples or references\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n### MIT License Summary\n\n- \u2705 **Commercial Use** - Use in commercial projects\n- \u2705 **Modification** - Modify the source code\n- \u2705 **Distribution** - Distribute the software\n- \u2705 **Private Use** - Use for private projects\n- \u274c **Liability** - No warranty or liability\n- \u274c **Warranty** - No warranty provided\n\n### Third-Party Licenses\n\nThis project uses several open-source libraries:\n- **TA-Lib** - BSD License\n- **CCXT** - MIT License\n- **FastAPI** - MIT License\n- **Pandas** - BSD License\n- **NumPy** - BSD License\n\n## \ud83d\ude4f Acknowledgments\n\nSpecial thanks to the following projects and communities:\n\n- **[TA-Lib](https://ta-lib.org/)** - Technical Analysis Library for comprehensive indicator calculations\n- **[CCXT](https://github.com/ccxt/ccxt)** - Cryptocurrency Exchange Trading Library for multi-exchange support\n- **[OKX](https://www.okx.com/)** - DEX API provider for decentralized exchange data\n- **[FastMCP](https://github.com/jlowin/fastmcp)** - Model Context Protocol framework\n- **[FastAPI](https://fastapi.tiangolo.com/)** - Modern web framework for HTTP transport\n- **[Model Context Protocol](https://modelcontextprotocol.io/)** - Protocol specification and community\n\n### Contributors\n\n- Initial development and architecture\n- Technical analysis system design\n- Dual transport protocol implementation\n- Comprehensive testing framework\n- Documentation and examples\n\n---\n\n## \ud83d\udcde Support\n\n- **Documentation**: [API Documentation](API_DOCUMENTATION.md) | [Configuration Guide](CONFIGURATION.md)\n- **Issues**: [GitHub Issues](https://github.com/veithly/crypto-powerdata-mcp/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/veithly/crypto-powerdata-mcp/discussions)\n- **Email**: dev@example.com\n\n---\n\n**Made with \u2764\ufe0f for the cryptocurrency and AI communities**\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "MCP service for crypto power data analysis with CCXT and OKX DEX API integration",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/veithly/crypto-powerdata-mcp",
"Issues": "https://github.com/veithly/crypto-powerdata-mcp/issues",
"Repository": "https://github.com/veithly/crypto-powerdata-mcp"
},
"split_keywords": [
"ccxt",
" cryptocurrency",
" mcp",
" okx",
" technical-analysis",
" trading"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9353c323fa99f5f2ff0fe6b0d6b17b5ebc847966ff0fa197c38aa1335ae03b79",
"md5": "56b3f10bcc9891162d86312acfe784c7",
"sha256": "9f131b27f9cc3575b5b961d8044262863323ca4a5599635951264a40fdf9ffcd"
},
"downloads": -1,
"filename": "crypto_powerdata_mcp-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "56b3f10bcc9891162d86312acfe784c7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 42787,
"upload_time": "2025-07-16T09:26:31",
"upload_time_iso_8601": "2025-07-16T09:26:31.196850Z",
"url": "https://files.pythonhosted.org/packages/93/53/c323fa99f5f2ff0fe6b0d6b17b5ebc847966ff0fa197c38aa1335ae03b79/crypto_powerdata_mcp-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c0d6f632635c9621aba13b70fc5b4e45228238a3d5c377e4276fea546bccfffb",
"md5": "d2d96fb645e4d700089bcd30120bb308",
"sha256": "0da137ba73c28579f8748e0f690035a02fdb64be17c99df2e69d0d865a7d3983"
},
"downloads": -1,
"filename": "crypto_powerdata_mcp-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d2d96fb645e4d700089bcd30120bb308",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 213484,
"upload_time": "2025-07-16T09:26:33",
"upload_time_iso_8601": "2025-07-16T09:26:33.106188Z",
"url": "https://files.pythonhosted.org/packages/c0/d6/f632635c9621aba13b70fc5b4e45228238a3d5c377e4276fea546bccfffb/crypto_powerdata_mcp-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 09:26:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "veithly",
"github_project": "crypto-powerdata-mcp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "crypto-powerdata-mcp"
}