
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 分