# Moontower MCP Server

Moontower exposes a Model Context Protocol (MCP) server at `/mcp` so Claude Code and other MCP clients can call the API as typed tools.

## Server URL

```text
https://api.moontower.ai/mcp
```

## Authentication

Use the same API key as the REST API. Pass it in the `X-API-Key` header.

Do not commit API keys to `.mcp.json`, shell history, or project docs. Prefer an environment variable:

```bash
export MOONTOWER_API_KEY="mtw_..."
```

## Claude Code Setup

Add the hosted MCP server:

```bash
claude mcp add --transport http moontower https://api.moontower.ai/mcp \
  --header "X-API-Key: $MOONTOWER_API_KEY"
```

You can also configure `.mcp.json`:

```json
{
  "mcpServers": {
    "moontower": {
      "type": "http",
      "url": "https://api.moontower.ai/mcp",
      "headers": {
        "X-API-Key": "${MOONTOWER_API_KEY}"
      }
    }
  }
}
```

Verify the connection inside Claude Code:

```text
/mcp
```

## Available Tools

The MCP server exposes the public FastAPI endpoints as typed tools:

- `get_prices`
- `get_implied_volatility`
- `get_realized_volatility`
- `get_constant_maturity_implied_volatility`
- `get_iv_rank`
- `get_realized_vs_implied_volatility`
- `get_volatility_skew`
- `get_option_chain`
- `get_cockpit_statistics`
- `get_ticker_directory`
- `get_trade_ideas`

## Example Claude Prompts

```text
Use Moontower to get the latest price and 30-day IV data for SPY and QQQ.
```

```text
Find high-liquidity trade ideas for SPY, QQQ, and IWM, excluding earnings in the next 4 weeks.
```

```text
Compare realized volatility vs implied volatility for AAPL over the last week.
```

## Implementation Notes

The MCP server is generated from the FastAPI app with `fastapi-mcp`, so tool schemas and descriptions stay aligned with the OpenAPI definitions. Only public endpoint tags are exposed: Market Data, Options Data, Trade Ideas, and Reference Data.
