Kalshi MCP Server

Kalshi MCP Server

Give Claude access to Kalshi prediction markets โ€” browse live odds, analyze price history, and trade YES/NO contracts.

Category
Visit Server

README

Kalshi MCP Server

License: MIT Python 3.10+ MCP Kalshi API v2

Give Claude access to Kalshi prediction markets โ€” browse live odds, analyze price history, and trade YES/NO contracts.

Built on the Model Context Protocol (MCP), this server connects Claude (and any MCP-compatible AI) directly to the Kalshi Trade API v2.

First MCP server for Kalshi. Ask Claude "What are the current odds on the Fed rate decision?" and get a live answer.


Features

Tool Description Tier
get_markets Browse open/settled markets with filters ๐Ÿ†“ Free
get_market_details Live odds, volume, order book for a market ๐Ÿ†“ Free
get_market_price_history OHLC candlestick data (1-min, hourly, daily) ๐Ÿ†“ Free
get_portfolio Account balance and open positions ๐Ÿ”‘ Pro
place_order Buy YES/NO contracts (dry-run confirmation) ๐Ÿ”‘ Pro
get_order_history Fills, settlements, open orders ๐Ÿ”‘ Pro

Quick Start

1. Install

git clone https://github.com/shadowfax-mitch/kalshi-mcp-server
cd kalshi-mcp-server
pip install -r requirements.txt

Or install as a package:

pip install kalshi-mcp-server

2. Configure Claude Desktop

Add to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

Free Tier (read-only, no credentials needed)

{
  "mcpServers": {
    "kalshi": {
      "command": "python",
      "args": ["-m", "kalshi_mcp.server"],
      "cwd": "/path/to/kalshi-mcp-server"
    }
  }
}

Pro Tier (full trading access)

{
  "mcpServers": {
    "kalshi": {
      "command": "python",
      "args": ["-m", "kalshi_mcp.server"],
      "cwd": "/path/to/kalshi-mcp-server",
      "env": {
        "KALSHI_API_KEY": "your-api-key-uuid",
        "KALSHI_PRIVATE_KEY_PATH": "/absolute/path/to/private_key.pem"
      }
    }
  }
}

Pro Tier (with package install / pipx)

{
  "mcpServers": {
    "kalshi": {
      "command": "kalshi-mcp",
      "env": {
        "KALSHI_API_KEY": "your-api-key-uuid",
        "KALSHI_PRIVATE_KEY_PATH": "/absolute/path/to/private_key.pem"
      }
    }
  }
}

3. Restart Claude Desktop

After saving the config, restart Claude Desktop. You'll see a ๐Ÿ”จ tools icon โ€” click it to verify Kalshi tools are loaded.


Getting Kalshi API Credentials (Pro Tier)

  1. Go to https://kalshi.com/account/settings
  2. Navigate to API โ†’ Create API Key
  3. Download your RSA private key PEM file
  4. Copy your API key UUID
  5. Set both as environment variables (see config above)

Security: Never commit your private key or API key to version control.
Store them securely โ€” they provide full trading access to your account.


Usage Examples

Once configured, talk to Claude naturally:

Browse Markets

"Show me open BTC prediction markets"
โ†’ get_markets(series_ticker="KXBTC15M")

"What are the most liquid markets right now?"
โ†’ get_markets(status="open", limit=20)

"Show me recently settled markets"
โ†’ get_markets(status="settled", limit=10)

Market Research

"Get the full details for KXBTC15M-24NOV1913-T10000 including the order book"
โ†’ get_market_details("KXBTC15M-24NOV1913-T10000")

"Show me the hourly price chart for this market over the last 48 hours"
โ†’ get_market_price_history("KXBTC15M-...", period_interval=60, lookback_hours=48)

"Get 1-minute candles for the last hour"
โ†’ get_market_price_history("...", period_interval=1, lookback_hours=1)

Portfolio (Pro)

"What's my current balance and positions?"
โ†’ get_portfolio()

"Show me my recent trades and P&L"
โ†’ get_order_history(include_fills=True, include_settlements=True)

Trading (Pro)

Claude automatically uses a dry-run confirmation flow:

"Buy 10 YES contracts on KXBTC15M-... at 65 cents"

Claude:
1. Calls place_order(..., dry_run=True)  โ† preview
2. Shows you:
   ๐Ÿ“‹ ORDER PREVIEW (not submitted):
     Ticker:         KXBTC15M-24NOV1913-T10000
     Side:           YES
     Contracts:      10
     Limit price:    65ยข ($0.65)
     Estimated cost: $6.50
     Max payout:     $10.00
     Max profit:     $3.50

3. Asks: "Shall I submit this order?"
4. On confirmation: calls place_order(..., dry_run=False)

Tool Reference

get_markets

List Kalshi prediction markets.

Parameter Type Default Description
status str "open" "open", "closed", or "settled"
series_ticker str Filter by series (e.g. "KXBTC15M", "NASDAQ100D")
event_ticker str Filter by event
limit int 20 Results per page (max 200)
cursor str Pagination cursor

