Skip to main content
Glama
mcp-server-feraterra

mcp-server-feraterra

Official
by FeraTerra
README.md
# `mcp-server-feraterra` — Polymarket & Hyperliquid Backtesting MCP Server

[![MCP Server Stdio & C++23 Engine CI](https://github.com/FeraTerra/mcp-server-feraterra/actions/workflows/ci.yml/badge.svg)](https://github.com/FeraTerra/mcp-server-feraterra/actions/workflows/ci.yml)
[![PyPI - feraterra](https://img.shields.io/pypi/v/feraterra.svg)](https://pypi.org/project/feraterra/)
[![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg)](LICENSE)

Model Context Protocol (`stdio` JSON-RPC 2.0) server giving **Claude Code**, **Cursor**, **Claude Desktop**, and **Windsurf** direct access to [**Fera Terra**](https://feraterra.app)'s local C++23 L3 FIFO order-book matching engine (`pip install feraterra`).

Instead of letting coding agents validate trading bots with naive mid-price fill assumptions, `mcp-server-feraterra` lets your AI coding agent test Polymarket (`$0.001` binary claim books) and Hyperliquid (`BTC-PERP`, `ETH-PERP`, `SOL-PERP` ALO perps) strategies against real resting queue priority, taker sweeps, and cancel-window latency — **100% locally on your machine with zero API keys**.

---

## Exposed MCP Tools

| Tool Name | Description |
| :--- | :--- |
| `feraterra_doctor` | Run `<1s` preflight diagnostics on the local C++23 Shadow-CLOB engine, Python environment, license tier, and localhost ports. |
| `feraterra_list_crash_packs` | List deterministic 5-sigma microstructure stress scenarios (`polymarket_news_shock`, `whipsaw_funding_squeeze`, `flash_crash_5sigma`, `liquidity_vacuum_cascade`). |
| `feraterra_simulate_strategy` | Run a deterministic C++23 L3 FIFO vs. Naive Paper simulation with configurable `scenario`, `steps`, `order_latency_ms`, `cancel_latency_ms`, `half_spread_ticks`, and `quote_size_lots`. Works free on the `$0` Hobby tier. |
| `feraterra_replay_trace` | Replay any local `.trace.jsonl` order-book & trade-sweep tape against a custom Python `ArenaTwinBot` file (`bot_path`). |

---

## Quick Setup

### Option A: One-Line `uvx` Config (Cursor / Claude Desktop)

Add to `.cursor/mcp.json` or `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "feraterra": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/FeraTerra/mcp-server-feraterra.git",
        "mcp-server-feraterra"
      ]
    }
  }
}
```

### Option B: Claude Code CLI

```bash
claude mcp add feraterra -- uvx --from git+https://github.com/FeraTerra/mcp-server-feraterra.git mcp-server-feraterra
```

### Option C: Local `pip` Install

```bash
pip install "git+https://github.com/FeraTerra/mcp-server-feraterra.git"
mcp-server-feraterra
```

---

## Example Prompts Inside Cursor / Claude Code

- *"Run `feraterra_simulate_strategy` on `polymarket_news_shock` at `25ms` vs `160ms` cancel latency and explain why Naive Paper PnL diverges from L3 FIFO PnL."*
- *"Write a wider inventory-skewing Polymarket market maker in `my_bot.py` and test it with `feraterra_replay_trace` until cancel-lag snipes drop below 5."*
- *"Compare `half_spread_ticks=1` vs `half_spread_ticks=3` on Hyperliquid `whipsaw_funding_squeeze` using Fera Terra."*

## Links

- **Website & Interactive Playground:** [https://feraterra.app](https://feraterra.app)
- **PyPI (`feraterra` C++23 Engine):** [https://pypi.org/project/feraterra/](https://pypi.org/project/feraterra/)
- **Polymarket Starter Repo:** [https://github.com/FeraTerra/polymarket-paper-trading](https://github.com/FeraTerra/polymarket-paper-trading)
- **Hyperliquid Starter Repo:** [https://github.com/FeraTerra/hyperliquid-backtest-sim](https://github.com/FeraTerra/hyperliquid-backtest-sim)