Skip to main content
Glama
feraterra-mcp

feraterra-mcp

Official
by FeraTerra

feraterra-mcp

Zero-dependency Node.js >=20 Model Context Protocol (MCP) stdio server and ESM / TypeScript SDK for FeraTerra — sovereign central limit order book (CLOB) perpetuals, spot, basis spreads, stateless order simulation, and cryptographic Keccak-256 + secp256k1 solvency verification on Base (https://testnet.feraterra.app).

  • Zero npm dependencies: Built strictly on Node.js >=20 built-ins (fetch, node:crypto, node:http, node:stream) — 0 runtime dependencies and 0 install scripts for instant, supply-chain-clean npx -y github:FeraTerra/feraterra-mcp execution.

  • Full MCP 2025-11-25 & 2025-06-18 stdio server: Supports protocol negotiation (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05), ToolAnnotations, structured tool outputs, resources, prompts, --read-only guardrails, and automatic credential scrubbing.

  • Stateless pre-trade safety (account_id: 0): Simulate fills, fees, and Eigen-SPAN portfolio margin impact via POST /order/preview with zero state mutation.

  • Client-side cryptographic solvency audit: Pure-BigInt Keccak-256 and secp256k1 signature recovery (ecrecover) verifying ARENA_LEDGER_TIP_V2_1 WAL state roots without external elliptic-curve packages.


Quick Start (npx — Zero Install)

Verify your local Node.js >=20 runtime and run the built-in loopback HTTP + MCP stdio self-test directly from GitHub:

npx -y github:FeraTerra/feraterra-mcp --self-test

Or install as an ESM / TypeScript SDK in any Node.js project:

npm install github:FeraTerra/feraterra-mcp

Related MCP server: polymarket-mcp

MCP Client Configurations (npx -y github:FeraTerra/feraterra-mcp)

For read-only market discovery, order book analysis, stateless previewOrder (account_id: 0), and cryptographic solvency audits, no API keys are required. Add FERATERRA_ACCOUNT_ID, FERATERRA_API_KEY, and FERATERRA_API_SECRET only when enabling authenticated account inspection and order execution.

1. Claude Desktop (claude_desktop_config.json)

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "feraterra": {
      "command": "npx",
      "args": ["-y", "github:FeraTerra/feraterra-mcp"],
      "env": {
        "FERATERRA_API_URL": "https://testnet.feraterra.app"
      }
    }
  }
}

2. Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "feraterra": {
      "command": "npx",
      "args": ["-y", "github:FeraTerra/feraterra-mcp"],
      "env": {
        "FERATERRA_API_URL": "https://testnet.feraterra.app"
      }
    }
  }
}

3. Windsurf (~/.codeium/windsurf/mcp_config.json)

{
  "mcpServers": {
    "feraterra": {
      "command": "npx",
      "args": ["-y", "github:FeraTerra/feraterra-mcp"],
      "env": {
        "FERATERRA_API_URL": "https://testnet.feraterra.app"
      }
    }
  }
}

4. Cline (cline_mcp_settings.json)

{
  "mcpServers": {
    "feraterra": {
      "command": "npx",
      "args": ["-y", "github:FeraTerra/feraterra-mcp"],
      "disabled": false,
      "autoApprove": [
        "feraterra_list_markets",
        "feraterra_get_orderbook",
        "feraterra_get_trades",
        "feraterra_get_candles",
        "feraterra_get_leaderboard",
        "feraterra_verify_ledger_tip",
        "feraterra_preview_order",
        "feraterra_convert_units"
      ],
      "env": {
        "FERATERRA_API_URL": "https://testnet.feraterra.app"
      }
    }
  }
}

5. Antigravity (mcp_config.json)

{
  "mcpServers": {
    "feraterra": {
      "command": "npx",
      "args": ["-y", "github:FeraTerra/feraterra-mcp"],
      "env": {
        "FERATERRA_API_URL": "https://testnet.feraterra.app"
      }
    }
  }
}

6. Mastra (@mastra/mcp)

import { MCPClient } from "@mastra/mcp";

export const feraterraMcp = new MCPClient({
  servers: {
    feraterra: {
      command: "npx",
      args: ["-y", "github:FeraTerra/feraterra-mcp"],
      env: {
        FERATERRA_API_URL: "https://testnet.feraterra.app",
      },
    },
  },
});

Hosted Streamable HTTP Alternative (Zero Local Process)

Any MCP host supporting Streamable HTTP can also connect directly to the public FeraTerra MCP gateway:

{
  "mcpServers": {
    "feraterra-remote": {
      "type": "streamable-http",
      "url": "https://mcp.feraterra.app/mcp"
    }
  }
}

Exposed MCP Tools (13)

Tool

Endpoint / Mode

Auth

Description

feraterra_list_markets

GET /markets

Public

List active perpetual, spot, basis spread, and bounded-claim markets with USD mark prices and BBOs.

feraterra_get_orderbook

GET /book

Public

Fetch live L2/L3 order book depth, USD levels, base sizes, and top-of-book spread.

feraterra_get_trades

GET /trades

Public

Fetch recent CLOB trade executions with USD prices and base quantities.

feraterra_get_candles

GET /candles

Public

Fetch tick, 1s, or 1m OHLCV candles with formatted USD OHLC and base volume.

feraterra_get_leaderboard

GET /leaderboard

Public

Retrieve ranked traders sorted by equity, pnl, streak, volume, or roi.

feraterra_verify_ledger_tip

GET /ledger/tip + GET /health

Public

Verify ARENA_LEDGER_TIP_V2_1 Keccak-256 digest, secp256k1 operator signature, and conservation invariants.

