Crypto_MCP_Server

Vrushabh100/Crypto_MCP_Server

3.1

If you are the rightful owner of 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 dayong@mcphub.com.

A simple Python-based MCP server for retrieving cryptocurrency market data with a web interface.

Crypto MCP Server

A simple Python-based MCP (Market Context Protocol) server for retrieving cryptocurrency market data with a web interface.

Overview

This project provides a lightweight cryptocurrency market data server with real-time price tracking, historical data queries, and a clean web interface using a red and grey color theme.

Features

  • Real-time Price Data: Fetch current prices for major cryptocurrencies
  • Market Summary: View total volume, gainers, and losers
  • Caching System: Built-in 60-second cache to optimize performance
  • Error Handling: Robust error handling throughout the application
  • Web Interface: Simple, clean UI with red/grey theme
  • Test Suite: Comprehensive unit tests for validation

Project Structure

.
├── server.py           # Python MCP server implementation
├── test_server.py      # Unit tests for server
├── src/
│   └── App.tsx         # React web interface
└── README.md           # This file

Setup

Backend (Python Server)

  1. Ensure Python 3.7+ is installed

  2. Run the server:

    python server.py
    
  3. Run tests:

    python -m unittest test_server.py
    

Frontend (Web Interface)

  1. Install dependencies:

    npm install
    
  2. Start development server:

    npm run dev
    
  3. Build for production:

    npm run build
    

API Endpoints

The MCP server provides the following methods:

1. Get Current Price

server.get_current_price('BTC')

Returns current price data for a specific cryptocurrency.

2. Get All Prices

server.get_all_prices()

Returns price data for all available cryptocurrencies.

3. Get Historical Data

server.get_historical_data('ETH', days=7)

Returns historical price data for a specified number of days.

4. Get Market Summary

server.get_market_summary()

Returns aggregated market statistics including volume, gainers, and losers.

Technical Approach

Architecture

  • Simple Design: Straightforward class-based Python structure
  • Mock Data: Uses simulated data for demonstration (can be replaced with real API calls)
  • Caching Layer: Time-based cache to reduce redundant computations
  • Separation of Concerns: Server logic separate from web interface

Caching Strategy

  • 60-second TTL (Time To Live) for cached data
  • Automatic cache invalidation on expiry
  • Cache hit/miss tracking in response metadata

Error Handling

  • Try-catch blocks around all operations
  • Descriptive error messages in response objects
  • Graceful degradation for missing data

Testing

  • Unit tests for cache functionality
  • Integration tests for all server methods
  • Test coverage for success and failure scenarios

Assumptions

  1. Mock Data: The server uses simulated cryptocurrency data. In production, this would be replaced with real API calls to services like CoinMarketCap or CCXT.

  2. Simplified Architecture: The implementation prioritizes simplicity and clarity over advanced features. No database persistence or complex state management.

  3. Basic Security: No authentication/authorization implemented. Production deployments should add proper security layers.

  4. Limited Cryptocurrencies: Currently tracks 5 major cryptocurrencies (BTC, ETH, BNB, SOL, ADA). Can be easily extended.

  5. Cache Duration: 60-second cache is suitable for demonstration. Production systems may need configurable cache durations based on use case.

Color Theme

The web interface uses a red and grey color scheme:

  • Primary: Red (#EF4444, #DC2626)
  • Background: Grey (#111827, #1F2937)
  • Text: White/Light Grey
  • Accents: Green for gains, Red for losses

Future Enhancements

  • Integration with real cryptocurrency APIs (CCXT, CoinMarketCap)
  • WebSocket support for real-time updates
  • Database persistence for historical data
  • Advanced charting capabilities
  • User authentication and watchlists
  • More comprehensive error logging
  • Rate limiting and API quotas

License

MIT License