get_market_details

Full detail for a single market including live order book.

Parameter Type Default Description
ticker str required Market ticker
include_orderbook bool true Fetch live order book

get_market_price_history

OHLC candlestick price history.

Parameter Type Default Description
ticker str required Market ticker
period_interval int 60 Candle size in minutes: 1, 60, or 1440
lookback_hours int 24 Hours of history (1โ€“168)

get_portfolio (Pro)

Account balance and open positions. No parameters.


place_order (Pro)

Place a limit buy order.

Parameter Type Default Description
ticker str required Market ticker
side str required "yes" or "no"
count int required Number of contracts
price_cents int required Limit price in cents (1โ€“99)
dry_run bool true Preview without submitting (always start here)

Pricing guide:

  • Each contract pays $1.00 if you're correct, $0.00 if wrong
  • price_cents=65 means you pay 65ยข and profit 35ยข if correct
  • price_cents reflects the market's implied probability (65ยข โ‰ˆ 65% chance)

get_order_history (Pro)

Recent trading activity.

Parameter Type Default Description
include_fills bool true Recent executed trades
include_settlements bool true Settled contracts with P&L
include_open_orders bool true Resting limit orders
ticker str Filter to specific market
limit int 25 Records per section

Architecture

Claude Desktop
    โ”‚
    โ”‚  MCP (stdio)
    โ–ผ
kalshi_mcp/server.py      โ† FastMCP server, tool definitions, formatting
    โ”‚
    โ–ผ
kalshi_mcp/client.py      โ† Kalshi REST API client (httpx)
    โ”‚
    โ–ผ
kalshi_mcp/auth.py        โ† RSA-PSS signing (Kalshi API v2 auth scheme)
    โ”‚
    โ–ผ
https://api.elections.kalshi.com/trade-api/v2

Auth scheme (RSA-PSS):

Signature = RSA-PSS(
    message  = f"{unix_timestamp}{METHOD}{/trade-api/v2/endpoint}",
    hash     = SHA-256,
    mgf      = MGF1(SHA-256),
    salt_len = 32
)

Headers:
  KALSHI-ACCESS-KEY       = api_key_uuid
  KALSHI-ACCESS-SIGNATURE = base64(signature)
  KALSHI-ACCESS-TIMESTAMP = unix_timestamp_seconds

Development

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Type check
mypy kalshi_mcp/

# Lint
ruff check kalshi_mcp/

# Test the server manually (stdio transport)
python -m kalshi_mcp.server

Project Structure

kalshi-mcp-server/
โ”œโ”€โ”€ kalshi_mcp/
โ”‚   โ”œโ”€โ”€ __init__.py      # Package metadata
โ”‚   โ”œโ”€โ”€ server.py        # MCP server & tool definitions
โ”‚   โ”œโ”€โ”€ client.py        # Kalshi API client
โ”‚   โ””โ”€โ”€ auth.py          # RSA-PSS authentication
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_client.py   # Unit tests
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ .env.example

Pricing & Tiers

๐Ÿ†“ Free Tier

  • Market browsing โ€” search and filter thousands of markets
  • Live odds โ€” real-time YES/NO prices and order books
  • Price history โ€” OHLC candlestick data for any market
  • No API credentials required

๐Ÿ”‘ Pro Tier

Everything in Free, plus:

  • Portfolio view โ€” balance, positions, unrealized P&L
  • Order placement โ€” buy YES/NO contracts with confirmation flow
  • Order history โ€” fills, settlements, open orders

Available at: PaidMCP | GitHub Sponsors


Security

  • Never trade with funds you can't afford to lose. Prediction markets carry real financial risk.
  • Store your API key and private key securely. Never commit them to version control.
  • The place_order tool defaults to dry_run=True โ€” orders require explicit confirmation.
  • Consider setting position size limits at the Kalshi account level as an extra safeguard.

Troubleshooting

"Auth init failed (free-tier only)"
โ†’ Check that KALSHI_API_KEY is a valid UUID and KALSHI_PRIVATE_KEY_PATH points to your PEM file.

"Kalshi API 401"
โ†’ Your key may be expired or revoked. Regenerate at kalshi.com/account/settings.

"Kalshi API 403"
โ†’ You may be trying a pro feature without valid credentials, or your account may be restricted.

Tools not showing in Claude Desktop
โ†’ Verify the cwd path in your config. Restart Claude Desktop after any config change.

"period_interval must be 1, 60, or 1440"
โ†’ Kalshi only supports these candle sizes. Use 1 (minute), 60 (hourly), or 1440 (daily).


Contributing

Pull requests welcome! Please open an issue first for significant changes.

git clone https://github.com/shadowfax-mitch/kalshi-mcp-server
cd kalshi-mcp-server
pip install -e ".[dev]"
pytest tests/

License

MIT License โ€” see LICENSE


Disclaimer

This is an unofficial third-party tool. It is not affiliated with, endorsed by, or sponsored by Kalshi Inc. Use of the Kalshi API is subject to Kalshi's Terms of Service. Trading prediction markets involves financial risk.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured