Kalshi MCP Server

平台与服务

by joinquantish

Self-hosted MCP server for Kalshi prediction market trading via DFlow on Solana

什么是 Kalshi MCP Server

Self-hosted MCP server for Kalshi prediction market trading via DFlow on Solana

README

@quantish/kalshi-server

⚠️ Notice: Quantish is winding down. The Quantish platform (quantish.live) is shutting down. This MCP server is self-hosted and will continue to work independently, but the Quantish team will no longer be maintaining or updating this project. If you're building in the prediction market space and need real-time data infrastructure, check out polynode.dev.

Self-hosted Kalshi MCP server for trading on Kalshi markets via DFlow on Solana.

Overview

This package provides an MCP (Model Context Protocol) server that enables AI agents to trade on Kalshi prediction markets through the DFlow protocol on Solana.

Features

  • Full Kalshi Trading - Buy/sell on any Kalshi market
  • Solana Wallet Management - Generate and manage Solana wallets
  • DFlow Integration - Trade via DFlow's Solana infrastructure
  • Jupiter Swaps - Swap SOL/USDC via Jupiter Aggregator
  • MCP Compatible - Works with Claude, Quantish Agent, and any MCP client
  • Self-Hostable - Run on Railway, Fly.io, or any Node.js host

Quick Start

bash
git clone https://github.com/joinQuantish/kalshi-mcp
cd kalshi-mcp
npm install

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
ENCRYPTION_KEYYes64-character hex string for wallet encryption
DFLOW_API_KEYNoDFlow API key (optional, for authenticated endpoints)
JUPITER_API_KEYNoJupiter API key from portal.jup.ag for swap tools
SOLANA_RPC_URLNoSolana RPC endpoint (defaults to mainnet)
ADMIN_API_KEYNoAdmin API key for administrative endpoints
PORTNoServer port (defaults to 3002)

Obtaining API Keys

DFlow API Key:

DFlow access may require approval. Contact the DFlow team at dflow.net for API access.

Jupiter API Key:

Get a free API key from portal.jup.ag (Basic tier, 1 RPS). Required for swap functionality.

Using Quantish's public servers? Quantish's public servers are no longer available as the platform is winding down. You must self-host this MCP server to use it. Follow the setup instructions above to run your own instance.

Generate Encryption Key

bash
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Database Setup

Any PostgreSQL database works. Options:

ProviderNotes
RailwayAdd PostgreSQL service, copy DATABASE_URL from variables
SupabaseFree tier at supabase.com, copy connection string from Settings > Database
NeonServerless Postgres at neon.tech, free tier available
Local Dockerdocker run -e POSTGRES_PASSWORD=pass -p 5432:5432 postgres

Set your DATABASE_URL then run:

bash
# Generate Prisma client
npm run db:generate

# Create tables
npm run db:push

Available Tools

Account Management

  • kalshi_signup - Create account with Solana wallet
  • kalshi_request_api_key - Request API key with access code
  • kalshi_get_wallet_info - Get wallet address and type
  • kalshi_get_wallet_status - Full wallet status including balances
  • kalshi_get_balances - Get SOL and USDC balances
  • kalshi_get_deposit_address - Get address for deposits
  • kalshi_export_private_key - Export wallet private key
  • kalshi_import_private_key - Import existing Solana wallet

Market Discovery

  • kalshi_search_markets - Search Kalshi markets by keyword
  • kalshi_get_market - Get market details by ticker
  • kalshi_get_event - Get event with all nested markets
  • kalshi_get_events - Browse events with filters
  • kalshi_get_live_data - Get live pricing data

Trading

  • kalshi_get_quote - Get quote for prediction market trade
  • kalshi_buy_yes - Buy YES outcome tokens
  • kalshi_buy_no - Buy NO outcome tokens
  • kalshi_sell_position - Sell outcome tokens back to USDC
  • kalshi_get_positions - View current positions
  • kalshi_get_orders - View order history

Swaps (SOL/USDC)

  • kalshi_get_swap_quote - Get Jupiter swap quote
  • kalshi_execute_swap - Execute token swap
  • kalshi_swap_sol_to_usdc - Swap SOL to USDC
  • kalshi_swap_usdc_to_sol - Swap USDC to SOL

Transfers

  • kalshi_send_sol - Send SOL to another wallet
  • kalshi_send_usdc - Send USDC to another wallet
  • kalshi_send_token - Send any SPL token

Market Operations

  • kalshi_check_market_initialization - Check if market is tokenized on-chain
  • kalshi_initialize_market - Initialize market on-chain (pays SOL fee)
  • kalshi_check_redemption_status - Check if market is settled
  • kalshi_get_market_by_mint - Look up market by token mint

Redemption

  • kalshi_get_redeemable_positions - Find positions ready to claim
  • kalshi_redeem_winnings - Redeem specific winning position
  • kalshi_redeem_all_positions - Redeem all winning positions at once

API Key Management

  • kalshi_list_api_keys - List your API keys
  • kalshi_create_additional_api_key - Create new API key
  • kalshi_revoke_api_key - Revoke an API key

API Format

The server exposes a JSON-RPC 2.0 endpoint at /mcp:

bash
curl -X POST https://your-server.com/mcp \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "kalshi_get_positions",
      "arguments": {}
    },
    "id": 1
  }'

Connecting to Quantish Agent

Configure the CLI to use your server:

bash
export KALSHI_MCP_URL=https://your-server.com/mcp
export KALSHI_API_KEY=your-api-key
quantish

Or add to ~/.quantish/config.json:

json
{
  "kalshiMcpUrl": "https://your-server.com/mcp",
  "kalshiApiKey": "your-api-key"
}

Development

bash
# Install dependencies
npm install

# Generate Prisma client
npm run db:generate

# Run migrations
npm run db:push

# Start development server
npm run dev

Resources

License

This project is licensed under the PolyForm Noncommercial License 1.0.0.

Free for personal use, research, and non-commercial purposes. Commercial use requires explicit permission from Quantish Inc. Contact hello@quantish.live for commercial licensing.


Built by Quantish Inc.

常见问题

Kalshi MCP Server 是什么?

Self-hosted MCP server for Kalshi prediction market trading via DFlow on Solana

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描114.1k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描114.1k

MCP服务构建器

by alirezarezvani

Universal
热门

从 OpenAPI 一键生成 Python/TypeScript MCP server 脚手架,并校验 tool schema、命名规范与版本兼容性,适合把现有 REST API 快速发布成可生产演进的 MCP 服务。

帮你快速搭建 MCP 服务与后端 API,脚手架完善、扩展顺手,尤其适合想高效验证服务能力的开发者。

平台与服务
未扫描10.2k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
83.4k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.4k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
35.4k

评论