# Getting Started with CoinAPI + MCP

## Getting Started with CoinAPI + MCP

## Summary

Learn how to connect to CoinAPI's hosted MCP server for instant access to cryptocurrency market data through AI assistants like Cursor.

## Who is this for?

* **Beginners** who want cryptocurrency data in their AI assistant
* **Developers** looking for easy crypto market data integration
* **Anyone** interested in using MCP (Model Context Protocol) with real data

## What you'll learn

* How to get a CoinAPI account and API key
* How to configure MCP clients (like Cursor) to connect to CoinAPI
* How to use 51+ cryptocurrency tools through your AI assistant
* Best practices for API key security

## What is MCP?

Model Context Protocol (MCP) is a standard that allows AI assistants to connect to external data sources and tools. Instead of building custom integrations, you can use pre-built MCP servers that provide ready-to-use tools.

## What is CoinAPI?

CoinAPI provides comprehensive cryptocurrency market data including:

* Real-time and historical exchange rates
* OHLCV (Open, High, Low, Close, Volume) data
* Trade data and order book snapshots
* Asset metadata and symbol information

**CoinAPI offers a hosted MCP server** - no coding required!

## Step 1: Get Your CoinAPI Account

### 1.1 Sign Up for CoinAPI

1. **Visit the CoinAPI Console**: Go to [console.apibricks.io](https://console.apibricks.io/)
2. **Create Account**: Sign up for a free account
3. **Verify Email**: Check your email and verify your account

### 1.2 Get Your API Key

1. **Login** to your CoinAPI console
2. **Navigate to API Keys** section
3. **Create Standard API Key**
4. **Copy your API key** - you'll need this in the next step

### 1.3 Free Credits

✅ **New accounts get $25 in free credits**  
✅ **Perfect for testing and learning**

### 1.4 Service Status

Monitor CoinAPI service status at [status.coinapi.io](https://status.coinapi.io/)

## Step 2: Configure Your MCP Client

### 2.1 For Cursor Users

1. **Open Cursor Settings**: Press `Cmd + ,` (Mac) or `Ctrl + ,` (Windows/Linux)
2. **Find MCP Settings**: Look for "MCP" or "Model Context Protocol"
3. **Add Custom MCP Server**: Click "Add Custom MCP"
4. **Configure the Server**:

```
{
  "mcpServers": {
    "CoinAPI-Market-Data": {
      "url": "https://mcp.md.coinapi.io/mcp",
      "headers": {
        "X-CoinAPI-Key": "YOUR_API_KEY_HERE"
      }
    }
  }
}
```

**5. Replace** **`YOUR_API_KEY_HERE`** with your actual CoinAPI API key

**6. Save the configuration**

**7. Restart Cursor** completely (Cmd+Q, then reopen)

### 2.2 For Other MCP Clients

Most MCP clients support a similar configuration. Look for:

* **URL**: `https://mcp.md.coinapi.io/mcp`
* **Headers**: `X-CoinAPI-Key: YOUR_API_KEY`
* **Transport**: HTTP Streaming

## Step 3: Verify Your Connection

### 3.1 Check MCP Status

After restarting Cursor:

1. **Open Output Panel**: Go to `View → Output`
2. **Select MCP**: Choose "MCP" from the dropdown
3. **Look for Success Messages**: You should see connection logs
4. **Check Tools Count**: You should see "51 tools enabled" or similar

### 3.2 Test Your Setup

Try asking your AI assistant:

* *"What's the current Bitcoin price in USD?"*
* *"Get me the latest Ethereum price"*
* *"Show me BTC/USDT exchange rate"*

### 3.3 Expected Results

You should see:

✅ **Real-time cryptocurrency prices**  
✅ **Properly formatted responses**  
✅ **Tool usage in the conversation**  
✅ **Current market data**

## Step 4: Explore Available Tools

### 4.1 Exchange Rate Tools

**Get specific exchange rates:**

* *"What's the BTC/USD rate?"*
* *"Show me ETH/EUR exchange rate"*
* *"Get Bitcoin price in Japanese Yen"*

**Get all current rates:**

* *"Show me all current Bitcoin exchange rates"*
* *"List all Ethereum trading pairs"*

### 4.2 OHLCV Data Tools

**Latest candle data:**

* *"Get latest Bitcoin OHLCV data"*
* *"Show me Ethereum 1-hour candles"*
* *"Get BTC/USDT 5-minute data"*

**Historical data:**

* *"Show me Bitcoin price history for the last 24 hours"*
* *"Get Ethereum daily candles for this week"*

### 4.3 Trade Data Tools

**Latest trades:**

* *"Show me latest Bitcoin trades"*
* *"Get recent Ethereum transactions"*

**Order book data:**

* *"Show me Bitcoin order book"*
* *"Get ETH/USDT market depth"*

### 4.4 Asset Information

**Asset details:**

* *"Tell me about Bitcoin"*
* *"What is Ethereum?"*
* *"List all available cryptocurrencies"*

**Exchange information:**

* *"What exchanges support Bitcoin?"*
* *"Show me Binance trading pairs"*

## Step 5: Security Best Practices

### 5.1 API Key Security

**Never expose your API key:**

❌ **Don't commit API keys to version control**  
❌ **Don't share API keys in public forums**  
❌ **Don't include API keys in screenshots**

**Best practices:**

✅ **Use environment variables**  
✅ **Rotate keys regularly**  
✅ **Monitor API usage**  
✅ **Set up usage alerts**

### 5.2 Error Handling

**Common errors and solutions:**

* **401 Unauthorized**: Check your API key
* **429 Too Many Requests**: You've hit rate limits
* **500 Server Error**: Temporary CoinAPI issue

**If you encounter issues:**

1. Check [CoinAPI Status](https://status.coinapi.io/)
2. Verify your API key is correct
3. Check your rate limit usage
4. Contact CoinAPI support if needed

## Step 6: Troubleshooting

### 6.1 Connection Issues

**If MCP tools don't appear:**

1. **Restart Cursor completely** (Cmd+Q, then reopen)
2. **Check MCP logs** in Output panel
3. **Verify configuration** in `~/.cursor/mcp.json`
4. **Test API key** at [console.apibricks.io](https://console.apibricks.io/)

**If you see "No server info found":**

* Usually means MCP client can't connect
* Check your configuration format
* Verify the URL is correct

### 6.2 Data Issues

**If prices seem wrong:**

* Data is real-time and accurate
* Check if you're looking at the right asset pair
* Verify the timestamp of the data

**If tools don't respond:**

* Check your API key permissions
* Verify you have remaining credits
* Check CoinAPI service status

### 6.3 Performance Issues

**If responses are slow:**

* CoinAPI servers are optimized for speed
* Check your internet connection
* Some complex queries may take longer

**If you hit rate limits:**

* Wait for the limit to reset
* Consider upgrading your plan
* Optimize your queries

## Conclusion

🎉 **Congratulations!** You've successfully connected CoinAPI's MCP server to your AI assistant.

### What You've Accomplished

✅ **Set up a CoinAPI account** and obtained an API key  
✅ **Configured MCP client** to connect to CoinAPI's hosted server  
✅ **Gained access to 51+ cryptocurrency tools**  
✅ **Learned security best practices**  
✅ **Understood troubleshooting techniques**

### Key Benefits

🚀 **Instant access** to real-time cryptocurrency data  
🔧 **No server maintenance** required  
📊 **Comprehensive market data** (rates, OHLCV, trades, order books)  
🛡️ **Secure and reliable** hosted service  
💰 **Free credits** to get started

### What's Next?

1. **Integrate cryptocurrency data** into your workflows
2. **Build custom applications** using CoinAPI's data
3. **Share your success** with the community

### Resources

* [CoinAPI Documentation](https://docs.coinapi.io/)
* [CoinAPI Console](https://console.apibricks.io/)
* [CoinAPI Status](https://status.coinapi.io/)
* [MCP Documentation](https://modelcontextprotocol.io/)

**Happy trading! 📈🚀**