# πͺ Crypto Tracker MCP Server Example
A **Model Context Protocol (MCP)** server that connects AI agents (like Claude Desktop or other MCP clients) to real-time cryptocurrency market data using the [CoinGecko API](https://www.coingecko.com/en/api).
This project demonstrates how to build and run a complete **MCP server** in **Node.js**, featuring:
- π§° **Tools** for interacting with crypto data
- π (Optional) **Resources** for reusable info sets
- π¬ (Optional) **Prompt Templates** for AI-assisted responses
---
## π Features
β
**Get Real-Time Prices** β Fetch live prices, market cap, and 24h change for any cryptocurrency
β
**Detailed Coin Info** β Retrieve full metadata for a specific coin
β
**Market Data** β Paginated list of coins ranked by market cap
β
**Search Coins** β Find coins by name or symbol
β
**Trending Coins** β Get currently trending cryptocurrencies on CoinGecko
---
## π§ What Is MCP?
> **MCP (Model Context Protocol)** is a new open standard that connects Large Language Models (LLMs) to external tools, APIs, and data sources through a single unified interface.
Each **MCP Server** can expose:
| Category | Description |
|-----------|--------------|
| π§° **Tools** | Functions or APIs that an LLM can call (like `get_price`) |
| π **Resources** | Static or dynamic data references (like coin lists, config files) |
| π¬ **Prompt Templates** | Predefined prompts or instruction templates |
Your LLM can then access and execute these capabilities safely and consistently.
---
## π§© Project Structure
```
crypto-mcp-server/
βββ server.js # Main MCP server implementation
βββ package.json # Dependencies and module config
βββ README.md # Documentation (this file)
````
---
## βοΈ Setup
### 1οΈβ£ Clone the repository
```bash
git clone https://github.com/<your-username>/crypto-mcp-server.git
cd crypto-mcp-server
````
### 2οΈβ£ Install dependencies
```bash
npm install
```
> Make sure your `package.json` includes `"type": "module"`
### 3οΈβ£ Run the server manually
```bash
node server.js
```
You should see:
```
CoinGecko MCP Server running on stdio
```
---
## π§© Integration with Claude Desktop
To connect this MCP server with **Claude Desktop**, edit your configuration file:
```bash
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
```
Add the following entry under `mcpServers`:
```json
{
"mcpServers": {
"coingecko": {
"command": "/Users/<your-username>/.nvm/versions/node/v22.17.1/bin/node",
"args": ["/Users/<your-username>/work/crypto-mcp-server/server.js"]
}
}
}
```
Then restart Claude Desktop. Youβll now be able to call this server using `/mcp` commands like:
```bash
/mcp coingecko get_price { "ids": "bitcoin", "vs_currencies": "usd" }
```
---
## π§° Available Tools
| Tool | Description | Example |
| ------------------ | --------------------------------------------- | ----------------------------------------------------- |
| `get_price` | Get current price, market cap, and 24h change | `{ "ids": "bitcoin", "vs_currencies": "usd" }` |
| `get_coin_details` | Get metadata about a specific coin | `{ "id": "ethereum" }` |
| `get_market_data` | Paginated market cap data | `{ "vs_currency": "usd", "per_page": 10, "page": 1 }` |
| `search_coins` | Search for cryptocurrencies | `{ "query": "solana" }` |
| `get_trending` | Get trending cryptocurrencies | `{}` |
---
## π οΈ Tech Stack
* **Node.js 22+**
* **@modelcontextprotocol/sdk**
* **CoinGecko REST API**
* **ES Modules (import/export syntax)**
---
## π‘ Future Enhancements
* Add **Resources** to store coin metadata or cached lookups
* Add **Prompt Templates** for summarizing market trends
* Add **Persistent local caching** for performance optimization
* Integrate with other APIs (Binance, CoinMarketCap, etc.)
## π§βπ» Author
**Saqib Hussain**
π Software Engineer | DevOps | AI Integrations
π [LinkedIn](https://www.linkedin.com/in/saqib-hussain-635780105/)
π’ Founder β [DevInspect](https://devinspect.co)