The Problem: AI Agents Can't See the Market
You're building with Claude Code, Cursor, or a custom agent framework. Your agent can write code, search the web, and reason about complex problems. But ask it about prediction markets — recession odds, oil price forecasts, Fed rate decisions — and it hallucinates or cites stale data from training.
This isn't a model problem. It's a tool problem. The agent needs structured, real-time access to prediction market data, and there hasn't been a clean way to provide it — until MCP.
What Is MCP and Why It Matters for Markets
MCP (Model Context Protocol) is an open standard that lets AI agents call external tools through a typed, discoverable interface. Think of it as USB-C for agent capabilities: any MCP-compatible client (Claude Code, Cursor, Windsurf, custom agents) can connect to any MCP server and instantly gain new abilities.
SimpleFunctions provides an MCP server purpose-built for prediction markets. It exposes 29 tools that give your agent real-time access to data from Kalshi and Polymarket — 9,706+ active contracts covering politics, economics, crypto, AI, geopolitics, and more.
# One command to connect Claude Code to live market data
claude mcp add simplefunctions --url https://simplefunctions.dev/api/mcp/mcp
Once connected, your agent can scan markets, analyze orderbooks, create theses, detect edges, and even execute trades — all through natural language.
The Full Tool Catalog
SimpleFunctions MCP exposes tools organized by cognitive function — perceive, judge, act:
Perception Tools (Read the World)
| Tool | What It Does |
|---|---|
get_world_state |
~800-token markdown digest of 9,706 markets — geopolitics, economy, energy, elections, crypto, tech, AI |
get_world_delta |
Incremental updates since last check (30-50 tokens) |
scan_markets |
Natural language search across Kalshi + Polymarket |
get_market_detail |
Full market profile — price, volume, orderbook depth, history |
get_changes |
Price moves, new contracts, settlements (scanned every 15 min) |
get_contagion |
Cross-market causal gaps — when one market moves but a causally-linked market hasn't yet |
Judgment Tools (Analyze and Reason)
| Tool | What It Does |
|---|---|
get_context |
Full thesis snapshot — causal tree, assumptions, edges, latest evaluation |
what_if |
Scenario analysis ("what if oil hits $90?") — zero LLM cost, pure logic |
get_regime_scan |
Adverse selection diagnostics — labels each market as maker/taker/neutral |
get_ideas |
S&T-style trade ideas with structured rationale |
get_briefing |
Daily topic briefing (e.g., topic=iran) |
Action Tools (Write and Execute)
| Tool | What It Does |
|---|---|
create_thesis |
Decompose a plain-text thesis into a causal assumption tree |
inject_signal |
Feed new observations into a thesis |
trigger_evaluation |
Force immediate re-evaluation against live data |
create_intent |
Set up conditional trades with hard/soft triggers |
get_positions |
Your Kalshi + Polymarket positions with P&L |
get_balance |
Account balance across venues |
get_orders |
Resting orders |
get_fills |
Recent trade history |
What This Looks Like in Practice
You: What are the current recession odds on Kalshi?
[Claude calls scan_markets({query: "recession 2026"})]
Found 4 markets:
• KXRECSSNBER-26 — 35¢ (35% implied probability)
Volume: $1.2M | Spread: 1¢ | 24h change: +3¢
• KXRECSSNBER-26-Q3 — 22¢
• KXGDPNEG-26Q2 — 18¢
• KXUNEMPLOYMENT-26 — 41¢
The NBER recession contract has strong liquidity and a tight
spread. The market is pricing 35% probability, up 3¢ today,
possibly driven by the morning's weak jobs data.
Example 2: Thesis-Driven Analysis
You: Create a thesis that oil stays above $70 through Q3 2026
[Claude calls create_thesis({
thesis: "Oil stays above $70/barrel through Q3 2026",
})]
Thesis created. Decomposed into 4 causal assumptions:
1. OPEC maintains current production cuts (→ KXOPEC-26Q2)
2. China demand recovery continues (→ no direct contract)
3. No major SPR release (→ KXSPRELEASE-26)
4. Iran sanctions remain in place (→ KXIRAN-SANCTIONS-26)
Cross-referencing with live markets...
Assumption #4 has the widest edge: sanctions contract at 62¢
vs your thesis-implied 85%. That's a +23¢ edge on KXIRAN.
Example 3: Continuous Monitoring
You: What changed overnight in my thesis?
[Claude calls get_context({thesis_id: "th_abc123"})]
Overnight changes:
• KXOPEC-26Q2 moved +4¢ (71¢ → 75¢) — aligns with thesis
• New contract listed: KXOPECEMERGENCY-26Q2 (emergency meeting)
• News signal: Reuters reports Saudi inventory drawdown
• Edge on assumption #1 narrowed from +15¢ to +11¢
No action needed. Heartbeat evaluation at 03:15 UTC confirmed
all triggers still below threshold.
Architecture: How the Agent Loop Works
Whether you use MCP, CLI, or REST API, the pattern is the same:
┌─────────────────────────────────────┐
│ Your AI Agent │
│ (Claude Code / Cursor / Custom) │
└──────────┬──────────────────────────┘
│ MCP calls
▼
┌─────────────────────────────────────┐
│ SimpleFunctions MCP Server │
│ 29 tools • perceive/judge/act │
└──────────┬──────────────────────────┘
│
┌──────┴──────┐
▼ ▼
┌───��────┐ ┌──────────┐
│ Kalshi │ │Polymarket│
│ API │ │ CLOB API │
└────────┘ └──────────┘
The heartbeat engine handles routine monitoring — scanning news, refreshing prices, checking milestone triggers — every 15 minutes. Your agent focuses on high-level decisions: creating theses, interpreting signals, and deciding when to act.
Beyond MCP: CLI and REST API
The same capabilities are available through multiple interfaces:
CLI — For Scripts, Pipelines, and Terminal Workflows
npm install -g @spfunctions/cli
sf setup
# Scan markets
sf scan "fed rate decision"
# Get your thesis context as JSON for piping
sf context <thesis-id> --json | jq '.edges[] | select(.edge > 20)'
# Interactive agent mode — natural language in the terminal
sf agent
# Bloomberg-style dashboard
sf dashboard
REST API — For Custom Integrations
# Public endpoints (no auth required)
curl "https://simplefunctions.dev/api/agent/world"
curl "https://simplefunctions.dev/api/public/query?q=recession+2026"
curl "https://simplefunctions.dev/api/public/scan?q=oil+price"
# Authenticated endpoints
curl "https://simplefunctions.dev/api/thesis/<id>/context" -H "Authorization: Bearer sf_live_xxx"
Public endpoints are free with no authentication. The full API offers 15M free tokens per month, then $2/M tokens after that.
When to Use Each Interface
| Interface | Best For |
|---|---|
| MCP | Interactive agent sessions in Claude Code or Cursor — the agent discovers and calls tools naturally |
| CLI | Terminal workflows, shell scripts, quick lookups, the sf dashboard for continuous monitoring |
| REST API | Custom applications, webhooks, automated pipelines, integrating market data into your own tools |
All three share the same backend. A thesis created via CLI is immediately accessible via MCP and REST.
Getting Started
npm install -g @spfunctions/cli
sf setup
2. Connect MCP to Your Agent
# Claude Code
claude mcp add simplefunctions --url https://simplefunctions.dev/api/mcp/mcp
# Cursor — add to MCP config:
3. Create Your First Thesis
sf create "Your macro thesis here"
The system decomposes it into assumptions, maps them to live contracts, and starts monitoring. Every 15 minutes, it scans for news, refreshes prices, and re-evaluates whether your thesis still holds.
4. Let Your Agent Work
Once connected via MCP, just ask questions in natural language. The agent will call the right tools automatically:
- "What are the current odds on a Fed rate cut in June?"
- "Create a thesis that Bitcoin reaches $120K by year end"
- "What changed in my theses overnight?"
- "Find me the most mispriced contracts right now"
Full documentation and setup guide: simplefunctions.dev/docs




