mintedmaterial/sonic-crypto-mcp-server
If you are the rightful owner of sonic-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.
The Sonic Crypto MCP Server is an advanced Model Context Protocol server designed to provide comprehensive cryptocurrency market data and AI-powered analysis for the Sonic blockchain ecosystem.
๐ Sonic Crypto MCP Server
Advanced Model Context Protocol (MCP) server providing comprehensive cryptocurrency market data and AI-powered analysis for the Sonic blockchain ecosystem
๐ Features
Core Capabilities
- ๐ฅ Real-time Cryptocurrency Data - Live prices, OHLCV data, and market metrics
- ๐ง AI-Powered Analysis - Market sentiment analysis using Cloudflare AI (Llama 3.1-8b)
- ๐ฌ Interactive Chat Assistant - Context-aware AI chat with Hermes-2-Pro-Mistral-7B
- ๐ฐ News Aggregation - AI-curated crypto news and market updates
- ๐ Historical Data Management - Automated seeding and caching of historical market data
- ๐จ Sonic-Themed Dashboard - Beautiful dark mode UI with animated starfield background
Technical Features
- Multi-Tier Caching - KV, Durable Objects, and R2 storage for optimal performance
- MCP Protocol Compliance - Full Model Context Protocol implementation
- Auto-Deployment - GitHub integration with Cloudflare for CI/CD
- Analytics Integration - Real-time usage tracking with Analytics Engine
- Scheduled Jobs - Automated data refresh via cron triggers
- Type-Safe - Strict TypeScript with comprehensive type definitions
๐ฏ NEW: Advanced Features
Workers for Platforms ๐
- User-Specific Worker Instances - Isolated execution environments per user
- NFT-Gated Access - Bandit Kidz NFT holders get premium features
- Dispatch Namespace:
sonic-user-workers
(shared with Vibe SDK) - Cross-Platform Integration - Seamless integration with Vibe SDK applications
- Auto Lifecycle Management - Automatic worker creation, routing, and cleanup
Python ML Containers ๐ (Coming Soon)
- Advanced Technical Analysis - 50+ indicators via TA-Lib
- Pattern Recognition - AI-powered candlestick and chart patterns
- Machine Learning - scikit-learn models for trend prediction
- Chart Generation - plotly/matplotlib visualizations
- See for activation guide
๐๏ธ Architecture
src/
โโโ config/ # Environment & configuration
โ โโโ env.ts # Cloudflare bindings & constants
โโโ services/ # Business logic services
โ โโโ cache.ts # KV & Durable Object caching
โ โโโ ai.ts # AI service abstractions
โโโ storage/ # Storage layer
โ โโโ r2.ts # R2 bucket operations
โ โโโ d1.ts # D1 database operations
โโโ tools/ # MCP tools
โ โโโ price-tool.ts
โ โโโ sentiment-tool.ts
โ โโโ web-search-tool.ts
โ โโโ historical-tool.ts
โ โโโ index.ts
โโโ workflows/ # Cloudflare Workflows
โ โโโ data-seeding.ts
โ โโโ data-workflow.ts
โโโ durable-objects/ # Persistent state
โ โโโ crypto-cache.ts
โ โโโ session-manager.ts
โโโ ui/ # Dashboard
โ โโโ dashboard.ts
โโโ index.ts # Main worker entry point
๐ Quick Start
Prerequisites
- Node.js 18+ and npm
- Wrangler CLI (Cloudflare CLI)
- Cloudflare account with Workers enabled
- CoinDesk API key (Get one here)
Installation
# Clone the repository
git clone https://github.com/mintedmaterial/sonic-crypto-mcp-server.git
cd sonic-crypto-mcp-server
# Install dependencies
npm install
# Generate TypeScript types for Cloudflare bindings
npm run setup
Configuration
- Set Cloudflare Secrets:
# Required
wrangler secret put COINDESK_API_KEY
# Optional
wrangler secret put AI_GATEWAY_TOKEN
wrangler secret put ANTHROPIC_API_KEY
- Configure Custom Domain (Optional):
- Update
wrangler.toml
with your domain settings - The server is configured for
ss.srvcflo.com
- Update
Development
# Start local development server
npm run dev
# The server will be available at http://localhost:8787
Deployment
# Deploy to production
npm run deploy
# Deploy to staging
npm run deploy:staging
# View real-time logs
npm run tail
๐ก API Endpoints
Dashboard
GET /
- Sonic-themed interactive dashboard with AI chat
MCP Protocol
GET /mcp/tools/list
- List all available MCP toolsPOST /mcp/tools/call
- Execute an MCP tool
Direct API Access
GET|POST /api/price
- Get latest cryptocurrency pricesGET|POST /api/sentiment
- AI-powered market sentiment analysisGET|POST /api/news
- Search crypto newsPOST /api/chat
- AI chat assistant with context-aware responses
User Worker Management (Workers for Platforms)
POST /api/user-worker/create
- Create or get user-specific worker (NFT-gated)POST /api/user-worker/dispatch
- Dispatch request to user workerPOST /api/user-worker/update-nft
- Update user worker NFT statusGET /api/user-worker/stats
- Get worker statistics (monitoring)GET /api/user-worker/list
- List all user workers (admin)POST /api/user-worker/delete
- Delete user worker (cleanup)POST /api/verify-nft
- Verify Bandit Kidz NFT ownership
Data Management
POST /api/init-db
- Initialize D1 database schemaPOST /api/seed-data
- Seed historical data (accepts config JSON)POST /api/refresh-data
- Refresh recent data
System
GET /health
- Health check with service statusGET /docs
- API documentation
๐ ๏ธ MCP Tools
1. get_latest_index_tick
Get real-time cryptocurrency prices with OHLC metrics.
{
"market": "cadli",
"instruments": ["BTC-USD", "ETH-USD", "S-USD", "SONIC-USD"]
}
2. analyze_sonic_market_sentiment
AI-powered sentiment analysis for Sonic ecosystem.
{
"sentiment_sources": ["price_action", "volume_analysis"],
"timeframe": "1d",
"instruments": ["S-USD", "BTC-USD", "ETH-USD"]
}
3. search_crypto_news
Search and summarize cryptocurrency news.
{
"query": "Sonic blockchain news",
"tokens": ["Sonic", "S-USD"],
"max_results": 5
}
4. get_historical_ohlcv_daily
Fetch historical daily OHLCV data (up to 5000 points).
5. get_historical_ohlcv_hourly
Fetch hourly data for intraday analysis.
6. get_historical_ohlcv_minutes
Fetch minute-level data for high-frequency analysis.
๐ง Environment Variables
Required
COINDESK_API_KEY
- CoinDesk API authentication
Optional
AI_GATEWAY_TOKEN
- Cloudflare AI Gateway tokenANTHROPIC_API_KEY
- Alternative AI provider
Build-time (in wrangler.toml)
API_VERSION
- API version (default: "1.0.0")ENVIRONMENT
- Deployment environmentMCP_SERVER_NAME
- Server name (default: "sonic-crypto-mcp")
๐๏ธ Cloudflare Services
Storage
- KV Namespaces:
SONIC_CACHE
,API_RATE_LIMIT
- R2 Buckets:
HISTORICAL_DATA
,MARKET_REPORTS
- D1 Database:
CONFIG_DB
(for metadata and configuration)
Compute
- Durable Objects:
CryptoDataCache
,MCPSessionManager
,OverviewAgent
,ChartsAgent
- Workflows:
DATA_UPDATE_WORKFLOW
,DATA_SEEDING_WORKFLOW
- Queue:
CRYPTO_QUEUE
(for background processing) - Dispatch Namespace:
sonic-user-workers
(Workers for Platforms) - Containers:
CHARTS_CONTAINER
(Python ML - when available)
AI & Analytics
- Workers AI: Llama 3.1-8b, Hermes-2-Pro-Mistral-7B
- Analytics Engine: Usage tracking and monitoring
๐ Data Seeding
Initialize Database
curl -X POST https://ss.srvcflo.com/api/init-db
Seed Historical Data
curl -X POST https://ss.srvcflo.com/api/seed-data \
-H "Content-Type: application/json" \
-d '{
"instruments": ["BTC-USD", "ETH-USD", "S-USD"],
"markets": ["cadli"],
"daysOfHistory": 90
}'
๐ Auto-Deployment
GitHub Integration
- Go to Cloudflare Dashboard โ Workers & Pages
- Select your worker โ Settings โ Builds
- Click "Connect" and authorize GitHub
- Select the
sonic-crypto-mcp-server
repository - Configure build settings (automatic)
Push to main
branch = automatic deployment! ๐
๐งช Testing
Local Testing
# Start dev server
npm run dev
# Test MCP endpoint
curl http://localhost:8787/mcp/tools/list
# Test price API
curl "http://localhost:8787/api/price"
# Test chat
curl -X POST http://localhost:8787/api/chat \
-H "Content-Type: application/json" \
-d '{"message":"What is the price of BTC?"}'
Production Testing
# Health check
curl https://ss.srvcflo.com/health
# View logs
npm run tail
๐ Scripts
npm run build # Compile TypeScript
npm run dev # Start local development server
npm run deploy # Deploy to default environment
npm run deploy:staging # Deploy to staging
npm run deploy:prod # Deploy to production
npm run tail # View real-time logs
npm run lint # Type-check without emitting
npm run setup # Generate Cloudflare types
๐ค Contributing
Contributions are welcome! Please see for guidelines.
๐ License
ISC License - see for details.
๐ Links
- Live Dashboard: https://ss.srvcflo.com
- GitHub Repository: mintedmaterial/sonic-crypto-mcp-server
- CoinDesk API Docs: https://www.coindesk.com/coindesk-api
- Cloudflare Workers: https://developers.cloudflare.com/workers/
- MCP Protocol: https://modelcontextprotocol.io/
๐ Support
For issues, questions, or contributions:
- Open an issue on GitHub
- Contact: @mintedmaterial
Made with โค๏ธ for the Sonic ecosystem