Skip to main content
Glama
Bichev
by Bichev
README.mdโ€ข19.3 kB
# Coinbase Chat MCP [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.3+-blue.svg)](https://www.typescriptlang.org/) [![Model Context Protocol](https://img.shields.io/badge/MCP-Compatible-orange.svg)](https://modelcontextprotocol.io/) An open-source **Model Context Protocol (MCP)** server and web application for seamless integration with Coinbase's public API. This project enables AI agents, LLMs, and developers to interact with cryptocurrency data, market information, and trading insights through a standardized, secure interface. ### ๐ŸŽฏ What's Real vs. Simulated? | Component | Status | Source | |-----------|--------|--------| | ๐Ÿ’ฐ **Cryptocurrency Prices** | โœ… **Real** | Coinbase Public API | | ๐Ÿ“Š **Market Statistics** | โœ… **Real** | Coinbase Public API | | ๐Ÿ“ˆ **Historical Data** | โœ… **Real** | Coinbase Public API | | ๐Ÿค– **GPT-4 AI Chat** | โœ… **Real** | OpenAI | | ๐ŸŽค **Voice Input (Whisper)** | โœ… **Real** | OpenAI | | ๐Ÿ”Š **Text-to-Speech** | โœ… **Real** | OpenAI | | ๐Ÿ”Œ **MCP Protocol** | โœ… **Real** | Official SDK | | ๐Ÿ’ต **Wallet Balances** | ๐ŸŽฎ **Simulated** | In-memory demo | | ๐Ÿ’ธ **Transactions** | ๐ŸŽฎ **Simulated** | Educational only | | ๐Ÿบ **Beer Purchases** | ๐ŸŽฎ **Simulated** | Virtual economy | **Perfect for learning crypto without financial risk!** ๐ŸŽ“ ## ๐ŸŒŸ Features ### ๐Ÿ”Œ MCP Server - **Full MCP Compliance** - Implements complete Model Context Protocol specification - **13 Powerful Tools** - Real-time prices, historical data, market stats, asset search, technical analysis, and transaction simulation - **๐Ÿบโ‚ฟ Circular Economy** - Complete flow: USD โ†’ Crypto โ†’ Virtual Beer! - **Smart Suggestions** - AI guides you to buy crypto if needed before purchases - **Virtual Wallet & Inventory** - Track balances, transactions, and beer collection - **Cursor Integration** - Pre-configured for Cursor IDE with `.cursor/mcp.json` - **Claude Desktop Compatible** - Works with any MCP-compatible client - **Secure & Fast** - Built-in rate limiting and intelligent caching ### ๐Ÿ’ฌ Interactive Chat Interface - **AI-Powered Conversations** - GPT-4 integration for intelligent crypto discussions - **Voice Input** - Speak your questions with multi-language support via OpenAI Whisper - **Text-to-Speech** - AI responses read aloud with natural voices - **Session Persistence** - Chat history saved across browser tabs and restarts - **Session Management** - Create, switch, and manage multiple chat sessions - **Auto-Titling** - Sessions automatically titled from first user message - **Real-time Sync** - Live updates when switching between sessions ### ๐Ÿš€ API Explorer - **Interactive Documentation** - Live testing interface for all 8 MCP tools - **Real-time Testing** - Execute API calls directly from the browser - **Code Generation** - Auto-generated cURL and JavaScript examples - **Copy-to-Clipboard** - Easy code sharing and integration - **Comprehensive Coverage** - All endpoints documented with parameters and examples ### ๐ŸŽจ Modern Frontend - **Beautiful UI** - Clean, responsive design with TailwindCSS - **Real-time Data** - Live cryptocurrency prices and market updates - **Multiple Pages** - Dashboard, Markets, Assets, Analysis, Chat, and API Explorer - **Mobile Friendly** - Responsive design works on all devices ## ๐Ÿš€ Quick Start ### Prerequisites - Node.js 18+ - npm 9+ ### Installation 1. **Clone the repository** ```bash git clone https://github.com/your-username/coinbase-chat-mcp.git cd coinbase-chat-mcp ``` 2. **Install dependencies** ```bash npm install # Install dependencies for all workspaces cd mcp-server && npm install && cd .. cd frontend && npm install && cd .. cd api-server && npm install && cd .. ``` 3. **Configure environment variables (Optional for AI features)** ```bash cd frontend # Create .env file with your OpenAI API key for voice features echo "VITE_OPENAI_API_KEY=your_openai_api_key_here" > .env cd .. ``` 4. **Build the MCP server** ```bash cd mcp-server npm run build cd .. ``` 5. **Start development servers** ```bash # Start API server (port 3002) cd api-server && npm run dev & # Start frontend (port 5173) cd frontend && npm run dev & ``` ## ๐Ÿค– MCP Integration ### Cursor IDE Setup (Recommended) The project includes pre-configured Cursor MCP settings: 1. **Automatic Configuration** - `.cursor/mcp.json` is already configured 2. **Restart Cursor** - MCP server will auto-load with 8 tools available 3. **Test Integration** - Try asking: "What's the current Bitcoin price?" ### Claude Desktop Setup Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`): ```json { "mcpServers": { "coinbase-mcp": { "command": "node", "args": ["/path/to/coinbase-chat-mcp/mcp-server/dist/index.js"], "env": { "COINBASE_API_URL": "https://api.coinbase.com/v2", "LOG_LEVEL": "info" } } } } ``` ### Available MCP Tools #### ๐Ÿ“Š Market Data Tools (8) 1. **get_spot_price** - Current cryptocurrency prices 2. **get_historical_prices** - Historical price data with time ranges 3. **get_exchange_rates** - Fiat currency exchange rates 4. **search_assets** - Find cryptocurrencies and assets 5. **get_asset_details** - Detailed asset information 6. **get_market_stats** - 24-hour market statistics 7. **get_popular_pairs** - Popular trading pairs 8. **analyze_price_data** - Technical analysis (volatility, trends, support/resistance) #### ๐Ÿบโ‚ฟ Demo Transaction Tools (5) - NEW! 9. **calculate_beer_cost** - Convert beer money to crypto amounts 10. **simulate_btc_purchase** - Simulate buying crypto with USD 11. **buy_virtual_beer** ๐Ÿ”ฅ - Buy virtual beer WITH crypto! (Circular economy) 12. **get_virtual_wallet** - View demo wallet balance and stats 13. **get_transaction_history** - View simulated transaction history ๐ŸŽฏ **Try asking**: "Buy me a beer!" โ†’ AI will guide you through USDโ†’BTCโ†’Beer! ๐Ÿ“– **Full docs**: [DEMO_TRANSACTIONS.md](./DEMO_TRANSACTIONS.md) โ€ข [CIRCULAR_ECONOMY.md](./CIRCULAR_ECONOMY.md) ## ๐Ÿ—๏ธ Architecture ### System Overview This project uses a **hybrid architecture** combining: - **Real market data** from Coinbase Public API - **Simulated wallet** for educational crypto transactions - **Official MCP protocol** for AI agent integration - **Modern web stack** for beautiful UX ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Cursor IDE โ”‚ โ”‚ Web Browser โ”‚ โ”‚Claude Desktopโ”‚ โ”‚ (MCP Client)โ”‚ โ”‚ (React App) โ”‚ โ”‚ (MCP Client)โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ MCP Server โ”‚ โ”‚ API Server โ”‚ โ”‚ (13 tools) โ”‚ โ”‚ (REST API) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Coinbase API โ”‚ โ”‚ Demo Wallet โ”‚ โ”‚ (Real Data) โ”‚ โ”‚ (Simulated) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ๐Ÿ“– **Detailed Architecture**: See [ARCHITECTURE.md](./ARCHITECTURE.md) for: - Component diagrams - Code examples - Real vs. simulated breakdown - Comparison with Base MCP and x402 - Technical deep dive ### Key Components ``` coinbase-chat-mcp/ โ”œโ”€โ”€ mcp-server/ # MCP Protocol Server (13 tools) โ”œโ”€โ”€ api-server/ # Express REST API Server โ”œโ”€โ”€ frontend/ # React + TypeScript Frontend โ”‚ โ”œโ”€โ”€ src/pages/ # Chat, Wallet, API Explorer โ”‚ โ”œโ”€โ”€ src/components/ # Reusable UI components โ”‚ โ””โ”€โ”€ src/services/ # AI, Voice, Chat sessions โ”œโ”€โ”€ docs/ # Comprehensive documentation โ””โ”€โ”€ .cursor/ # Cursor IDE MCP configuration ``` ### MCP Server Exposes 13 tools through Model Context Protocol: **Market Data Tools (8)**: - Real-time prices, historical data, market stats - Asset search and details, exchange rates - Technical analysis (volatility, trends, support/resistance) **Transaction Tools (5)**: - ๐Ÿบโ‚ฟ Beer-to-crypto calculator - Virtual wallet simulation (USD โ†’ Crypto) - Circular economy (Crypto โ†’ Beer!) - Balance & transaction history ### Frontend Application Modern React application featuring: - **AI Chat** - GPT-4 powered with voice input ๐ŸŽค and TTS ๐Ÿ”Š - **Virtual Wallet** - Demo crypto purchases and beer economy ๐Ÿบโ‚ฟ - **API Explorer** - Interactive documentation and testing - **Tutorial** - Step-by-step MCP integration guide - **Presentations** - Business slide deck viewer ## ๐Ÿ”ง Configuration ### Environment Variables Create `.env` files for AI chat functionality: ```bash # frontend/.env (Optional - for AI chat) VITE_OPENAI_API_KEY=your_openai_api_key_here ``` **Security Note**: The frontend includes built-in warnings about client-side API key usage and only enables AI features in development mode. ### ๐Ÿค– AI Chat & Voice Features Setup (Optional) To enable the AI-powered chat interface with voice capabilities: 1. **Get OpenAI API Key**: Visit [OpenAI Platform](https://platform.openai.com/api-keys) 2. **Create frontend/.env file**: ```bash VITE_OPENAI_API_KEY=sk-your-actual-api-key-here ``` 3. **Restart the frontend**: Chat will use GPT-4 for intelligent crypto discussions! #### ๐ŸŽค Voice Features (Requires OpenAI API Key) Once configured, you'll have access to: - **๐ŸŒ Multi-Language Voice Input** - Speak questions in any language using OpenAI Whisper - Supports 50+ languages including English, Spanish, French, German, Russian, Chinese, Japanese, and more - Real-time speech-to-text transcription - Click the purple microphone button to start recording - **๐Ÿ”Š Text-to-Speech Responses** - Hear AI responses read aloud - Click the speaker icon on any assistant message - Natural-sounding voices powered by OpenAI TTS - Multiple voice options available - **โšก Fallback Mode** - Without OpenAI key, basic Web Speech API provides English-only voice input **Note**: Without the API key, the chat interface provides a helpful setup message and basic functionality. ## ๐Ÿ“š Usage Examples ### MCP Tools in Cursor/Claude ``` User: "What's the current Bitcoin price?" Response: Current BTC-USD price: $100,608.65 USD User: "Show me Ethereum's price trend over the last 7 days" Response: [Historical price data with analysis] User: "Analyze Bitcoin's volatility this month" Response: [Technical analysis with volatility metrics] User: "Buy me a beer worth of Bitcoin!" ๐Ÿบ Response: At $110,360 per BTC, $5 = 0.00004531 BTC โœ… Purchased! You now have 0.00004531 BTC User: "Now buy a beer WITH that Bitcoin!" Response: ๐Ÿบ Beer Purchased with Crypto! Paid: 0.00004531 BTC Received: 1 ๐Ÿบ ๐ŸŽ‰ Total beers in inventory: 1 User: "Show my wallet" Response: ๐Ÿ‘› Virtual Wallet ๐Ÿ’ต USD: $995.00 ๐Ÿช™ BTC: 0.00000000 ๐Ÿบ Beers: 1 Total transactions: 2 ``` ### Frontend Web Application - **Visit**: `http://localhost:3005` - **Chat**: Persistent conversations with session management - **Voice Chat**: Click microphone to ask questions by voice in any language - **Listen to Responses**: Click speaker icon on messages to hear them read aloud - **API Explorer**: Test all 8 MCP tools interactively - **Dashboard**: Real-time market overview - **Markets**: Detailed trading statistics ### Direct API Usage ```bash # Get current Bitcoin price curl http://localhost:3002/api/v1/prices/BTC-USD # Search for assets curl http://localhost:3002/api/v1/assets/search?query=bitcoin ``` ## ๐Ÿ› ๏ธ Development ### Key Features Implemented - โœ… **MCP Server** - 13 tools, full protocol compliance - โœ… **Cursor Integration** - Pre-configured MCP setup - โœ… **Circular Economy** ๐Ÿบโ‚ฟ - Complete USDโ†’Cryptoโ†’Beer simulation - โœ… **Voice Interface** ๐ŸŽค - Multi-language input via Whisper - โœ… **Text-to-Speech** ๐Ÿ”Š - AI responses read aloud - โœ… **Virtual Wallet** - Demo crypto purchases and inventory - โœ… **Chat Sessions** - Persistent conversations with localStorage - โœ… **API Explorer** - Interactive documentation for all tools - โœ… **Session Management** - Create, switch, delete chat sessions - โœ… **AI Integration** - GPT-4 powered conversations with tool orchestration - โœ… **Transaction UI** - Beautiful receipts and visual feedback - โœ… **Security** - Rate limiting, validation, error handling ### Development Scripts ```bash # Build MCP server cd mcp-server && npm run build # Start API server (development) cd api-server && npm run dev # Start frontend (development) cd frontend && npm run dev # Test MCP server cd mcp-server && npm test ``` ### Project Structure - **mcp-server/**: TypeScript MCP server with 13 tools (8 market data + 5 wallet) - **api-server/**: Express.js REST API server with wallet simulation - **frontend/**: React + TypeScript with TailwindCSS, voice features, wallet UI - **docs/**: Comprehensive documentation (ARCHITECTURE.md, guides, etc.) - **.cursor/**: Cursor IDE MCP configuration ## ๐Ÿ“– Documentation ### Core Documentation - **[README.md](./README.md)** - This file! Project overview and quick start - **[ARCHITECTURE.md](./ARCHITECTURE.md)** ๐Ÿ—๏ธ - Complete technical architecture guide - System diagrams and component breakdown - Real vs. simulated components explained - Code examples and data flow - Comparison with Base MCP and x402 - Technology stack deep dive ### Feature Guides - **[DEMO_TRANSACTIONS.md](./DEMO_TRANSACTIONS.md)** ๐Ÿบโ‚ฟ - Transaction tools reference - All 5 wallet tools explained - Usage examples and scenarios - API reference - **[CIRCULAR_ECONOMY.md](./CIRCULAR_ECONOMY.md)** ๐Ÿ”„ - Complete economy guide - USD โ†’ Crypto โ†’ Beer flow - Smart suggestions when insufficient balance - Inventory tracking - Fun challenges and scenarios - **[CHAT_WALLET_INTEGRATION.md](./CHAT_WALLET_INTEGRATION.md)** ๐Ÿ’ฌ - Chat integration - Using wallet tools in conversation - Visual transaction receipts - Example conversations ### Setup & Configuration - **[MCP_SETUP_NOTES.md](./MCP_SETUP_NOTES.md)** - MCP integration guide for Cursor/Claude - **[DEPLOYMENT.md](./DEPLOYMENT.md)** - Deployment instructions - **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Development contribution guidelines ### Interactive Docs - **[API Explorer](http://localhost:5173/api-explorer)** - Interactive API testing (when running) - **[Swagger UI](http://localhost:3002/api-docs)** - REST API documentation (when running) ## โœจ Recent Updates ### ๐Ÿบโ‚ฟ Circular Economy (Latest!) - **Buy virtual beer WITH cryptocurrency!** - Complete USDโ†’Cryptoโ†’Beer flow - **Smart AI guidance** - Suggests buying crypto if insufficient balance - **Inventory tracking** - See your beer collection in wallet - **Transaction receipts** - Beautiful visual feedback in chat - **13 total MCP tools** - 8 market data + 5 transaction tools ### ๐ŸŽค Voice & AI Features - **Multi-language voice input** - Speak questions in 50+ languages (OpenAI Whisper) - **Text-to-speech** - Hear AI responses read aloud (OpenAI TTS) - **GPT-4 integration** - Intelligent conversations with tool orchestration - **Visual tool indicators** - See which MCP tools were used ### ๐Ÿ’ฐ Virtual Wallet System - **Demo transactions** - Safe crypto purchase simulation - **Beer calculator** - Fun way to understand crypto value - **Real-time pricing** - Uses live Coinbase data - **Transaction history** - Track all purchases - **Portfolio view** - See all balances in one place ### Chat Session Management - Persistent chat sessions across browser tabs - Session history with auto-titling - Real-time session switching - localStorage-based persistence - Observer pattern for live updates ### API Explorer - Interactive testing for all 8 MCP tools - Real-time API responses - Code generation (cURL, JavaScript) - Copy-to-clipboard functionality - Comprehensive parameter documentation ### Cursor MCP Integration - Pre-configured `.cursor/mcp.json` - Auto-loading of 8 MCP tools - Ready-to-use cryptocurrency queries - Professional development workflow ## ๐Ÿค Contributing We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details. 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/amazing-feature`) 3. Commit your changes (`git commit -m 'Add amazing feature'`) 4. Push to the branch (`git push origin feature/amazing-feature`) 5. Open a Pull Request ## ๐Ÿ“‹ Roadmap - [x] **v1.0**: Core MCP server with 8 tools - [x] **v1.1**: Chat session persistence - [x] **v1.2**: Interactive API explorer - [x] **v1.3**: Cursor IDE integration - [ ] **v1.4**: WebSocket real-time streaming - [ ] **v1.5**: Advanced charting and technical indicators - [ ] **v2.0**: Multi-exchange support ## ๐Ÿ› Known Issues - Rate limiting on Coinbase public API (60 requests/hour for some endpoints) - Chat sessions limited to localStorage (10 sessions max for performance) - Client-side API keys should only be used in development ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ™ Acknowledgments - [Model Context Protocol](https://modelcontextprotocol.io/) team for the excellent specification - [Coinbase](https://coinbase.com/) for providing robust public APIs - [Cursor](https://cursor.sh/) for excellent MCP integration - The open-source community for invaluable tools and libraries ## ๐Ÿ“ž Support - ๐Ÿ› **Bug Reports**: [GitHub Issues](https://github.com/your-username/coinbase-chat-mcp/issues) - ๐Ÿ’ฌ **Discussions**: [GitHub Discussions](https://github.com/your-username/coinbase-chat-mcp/discussions) - ๐Ÿ“ง **Questions**: Create an issue with the "question" label --- **Made with โค๏ธ by Vladimir Bichev for the crypto and AI communities**

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bichev/coinbase-chat-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server