> ## Documentation Index
> Fetch the complete documentation index at: https://docs.marketdataset.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Use MarketDataset directly in Claude, Cursor, and other AI agents via MCP

The MarketDataset MCP Server exposes all data endpoints as [Model Context Protocol](https://modelcontextprotocol.io) tools. This lets AI agents (Claude, GPT-4, Cursor, etc.) query live market data mid-conversation without writing custom code.

## Available tools

| Tool                       | Description                      |
| -------------------------- | -------------------------------- |
| `get_forex_prices`         | Historical OHLCV for forex pairs |
| `get_forex_pairs`          | List available forex pairs       |
| `get_forex_cot_reports`    | CFTC COT positioning data        |
| `get_crypto_prices`        | Historical OHLCV for crypto      |
| `get_crypto_assets`        | List available crypto assets     |
| `get_crypto_funding_rates` | Perpetual futures funding rates  |
| `get_crypto_open_interest` | Futures open interest            |
| `get_crypto_liquidations`  | Forced liquidation history       |
| `get_macro_calendar`       | Economic calendar events         |
| `get_central_bank_rates`   | G10 central bank interest rates  |

## Installation

```bash theme={null}
cd mcp-server
npm install
npm run build
```

## Configuration

### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json theme={null}
{
  "mcpServers": {
    "marketdataset": {
      "command": "node",
      "args": ["/path/to/marketdataset/mcp-server/dist/index.js"],
      "env": {
        "MARKETDATASET_API_KEY": "sk_your_key_here"
      }
    }
  }
}
```

### Cursor

Add to `.cursor/mcp.json` in your project:

```json theme={null}
{
  "mcpServers": {
    "marketdataset": {
      "command": "node",
      "args": ["/path/to/marketdataset/mcp-server/dist/index.js"],
      "env": {
        "MARKETDATASET_API_KEY": "sk_your_key_here"
      }
    }
  }
}
```

## Example usage in Claude

Once configured, you can ask Claude:

> "What is the current EURUSD funding rate environment? Show me the last 30 days of funding rates for BTCUSDT."

> "Analyze the COT report for EURUSD over the last 6 months and identify any positioning extremes."

> "Get me the 4-hour BTCUSDT candles from November 2024 with the corresponding open interest data."

## Environment variables

| Variable                | Description                                             |
| ----------------------- | ------------------------------------------------------- |
| `MARKETDATASET_API_KEY` | Your API key (required)                                 |
| `MARKETDATASET_API_URL` | Base URL override (default: `https://marketdataset.ai`) |
