Crypto MCP Server

Crypto MCP Server

Provides real-time and historical cryptocurrency market data using ccxt, enabling users to fetch live prices, historical candlestick data, and stream real-time ticker updates across multiple exchanges.

Category
Visit Server

README

πŸš€ Crypto MCP Server

πŸ“Œ Overview

Crypto MCP Server is a Model Context Protocol (MCP) compatible server that provides real-time and historical cryptocurrency market data using ccxt. It exposes three fully tested tools:

get_ticker β†’ Live price & market summary

get_ohclv β†’ Historical candlestick data

stream_ticker β†’ Real-time price streaming (async generator)

The project includes:

Custom error handling

In-memory caching

A lightweight MCP server architecture

Complete test suite (pytest)

Local client for manual testing

✨ Features

πŸ”Ή get_ticker

Fetches:

last price

high & low

base volume

price_change_percent

πŸ”Ή get_ohclv

Fetches OHLCV candles with:

timestamp

open

high

low

close

volume

πŸ”Ή stream_ticker

Real-time streaming ticker with async generator that yields updates every N seconds.

🧩 Project Structure

crypto-mcp-server/ β”‚ β”œβ”€β”€ server/ β”‚ β”œβ”€β”€ main.py β”‚ β”œβ”€β”€ mcp_server.py β”‚ β”œβ”€β”€ cache.py β”‚ β”œβ”€β”€ errors.py β”‚ β”œβ”€β”€ exchanges.py β”‚ └── tools/ β”‚ β”œβ”€β”€ get_ticker.py β”‚ β”œβ”€β”€ get_ohclv.py β”‚ └── stream_ticker.py β”‚ β”œβ”€β”€ tests/ β”‚ β”œβ”€β”€ test_get_ticker.py β”‚ β”œβ”€β”€ test_ohclv.py β”‚ └── test_stream_ticker.py β”‚ β”œβ”€β”€ client_test.py β”œβ”€β”€ README.md β”œβ”€β”€ requirements.txt └── .gitignore

πŸ› οΈ Tech Stack

Python 3.10+

ccxt for exchange APIs

pytest for testing

asyncio for streaming

MCP server protocol style

πŸ“¦ Installation

git clone https://github.com/yourusername/crypto-mcp-server cd crypto-mcp-server pip install -r requirements.txt

▢️ Running the MCP Server

From the server/ directory:

python -m server.main

You should see:

Crypto MCP Server running… Registered tools: get_ticker, get_ohclv, stream_ticker

πŸ§ͺ Running Tests

All tests are under tests/ and cover:

Valid/invalid symbols

Unsupported exchanges

API errors

Streaming behavior

Run:

pytest -vv

πŸ“ Tools Implemented

πŸ”Ή get_ticker

Handles:

Invalid symbols

Unsupported exchanges

ccxt API exceptions

Caching responses for 20 seconds

πŸ”Ή get_ohclv

Returns OHCLV historical candles

Validates timeframe & limit

Raises custom errors

πŸ”Ή stream_ticker

Async generator

Streams live ticker updates

Internal delay using asyncio.sleep()

Full validation & error handling

Caching Layer

cache.py implements simple in-memory TTL cache:

save(key, value, ttl)

get(key)

Prevents extra API calls

πŸ§ͺ Testing Strategy

Unit Tests (pytest)

Each tool has:

success test

invalid symbol test

invalid exchange test

API failure test

Streaming Tests

Uses asyncio.mark

Simulates multiple ticker updates

Checks generator behavior

πŸ§ͺ Local Testing Without MCP CLI

Run:

python client_test.py

It prints:

get_ticker result

get_ohclv candles

3 streamed ticker updates

πŸ” Example Output

--- Testing get_ticker --- {...}

--- Testing get_ohclv --- {...}

--- Testing stream_ticker --- {...}

πŸ“Œ Key Learning & Highlights

Designed full MCP-style server

Implemented async streaming tool

Wrote complete test suite

Built caching + error handling abstraction

Validated exchange + symbol inputs safely

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured