An MCP server implementation for Kalshi prediction market endpoints
Project description
MCP Server Kalshi
An MCP server that gives Claude Code and other agent harnesses a first-class interface to Kalshi, the regulated prediction-market exchange. It is built for deep, 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. - 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.12+. - Run:
uv run start. - Test:
uv run pytest.
MCP Inspector
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-kalshi run start
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).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_kalshi-0.1.4.tar.gz.
File metadata
- Download URL: mcp_server_kalshi-0.1.4.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
590dcf79d25111c1cd2687209189167abfd5fc7d71955c3ef36ef0446ffd440b
|
|
| MD5 |
5bdeb4837004b78ac518a8968e9f0ebb
|
|
| BLAKE2b-256 |
c9eec2ef3f39d2acb5498e4ad4a6c06c29f166606e48e6cb8aeec8cab3743b68
|
Provenance
The following attestation bundles were made for mcp_server_kalshi-0.1.4.tar.gz:
Publisher:
deploy.yml on 9crusher/mcp-server-kalshi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_server_kalshi-0.1.4.tar.gz -
Subject digest:
590dcf79d25111c1cd2687209189167abfd5fc7d71955c3ef36ef0446ffd440b - Sigstore transparency entry: 2076064990
- Sigstore integration time:
-
Permalink:
9crusher/mcp-server-kalshi@1cc8e75f4690006c612d01fb34b393841d4ac401 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/9crusher
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@1cc8e75f4690006c612d01fb34b393841d4ac401 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp_server_kalshi-0.1.4-py3-none-any.whl.
File metadata
- Download URL: mcp_server_kalshi-0.1.4-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36d816272f68d88bc5bc66b402d409b96b6f0dac221fe16d4d5ce4a914e6d2d2
|
|
| MD5 |
8236335e692c005f97b9631d3ec0b000
|
|
| BLAKE2b-256 |
0f0c4d82a250b23bc4917b6096b81fb98934efbee861ba92b7c6e813fac47fdb
|
Provenance
The following attestation bundles were made for mcp_server_kalshi-0.1.4-py3-none-any.whl:
Publisher:
deploy.yml on 9crusher/mcp-server-kalshi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_server_kalshi-0.1.4-py3-none-any.whl -
Subject digest:
36d816272f68d88bc5bc66b402d409b96b6f0dac221fe16d4d5ce4a914e6d2d2 - Sigstore transparency entry: 2076065652
- Sigstore integration time:
-
Permalink:
9crusher/mcp-server-kalshi@1cc8e75f4690006c612d01fb34b393841d4ac401 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/9crusher
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@1cc8e75f4690006c612d01fb34b393841d4ac401 -
Trigger Event:
release
-
Statement type: