Sponsored by Deepsite.site

🪙 Crypto MCP Server

Created By
yoelbassin8 months ago
Vibe Coding an MCP Crypto Price Server lol
Content

🪙 Crypto MCP Server

Python Version License

A FastMCP server providing real-time cryptocurrency data from the API Ninjas Crypto API.

This server exposes tools via the Model Context Protocol (MCP) allowing compatible clients (like Claude, Cursor, etc.) to easily query cryptocurrency symbols and their current prices.

✨ Features

  • List Symbols: Get a list of all available cryptocurrency symbols.
  • Get Price: Fetch the current price and timestamp for a specific symbol.
  • MCP Compliant: Built using FastMCP for standard MCP communication.
  • Async API Client: Uses httpx for efficient, non-blocking API calls.
  • Validated Data: Uses pydantic for robust data validation.
  • Tested: Includes unit and integration tests (pytest).

🚀 Getting Started

Follow these steps to set up and run the server locally.

Prerequisites

  • Python 3.10 or higher
  • git
  • A virtual environment tool (like venv or uv)
  • An API Key from API Ninjas (specifically for the Crypto API)

Installation & Setup

  1. Clone the repository:

    git clone https://github.com/<your-username>/crypto-mcp-server.git # Replace with actual repo URL
    cd crypto-mcp-server
    
  2. Create and activate a virtual environment: Using venv (standard library):

    python3 -m venv venv
    source venv/bin/activate # On Windows use `venv\Scripts\activate`
    

    Using uv (if installed):

    uv venv venv
    source venv/bin/activate
    
  3. Install dependencies: Using pip (with venv):

    pip install -e ".[dev]" # Installs in editable mode + dev dependencies
    

    *Using uv:

    uv sync --all-features
    
  4. Create .env file: Create a file named .env in the project root directory and add your API key:

    API_NIINJAS_API_KEY="YOUR_API_NINJAS_CRYPTO_API_KEY"
    

    Replace YOUR_API_NINJAS_CRYPTO_API_KEY with the actual key you obtained.

Running the Server

Once set up, you can run the MCP server using the fastmcp command:

fastmcp run main.py

The server will typically start on http://127.0.0.1:8000.

You can then connect your MCP client to this address.

🛠️ Available Tools

The server exposes the following tools to MCP clients:

  • list_crypto_symbols():
    • Description: Fetches a list of all available cryptocurrency symbols from the API.
    • Returns: List[str] - A list of symbol strings (e.g., ['BTCUSD', 'ETHBTC', ...]).
  • get_crypto_price(symbol: str):
    • Description: Fetches the current price and timestamp for a specific cryptocurrency symbol.
    • Args:
      • symbol (str): The cryptocurrency symbol (e.g., 'BTCUSD', 'ETHBTC'). Use list_crypto_symbols to find available symbols.
    • Returns: Dict[str, Any] - A dictionary containing the symbol, its price (as a string), and the Unix timestamp (e.g., {'symbol': 'BTCUSD', 'price': '65432.10', 'timestamp': 1678886400}).
    • Raises: ValueError if the symbol is not found or invalid.

🧪 Development & Testing

To run the tests:

  1. Ensure you have installed the development dependencies (pip install -e ".[dev]" or uv sync --all-features).
  2. Run pytest:
    pytest -v
    

Integration tests require a valid API_NIINJAS_API_KEY in your .env file and will be skipped otherwise.

🙏 Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details (assuming MIT, create LICENSE file if needed).

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
DeepChatYour AI Partner on Desktop
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Serper MCP ServerA Serper MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
ChatWiseThe second fastest AI chatbot™
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Playwright McpPlaywright MCP server
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"