
一个用于与Kalshi预测市场互动的MCP服务器
概览
MCP服务器为Claude Code及其他代理提供一流的Kalshi接口。它专为端到端交易设计:浏览市场、研究市场、阅读具体结算规则(包括拉取合同条款PDF),并通过MCP工具执行交易。 - — list_markets、get_market、list_events、get_event、list_series、get_series。(Kalshi没有自由文本搜索;list_markets筛选器为搜索工具。)- — get_market_orderbook、get_market_candlesticks、get_market_trades。- — get_market_rules整合市场的rules_primary/rules_secondary、提前收盘条件、结算来源和系列禁令;fetch_rules_pdf下载并提取实际法律合同PDF文本,方便代理人阅读。- — get_exchange_status、get_exchange_schedule(市场开盘及其营业时间)。- — get_balance、get_positions、get_fills、get_settlements。- — create_order、cancel_order、amend_order、decrease_order,加上list_orders / get_order。
概述(AI 翻译)
提供 Claude Code 和其他代理的 MCP 服务器为 Kalshi。它专为端到端交易设计:浏览市场,研究它们,阅读精确的结算 规则(包括拉取合同条款PDF)和执行交易——所有这些都通过MCP工具完成。
精彩片段
- 发现 —
list_markets、get_market、list_events、get_event、list_series],get_series。(Kalshi 没有自由文本搜索;list_markets筛选器是搜索工具。) - 研究 —
get_market_orderbook、get_market_candlesticks、get_market_trades。 - 深层规则 —
get_market_rules整合市场的rules_primary/rules_secondary, 早期关闭条件、定居来源及系列禁令;fetch_rules_pdf下载并提取实际法律合同PDF的文本,方便代理人阅读。 - 交易所 —
get_exchange_status,get_exchange_schedule)(市场开市及其营业时间)。 - 投资组合 —
get_balance、get_positions、get_fills、get_settlements。 - 交易 —
create_order、cancel_order、amend_order、decrease_order, 加上list_orders/get_order。
安全默认
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 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
| 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": "",
安装
uvx mcp-server-kalshi配置
"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"
}
}
}