
Mcp Server Kalshi
io.github.9crusher由 GitHub 帳號 9crusher 發布v0.2.2更新於 Oct 24, 2026
MCP server for end-to-end trading on Kalshi prediction markets: discover, research, trade.
概覽
讓助理瀏覽 Kalshi 預測市場、閱讀結算規則與合約 PDF,並下單或管理交易。
- 可以做什麼
- 提供 MCP 工具來探索 Kalshi 的市場、事件與系列,研究訂單簿、K 線圖與成交紀錄,並閱讀結算規則,包括擷取合約條款 PDF 的文字。投資組合工具可讀取餘額、持倉、成交與結算,交易工具可建立、修改、減少、取消與列出訂單。下單工具採用買入/賣出加上是/否的模型,限價為整數美分,且下單需要明確的確認旗標,否則只回傳預覽。
- 適用情境
- 適合讓助理研究預測市場,並可能完成端到端交易,從市場探索、規則閱讀到訂單執行。適用於需要 Kalshi 市場資料或投資組合狀態的代理工作流程,也可在無憑證情況下以唯讀方式使用。
- 執行需求
- 透過 stdio 在本機執行,通常使用 uvx 或 Docker,本機開發需要 Python 3.10+。市場與規則工具不需要憑證;投資組合與訂單工具需要 KALSHI_API_KEY,以及指向 RSA 私鑰 .pem 的 KALSHI_PRIVATE_KEY_PATH。KALSHI_ENV 選擇 demo 或 prod,BASE_URL 可覆寫 REST 基礎位址。需要連線至 Kalshi 的網路存取。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Server Kalshi,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
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
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)
Claude Desktop (Docker)
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
Testing & code quality
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).
來源:README.md,提交 0cadb81
工具
0版本歷史
1- v0.2.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分