MCP Server Kalshi
An MCP server that gives Claude Code and other agent harnesses a first-class interface to Kalshi. It is built for end-to-end trading: browse markets, research them, read the exact settlement rules (including pulling the contract-terms PDFs), and execute trades — all through MCP tools.
Highlights
- Discovery —
list_markets,get_market,list_events,get_event,list_series,get_series. (Kalshi has no free-text search;list_marketsfilters are the search.) - Research —
get_market_orderbook,get_market_candlesticks,get_market_trades. - Deep rules —
get_market_rulesconsolidates a market'srules_primary/rules_secondary, early-close conditions, settlement sources, and series prohibitions;fetch_rules_pdfdownloads and extracts the text of the actual legal contract PDF so the agent can read it. - Exchange —
get_exchange_status,get_exchange_schedule(is the market open, and its hours). - Portfolio —
get_balance,get_positions,get_fills,get_settlements. - Trading —
create_order,cancel_order,amend_order,decrease_order, pluslist_orders/get_order.
Safety by default
- The server targets Kalshi's demo (sandbox) environment unless you explicitly set
KALSHI_ENV=prod. - Order-placing tools (
create_order,amend_order) requireconfirm=true. Without it they return a preview — a human-readable summary and the exact payload — and place nothing. - Credentials are optional: all market/rules tools work unauthenticated. Only portfolio and order tools need an API key + RSA private key.
Intuitive order model
Kalshi's V2 order API quotes everything from the YES leg (bid/ask in fixed-point dollars).
This server exposes the natural model instead — action (buy/sell) + side (yes/no) + a whole
cents limit price — and translates it (including the buy-NO ⇄ sell-YES price inversion).
Configuration
| Variable | Default | Purpose |
|---|---|---|
KALSHI_ENV |
demo |
demo (sandbox) or prod (real money). Derives the base URL. |
KALSHI_API_KEY |
(none) | Kalshi API key ID. Required only for authenticated tools. |
KALSHI_PRIVATE_KEY_PATH |
(none) | Path to your RSA private key .pem. Required for authenticated tools. |
BASE_URL |
(derived) | Optional explicit REST base override (must include /trade-api/v2). |
See .env-example. Get API credentials at
docs.kalshi.com/getting_started/api_keys
and a demo account via the
demo environment guide.
Claude Desktop (uvx)
"mcpServers": {
"kalshi": {
"command": "uvx",
"args": ["mcp-server-kalshi"],
"env": {
"KALSHI_ENV": "demo",
"KALSHI_API_KEY": "<YOUR KALSHI API KEY>",
"KALSHI_PRIVATE_KEY_PATH": "PATH TO YOUR RSA KEY FILE"
}
}
}
Claude Desktop (Docker)
"mcpServers": {
"kalshi": {
"command": "docker",
"args": ["run", "--rm", "-i",
"--mount", "type=bind,src=/Users/username,dst=/Users/username",
"-e", "KALSHI_ENV", "-e", "KALSHI_API_KEY", "-e", "KALSHI_PRIVATE_KEY_PATH",
"mcp-server-kalshi"],
"env": {
"KALSHI_ENV": "demo",
"KALSHI_API_KEY": "<YOUR KALSHI API KEY>",
"KALSHI_PRIVATE_KEY_PATH": "PATH TO YOUR RSA KEY FILE"
}
}
}
Local Development
- Create a
.envfile (see.env-example). - Install deps:
uv sync(add--extra devfor dev tools). Requires Python 3.10+. - Run:
uv run start. - Test:
uv run pytest.
MCP Inspector
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-kalshi run start
Testing & code quality
uv sync --extra dev # install dev tools (ruff, mypy, pytest, ...)
uv run pytest # run the test suite
uv run pytest --cov # tests with a coverage report
uv run ruff check src tests # lint
uv run black src tests # format (add --check to verify only)
uv run mypy # type check
uv run pre-commit install # (once) run ruff + black on every commit
Tests are pure/offline — they exercise the order translation and confirm-gate, the HTTP client
(via an injected httpx.MockTransport), the MCP tool registry, config, and PDF extraction, all
without touching the live Kalshi API. CI (.github/workflows/ci.yml) runs ruff + black + mypy +
pytest across Python 3.10–3.13 on every push/PR, and releases are gated on that same suite.
Authentication
Requests are signed with RSA-PSS (MGF1-SHA256, max salt). Each authenticated request sends
KALSHI-ACCESS-KEY, KALSHI-ACCESS-TIMESTAMP, and KALSHI-ACCESS-SIGNATURE, where the signed
message is timestamp_ms + METHOD + path (path includes /trade-api/v2, excludes the query
string).
Metadata
Release files for mcp-server-kalshi 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcp_server_kalshi-0.2.4.tar.gz | 27.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_server_kalshi-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.1 kB
Release files / mcp_server_kalshi-0.2.4.tar.gz
| Download URL | mcp_server_kalshi-0.2.4.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee22904fa7e568aac3b1a2533aab22878185c5476afd3f09e1e8cc1a192ab763
|
|
BLAKE2b-256 checksum How to use checksums |
e692bdcbe4bb25f92deb842308afe40b20a773b6c8396d9d2b5fc9d373f42229
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / mcp_server_kalshi-0.2.4-py3-none-any.whl
| Download URL | mcp_server_kalshi-0.2.4-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b2fd14e1314e6f7757fb52cd2066e08458f3688fbdb3c906592d186743eb205a
|
|
BLAKE2b-256 checksum How to use checksums |
1028e9aabbd83077b8c8472f0529a1fee34c9dccc09c09967bb5fffc7f76c3c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency log