Skip to content

MCP Server

Victor Kaiuki edited this page Jun 20, 2026 · 1 revision

MCP Server

The SDK ships a Model Context Protocol server that exposes CFTC COT data and analysis to MCP-compatible LLM clients (Claude Desktop, IDE assistants, etc.) over stdio transport. The server reuses COTClient and COTAnalysis internally — it doesn't call any LLM itself.

Installation

pip install cftc-cot-soda[mcp]   # requires Python >= 3.10

This registers the cftc-cot-mcp console script. Run it directly to test:

cftc-cot-mcp
# or: python -m cftc_cot.mcp_server

Claude Desktop config

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "cftc-cot": {
      "command": "cftc-cot-mcp"
    }
  }
}

Tools

Every market tool accepts dataset ("legacy" / "disaggregated" / "tff") and an exact flag (default false = case-insensitive prefix match). A market that matches nothing raises a clear error rather than returning an empty result.

Tool Description
list_markets List available markets for a dataset.
latest_report Most recent COT report for a market.
history N weeks of history (newest first).
net_positions Net (long − short) per trader category.
cot_index Classic 0–100 COT Index over a rolling window.
z_scores Rolling Z-scores of net positions.
long_short_ratios Long/short ratios per category.
wow_change Week-over-week change in net positions.
percentile_rank Percentile rank (0–1) of a net-position column's latest value.
extremes Flag the latest bullish/bearish extreme.

Resources

URI Description
cot://datasets Dataset names and Socrata dataset ids.
cot://fields/{classification} Field-name reference for legacy/disaggregated/tff.

Prompts

Prompt Description
analyze_market(market, dataset) Guide a full positioning analysis (COT Index → extremes → week-over-week).
positioning_summary(market, dataset) Produce a concise positioning summary.

Notes

  • The server uses an in-memory cache, so repeated queries within a session don't re-hit the CFTC API (COT data updates weekly).
  • The mcp extra requires Python ≥ 3.10; the core SDK supports ≥ 3.9.

Clone this wiki locally