Model Context Protocol (MCP) gateway for orchestrating multiple capability providers.
This system has been transformed from a hybrid read/write trading client into a read-only market data analysis tool. All order management functionality has been removed.
What Changed:
- β All order placement, cancellation, and query methods removed
- β Account information and trade history retrieval removed
- β Unified market data report API introduced
- β All market data analysis features preserved and enhanced
See CHANGELOG.md for complete migration guide.
This system implements a distributed MCP architecture where a Python gateway orchestrates multiple language-specific providers via gRPC. Each provider exposes tools, resources, and prompts through a unified interface.
AI Clients
ββ Claude Code (STDIO transport)
β β
β MCP Gateway (Python)
β ββ hello-go (Go provider) - Demo tools
β ββ hello-rs (Rust provider) - Demo tools
β ββ binance-rs (Rust provider) - Cryptocurrency trading
β
ββ ChatGPT (SSE transport) π
β
SSE Gateway (Python)
ββ binance-rs (Rust provider) - Unified market data reports
ChatGPT MCP Server (SSE transport):
- URL: https://mcp-gateway.thevibe.trading/sse/
- Status: β Live in production
- Version: 0.2.0 (Read-only market data analysis)
- Features: Unified market intelligence reports with advanced analytics
- Transport: Server-Sent Events (SSE) - required for ChatGPT integration
- Documentation: See ChatGPT Integration Guide
- Language: Go
- Port: 50051
- Tools: echo.v1, sum.v1 (demo tools)
- Status: β Implemented
- Language: Rust
- Port: 50052
- Tools: (To be implemented)
- Status: π§ Planned
- Language: Rust
- Port: 50053
- Status: β Fully Implemented (Read-only market data analysis)
- Version: 0.2.0
Capabilities:
-
1 Primary Tool: π Unified Market Data Report
generate_market_report- Comprehensive market intelligence combining 8+ data sections- Price Overview (24h statistics with trend indicators)
- Order Book Metrics (spread, microprice, imbalance)
- Liquidity Analysis (walls, volume profile, vacuums)
- Market Anomalies (detection with severity badges)
- Microstructure Health (health scores and component status)
- Data Health Status (WebSocket connectivity, freshness)
- Performance: 60s caching, <500ms cold generation, <3ms cached
-
11 Individual Analytics Tools (legacy, superseded by unified report):
get_ticker- 24h price statisticsorderbook_l1/orderbook_l2- Order book snapshotsget_recent_trades- Trade historyget_order_flow- Bid/ask pressure trackingget_volume_profile- Volume distribution (POC/VAH/VAL)detect_market_anomalies- Unusual pattern detectionget_microstructure_health- Market health scoringget_liquidity_vacuums- Low-volume price zone detectionorderbook_health- Real-time order book health metrics
-
1 Resource: Markdown-formatted data snapshot
binance://market/{SYMBOL}- Real-time market summary
-
1 Prompt: AI-ready analysis template
trading-analysis- Market analysis with live context
Features:
- β Live WebSocket order book streaming (sub-200ms latency)
- β Real-time market data from Binance API
- β Lazy initialization & connection pooling
- β Progressive disclosure (L1 β L2 depth on demand)
- β Support for 20 concurrent symbol subscriptions
- β Testnet & Production modes
See providers/binance-rs/README.md for complete documentation.
The MCP gateway integrates seamlessly with Claude Code. Once configured, you can ask natural language questions:
You: "Generate a comprehensive market report for Bitcoin"
Claude: [Uses binance.generate_market_report tool]
Response:
# Market Data Report - BTCUSDT
Generated: 2025-10-24 12:00:00 UTC π’
## Price Overview
- Current Price: $106,841.00 π
- 24h Change: +0.43% (+$459.00)
- 24h High/Low: $107,200.00 / $105,800.00
- Volume: 1,234.56 BTC ($131.8M)
## Order Book Metrics
- Spread: 0.01% (1.0 bps)
- Microprice: $106,840.50
- Imbalance: 58% bid-heavy π
## Liquidity Analysis
- Buy Wall: $106,500 πͺ Strong (125.5 BTC)
- Volume Profile POC: $106,750
[... 5 more sections ...]
You: "Show me ETHUSDT with just price and liquidity sections"
Claude: [Uses generate_market_report with custom options]
Response: [Markdown report with only requested sections]
You: "Analyze trading opportunities for Bitcoin"
Claude: [Uses trading-analysis prompt with live market data]
Response: [Detailed analysis combining report data with AI insights]
Setup for Claude Code:
# Configure MCP server (already done in .claude/settings.json)
claude mcp add --transport stdio mcp-gateway -- \
bash -c "cd mcp-gateway && uv run python -m mcp_gateway.main"
# Start your session
claude # MCP gateway starts automaticallyThe MCP gateway is now available for ChatGPT via SSE transport. The unified market data report provides comprehensive market intelligence!
Setup for ChatGPT:
- Enable Developer Mode in ChatGPT (Plus/Pro required)
- Go to Settings β MCP Servers β Add Server
- Configure the SSE endpoint:
- Server URL:
https://mcp-gateway.thevibe.trading/sse/ - Transport: SSE (Server-Sent Events)
- Server URL:
Example Usage:
You: "Generate a full market report for BTCUSDT"
ChatGPT: [Uses binance_generate_market_report tool]
Response: [Complete markdown report with 8 sections: price, orderbook,
liquidity, anomalies, health, etc. - cached for 60s]
You: "Show me just the price and liquidity analysis for ETHUSDT"
ChatGPT: [Uses binance_generate_market_report with options]
Request: {"symbol": "ETHUSDT", "options": {"include_sections": ["price_overview", "liquidity_analysis"]}}
Response: [Customized report with only requested sections]
You: "What's the order book health for BTCUSDT?"
ChatGPT: [Uses binance_orderbook_health tool - legacy individual tool]
Response: [Quick health metrics snapshot]
See CHATGPT_INTEGRATION.md for detailed setup guide.
- Python 3.11+ with uv
- Go 1.21+ (for hello-go provider)
- Rust 1.75+ (for binance-rs provider)
- Protocol Buffers compiler (protoc)
# Generate protobuf stubs
make proto-gen
# Build Go provider
cd providers/hello-go && go build -o bin/hello-go cmd/server/main.go
# Build Rust providers
make build-binanceTerminal 1 - Start providers:
# hello-go
make run-hello-go
# binance-rs (in another terminal)
make run-binanceTerminal 2 - Start gateway:
make run-gatewayConfigure providers in mcp-gateway/providers.yaml:
providers:
- name: hello-go
type: grpc
address: localhost:50051
enabled: true
- name: binance-rs
type: grpc
address: localhost:50053
enabled: true
metadata:
description: "Binance cryptocurrency trading provider"
features: ["orderbook"]For binance-rs, also set environment variables:
export BINANCE_API_KEY="your_api_key"
export BINANCE_API_SECRET="your_api_secret"
export BINANCE_BASE_URL="https://testnet.binance.vision"Tool: generate_market_report
Generates comprehensive market intelligence reports combining 8+ data sections with smart caching and customization options.
Parameters:
{
"symbol": str, # Required: Trading pair (e.g., "BTCUSDT", "ETHUSDT")
"venue": str, # Optional: Exchange venue (default: "binance")
"options": { # Optional: Report customization
"include_sections": list[str], # Sections to include (default: all)
"volume_window_hours": int, # Volume analysis window (default: 24)
"orderbook_levels": int # Order book depth (default: 20)
}
}Available Sections:
"price_overview"- 24h price statistics with trend indicators"orderbook_metrics"- Spread, microprice, bid-ask imbalance"liquidity_analysis"- Liquidity walls, volume profile, vacuums"market_microstructure"- Order flow analysis (placeholder)"market_anomalies"- Anomaly detection with severity badges"microstructure_health"- Health scores and component status"data_health"- WebSocket connectivity and data freshness
Response:
{
"markdown_content": str, # Complete formatted report
"symbol": str, # Trading pair
"generated_at": int, # Unix timestamp (milliseconds)
"data_age_ms": int, # Data freshness indicator
"failed_sections": list[str],# Sections that failed to generate
"generation_time_ms": int # Report generation time
}Examples:
Full report (all sections):
await client.generate_market_report(symbol="BTCUSDT")Custom report (specific sections):
await client.generate_market_report(
symbol="ETHUSDT",
options={
"include_sections": ["price_overview", "liquidity_analysis"],
"volume_window_hours": 48,
"orderbook_levels": 50
}
)Performance:
- Cold generation: <500ms
- Cached retrieval: <3ms
- Cache TTL: 60 seconds
- Graceful degradation for missing data sources
Migration from v0.1.0:
If you were using individual tools:
# BEFORE (v0.1.0 - no longer works)
ticker = await client.get_ticker(symbol="BTCUSDT")
account = await client.get_account()
trades = await client.get_my_trades(symbol="BTCUSDT")
# AFTER (v0.2.0 - unified report)
report = await client.generate_market_report(symbol="BTCUSDT")
# Access report.markdown_content for formatted outputSee CHANGELOG.md for complete migration guide.
# Run all tests
make test
# Test individual provider
cd providers/binance-rs && cargo test- Create
providers/{name}/directory - Implement
provider.protogRPC service - Add to
providers.yaml - Update Makefile with build/run targets
All providers implement /pkg/proto/provider.proto:
ListCapabilities- Discover tools/resources/promptsInvoke- Execute toolsReadResource- Fetch resourcesGetPrompt- Generate promptsStream- Event streaming (optional)
mcp-trader/
βββ mcp-gateway/ # Python MCP gateway
β βββ mcp_gateway/
β β βββ main.py # FastMCP server (STDIO transport)
β β βββ sse_server.py # SSE server for ChatGPT π
β β βββ adapters/ # gRPC clients
β β βββ tools/ # Search & fetch tools π
β β βββ validation.py
β βββ providers.yaml # Provider configuration
βββ providers/
β βββ hello-go/ # Go demo provider
β βββ hello-rs/ # Rust demo provider
β βββ binance-rs/ # Binance market data provider (read-only)
β βββ src/
β βββ report/ # Unified report generator π
β βββ orderbook/
β βββ analytics/ # Advanced analytics module
βββ infra/ # Production deployment π
β βββ deploy-chatgpt.sh # ChatGPT SSE deployment script
β βββ binance-provider.service # Systemd service
β βββ mcp-gateway-sse.service # SSE gateway service
β βββ nginx-mcp-gateway.conf # NGINX reverse proxy
βββ pkg/
β βββ proto/ # Shared protobuf contracts
β βββ schemas/ # JSON schemas
βββ Makefile
- Binance Provider Guide - Complete provider documentation
- ChatGPT Integration Guide - SSE setup for ChatGPT
- Integration Testing - Test results
- Manual Testing Guide - Testing SSE endpoints
- Deploy Script - Production deployment automation
- Deployment Summary - Latest production deployment
- Feature 018: Unified Market Data Report π
- Feature 002: Binance Provider Integration
- CHANGELOG.md - Version history and migration guides
See LICENSE file.