mcp-server-kalshi — Claude Code MCP server: trade on Kalshi
Wires Kalshi prediction markets into your agent: browse markets, read settlement rules, and place orders through MCP tools.
claude mcp add --env KALSHI_ENV=<KALSHI_ENV> --env KALSHI_API_KEY=<KALSHI_API_KEY> --env KALSHI_PRIVATE_KEY_PATH=<KALSHI_PRIVATE_KEY_PATH> --env BASE_URL=<BASE_URL> --transport stdio mcp-server-kalshi -- uvx mcp-server-kalshiWhat mcp-server-kalshi does
The server covers a full trade cycle. list_markets and get_market locate a market, get_market_orderbook and get_market_candlesticks supply the numbers, and get_market_rules pulls together primary and secondary rules, early-close conditions and settlement sources. fetch_rules_pdf downloads the legal contract and extracts its text so the agent can read it. Orders go through create_order, cancel_order, amend_order and decrease_order. Kalshi offers no free-text search, so list_markets filters are how you look.
Safety defaults matter here. The server points at Kalshi's demo sandbox unless you set KALSHI_ENV=prod. Order-placing tools need confirm=true; without it you get a preview with a readable summary and the exact payload, and nothing is submitted. Market and rules tools run unauthenticated — an API key plus RSA private key are only required for portfolio and trading calls.
Prices are given as whole cents alongside action (buy/sell) and side (yes/no), and the server translates that into Kalshi's V2 format, buy-NO and sell-YES price inversion included. Running it locally takes Python 3.10+ and uv sync, then uv run start. Requests are signed with RSA-PSS, so trading tools stay dead until the .pem private key path is set.
What it helps with
- find a Kalshi market through filters when there is no text search
- read the exact settlement rules before committing to a trade
- download and extract the contract-terms PDF
- check the orderbook and recent trades for a market
- place an order with a preview instead of firing it off blind
Example prompts for the agent
- List open Kalshi markets matching my filters and pick the most liquid ones
- Pull the settlement rules for this market and fetch the contract PDF
- Place a buy YES order at 40 cents, but show me the preview first
How to install mcp-server-kalshi
Platform CLI
claude mcp add --env KALSHI_ENV=<KALSHI_ENV> --env KALSHI_API_KEY=<KALSHI_API_KEY> --env KALSHI_PRIVATE_KEY_PATH=<KALSHI_PRIVATE_KEY_PATH> --env BASE_URL=<BASE_URL> --transport stdio mcp-server-kalshi -- uvx mcp-server-kalshiReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-server-kalshi <command>
Platform CLI
codex mcp add mcp-server-kalshi --env KALSHI_ENV=<KALSHI_ENV> --env KALSHI_API_KEY=<KALSHI_API_KEY> --env KALSHI_PRIVATE_KEY_PATH=<KALSHI_PRIVATE_KEY_PATH> --env BASE_URL=<BASE_URL> -- uvx mcp-server-kalshiReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-server-kalshi <command>
Config file
{
"mcpServers": {
"mcp-server-kalshi": {
"command": "uvx",
"args": [
"mcp-server-kalshi"
],
"env": {
"KALSHI_ENV": "<KALSHI_ENV>",
"KALSHI_API_KEY": "<KALSHI_API_KEY>",
"KALSHI_PRIVATE_KEY_PATH": "<KALSHI_PRIVATE_KEY_PATH>",
"BASE_URL": "<BASE_URL>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-server-kalshi <command>
Config file
{
"servers": {
"mcp-server-kalshi": {
"type": "stdio",
"command": "uvx",
"args": [
"mcp-server-kalshi"
],
"env": {
"KALSHI_ENV": "<KALSHI_ENV>",
"KALSHI_API_KEY": "<KALSHI_API_KEY>",
"KALSHI_PRIVATE_KEY_PATH": "<KALSHI_PRIVATE_KEY_PATH>",
"BASE_URL": "<BASE_URL>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-server-kalshi <command>
Platform CLI
gemini mcp add -e KALSHI_ENV=<KALSHI_ENV> -e KALSHI_API_KEY=<KALSHI_API_KEY> -e KALSHI_PRIVATE_KEY_PATH=<KALSHI_PRIVATE_KEY_PATH> -e BASE_URL=<BASE_URL> mcp-server-kalshi uvx mcp-server-kalshiReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-server-kalshi <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-server-kalshi
How do I install mcp-server-kalshi in Claude Code?
Run claude mcp add mcp-server-kalshi -e KALSHI_API_KEY=<KALSHI_API_KEY> -- uvx mcp-server-kalshi. To pass the other environment variables as well, use `claude mcp add --env KALSHI_ENV=<KALSHI_ENV> --env KALSHI_API_KEY=<KALSHI_API_KEY> --env KALSHI_PRIVATE_KEY_PATH=<KALSHI_PRIVATE_KEY_PATH> --env BASE_URL=<BASE_URL> --transport stdio mcp-server-kalshi -- uvx mcp-server-kalshi`.
What does mcp-server-kalshi do?
It exposes Kalshi prediction markets to your agent: market and event discovery, orderbook, candlesticks, trade history, settlement rules, and order placement or cancellation.
Do I need a Kalshi API key to use it?
Only for portfolio and order tools. Market and rules tools work without credentials; authenticated calls need an API key ID and the path to your RSA .pem key.