feraterra_preview_order

POST /order/preview

Public (account_id: 0) / HMAC

Stateless zero-mutation pre-trade order simulation returning estimated fills, fees, and margin impact.

feraterra_get_account

GET /account

HMAC X-Arena-*

Inspect Eigen-SPAN equity, free/withdrawable USD, IMR/MMR, positions, and open orders.

feraterra_place_order

POST /order

HMAC X-Arena-*

Submit limit or market orders (gtc, ioc, fok, post_only, reduce_only).

feraterra_replace_quote

POST /quote

HMAC X-Arena-*

Atomically replace resting two-sided maker bid and ask quotes in 1 WAL step.

feraterra_cancel_order

POST /cancel

HMAC X-Arena-*

Cancel a specific resting order by order_id.

feraterra_cancel_all_orders

POST /cancel_all

HMAC X-Arena-*

Batch-cancel resting orders across all markets or filtered by market, side, or tag.

feraterra_convert_units

Local Pure Math

Offline

Convert exact fixed-point ticks ($0.01), lots (0.0001), and micro_usd (1e-6).


Node.js / TypeScript ESM SDK Usage

import {
  FeraTerraClient,
  baseToLots,
  lotsToBase,
  ticksToUsd,
  usdToTicks,
  verifyLedgerTip,
} from "feraterra-mcp";

// 1. Read-only + stateless preview (zero credentials needed)
const publicClient = new FeraTerraClient({
  baseUrl: "https://testnet.feraterra.app",
});

const markets = await publicClient.listMarkets({ activeOnly: true });
const book = await publicClient.getOrderbook({ symbol: "BTC-USD-PERP", depth: 10 });
const trades = await publicClient.getTrades({ symbol: "BTC-USD-PERP", limit: 20 });
const candles = await publicClient.getCandles({ symbol: "BTC-USD-PERP", interval: "1m", limit: 60 });
const leaderboard = await publicClient.getLeaderboard({ limit: 10, sort: "equity" });
const solvency = await publicClient.verifySolvency();

// Stateless dry-run preview with account_id: 0
const preview = await publicClient.previewOrder({
  accountId: 0,
  symbol: "BTC-USD-PERP",
  side: "buy",
  price: "70000.00",
  amount: "0.1",
  postOnly: true,
});

// Fixed-point unit helpers (1 tick = $0.01, 1 lot = 0.0001 base)
const pxTicks = usdToTicks("70000.25"); // 7000025
const pxUsd = ticksToUsd(pxTicks);      // "70000.25"
const qtyLots = baseToLots("0.25");     // 2500
const qtyBase = lotsToBase(qtyLots);    // "0.2500"

// 2. Authenticated HMAC-SHA256 trading client
const tradingClient = new FeraTerraClient({
  baseUrl: process.env.FERATERRA_API_URL ?? "https://testnet.feraterra.app",
  accountId: Number(process.env.FERATERRA_ACCOUNT_ID),
  apiKey: process.env.FERATERRA_API_KEY,
  apiSecret: process.env.FERATERRA_API_SECRET,
});

const account = await tradingClient.getAccount();
const order = await tradingClient.placeOrder({
  symbol: "BTC-USD-PERP",
  side: "buy",
  price: "69950.00",
  amount: "0.1",
  postOnly: true,
});
await tradingClient.cancelOrder({ symbol: "BTC-USD-PERP", orderId: order.order_id });

Environment Variables & CLI Flags

Variable

CLI Flag

Default

Description

FERATERRA_API_URL

--base-url <url>

https://testnet.feraterra.app

FeraTerra HTTPS gateway URL (ARENA_URL also accepted).

FERATERRA_ACCOUNT_ID

--account-id <id>

0

Default trader account ID (0 uses stateless preview; >0 required for /account and trading).

FERATERRA_API_KEY

--api-key <key>

(optional)

X-Arena-API-Key identifier for HMAC-SHA256 authenticated requests.

FERATERRA_API_SECRET

--api-secret <secret>

(optional)

HMAC-SHA256 signing secret (automatically redacted from MCP outputs and errors).

FERATERRA_EXPECTED_OPERATOR

--expected-operator <0x...>

(optional)

Pinned 0x... Ethereum operator signer address for GET /ledger/tip verification.

FERATERRA_READ_ONLY

--read-only

false

Disables mutating tools (feraterra_place_order, feraterra_replace_quote, feraterra_cancel_*).

FERATERRA_TIMEOUT_MS

--timeout-ms <ms>

10000

Per-request HTTP timeout in milliseconds.


Verification & Testing

node ./bin/feraterra-mcp.mjs --self-test
node --test test/*.test.mjs

License

MIT — Copyright (c) 2026 FeraTerra.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables users to search, analyze, and trade on Kalshi prediction markets directly through MCP-compatible clients. It supports portfolio management, market data retrieval, and limit order execution with production-grade authentication and rate limiting.
      27 PyPI
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      A read-only MCP server exposing Polymarket's public prediction-market data. Search markets, read live odds and order books, pull historical probability time-series, and inspect public wallet positions.
      14
      36 PyPI
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Read-only MCP server for Blocksize real-time market data: crypto VWAP, bid/ask, FX, metals and tokenized equities, with pricing, coverage and x402 endpoint lookup. Signed-in users of the Claude, ChatGPT and Cursor connectors get 30,000 free live-data credits every month (1 credit = $0.001); subscriptions from EUR 49/month.
      7
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents and MCP clients to browse prediction markets, inspect order books, trades and positions, and to place, cancel and manage orders, close positions and redeem winnings from a locally signing wallet. It also supports read-only operation and a hosted mode for market data only.
      MIT