Skip to main content

MCP server for Kalshi prediction markets - search, analyze, and trade prediction markets through Claude Desktop

Project description

Kalshi MCP Server

MCP Python

Model Context Protocol server for Kalshi prediction markets. Search, analyze, and trade prediction markets directly through Claude Desktop.

Built with production-grade authentication and rate limiting from a live trading system with 4+ months of uptime.

Features

Tools (6)

  • search_markets - Search by keyword, get prices/volume
  • get_market_details - Full market info + orderbook depth
  • get_portfolio - Account balance + open positions
  • get_trending_markets - Top markets by 24h volume
  • place_order - Execute limit orders
  • get_series_markets - All markets in a series (e.g., Fed events)

Resources (2)

  • kalshi://balance - Current account balance
  • kalshi://positions - Open positions list

Installation

Prerequisites

  1. Kalshi API credentials: Get from kalshi.com/profile/api-keys

    • Download your API key ID
    • Download the RSA private key (.pem file)
  2. Python 3.10+

Setup

# Clone repository
git clone https://github.com/yakub268/kalshi-mcp.git
cd kalshi-mcp

# Install dependencies
uv pip install -e .

# Configure credentials
cp .env.example .env
# Edit .env with your API key and private key path

Claude Desktop Configuration

Add to your Claude Desktop config file:

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

{
  "mcpServers": {
    "kalshi": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/kalshi-mcp",
        "run",
        "kalshi_mcp.py"
      ],
      "env": {
        "KALSHI_API_KEY": "your-api-key-here",
        "KALSHI_PRIVATE_KEY_PATH": "/path/to/kalshi_private_key.pem"
      }
    }
  }
}

Important: Replace /ABSOLUTE/PATH/TO/kalshi-mcp with the actual path where you cloned the repository.

Test the Connection

Restart Claude Desktop, then try:

What's my Kalshi balance?

or

Search for bitcoin prediction markets

Usage Examples

Search for Markets

Search for markets about the Federal Reserve

Get Market Analysis

Show me details for ticker KXFED-26MAR19-B5.25

Check Portfolio

What's my current Kalshi portfolio?

Place an Order

Buy 10 contracts of KXHIGHNYC-26FEB20-B34.5 YES at 25 cents

Authentication

This server uses RSA-PSS signature authentication:

  1. Each request is signed with your private key
  2. Kalshi verifies the signature with your public key
  3. Thread-safe rate limiting (150ms between requests)
  4. Automatic retry on 429 rate limit errors

Security: Your private key never leaves your machine. The server only signs requests locally.

Rate Limiting

  • Built-in 150ms spacing between requests (~6.6 req/s)
  • Automatic exponential backoff on 429 errors (0.5s → 1s → 2s)
  • Safe for concurrent use across multiple Claude conversations

Architecture

Built on production code from a live Kalshi trading bot:

  • Authentication: Reused from kalshi_client.py (4+ months uptime)
  • Rate limiting: Shared across all client instances
  • Error handling: Battle-tested retry logic
  • Market discovery: Liquidity scoring from scanner.py

Contributing

Issues and PRs welcome! This is an open-source project built to fill a gap in the MCP ecosystem.

License

MIT License - see LICENSE file

Acknowledgments


Questions? Open an issue or reach out on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kalshi_mcp-0.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kalshi_mcp-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file kalshi_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: kalshi_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kalshi_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9126a68003924b1f4982d7c18f9185f2ed640089f521dcd2fc3f1e202a9aef5d
MD5 a2f135e6d962384244c2fe9b66390abd
BLAKE2b-256 e35a987f4bb503e021d7e203f7bbee1b95b957a1b759fbcc528334883b677d65

See more details on using hashes here.

File details

Details for the file kalshi_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kalshi_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for kalshi_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72cae44a5a907f0c0261a7cd6532edda1a0123b16b26ba635956f84519dbe7ba
MD5 8f449674914706aa7ea47b2fe212dcc1
BLAKE2b-256 dc4542c7c925644c095c397de795ec6b942bd856bca5b373cd3355af45f4b327

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page