TypeScriptADK-TS

MCP Kalshi

Access and trade on prediction markets via the Kalshi platform API.

Overview

The Kalshi MCP server connects your agent to Kalshi's regulated prediction markets. It can fetch active markets, retrieve market prices and probabilities, place trades, and query your open positions — enabling agents to reason about real-world outcomes using financial prediction data.

API Credentials Required

Trading on Kalshi requires a funded account and valid API credentials. Paper trading is not available via the API.

Getting Started

Install the package:

pnpm add @iqai/mcp-kalshi

Use the server in your agent:

import { McpKalshi } from "@iqai/adk";

const toolset = McpKalshi({
  env: {
    KALSHI_API_KEY: process.env.KALSHI_API_KEY,
    KALSHI_PRIVATE_KEY_PATH: process.env.KALSHI_PRIVATE_KEY_PATH,
  },
});

const tools = await toolset.getTools();
import { McpToolset } from "@iqai/adk";

const toolset = new McpToolset({
  name: "Kalshi MCP Client",
  description: "Client for Kalshi prediction markets",
  transport: {
    mode: "stdio",
    command: "npx",
    args: ["-y", "@iqai/mcp-kalshi"],
    env: {
      KALSHI_API_KEY: process.env.KALSHI_API_KEY,
      KALSHI_PRIVATE_KEY_PATH: process.env.KALSHI_PRIVATE_KEY_PATH,
      PATH: process.env.PATH || "",
    },
  },
});

const tools = await toolset.getTools();
{
  "mcpServers": {
    "kalshi-mcp-server": {
      "command": "npx",
      "args": ["-y", "@iqai/mcp-kalshi"],
      "env": {
        "KALSHI_API_KEY": "your_kalshi_api_key",
        "KALSHI_PRIVATE_KEY_PATH": "/path/to/your/private_key.pem"
      }
    }
  }
}

Environment Variables

VariableRequiredDescription
KALSHI_API_KEYYesYour Kalshi API key ID
KALSHI_PRIVATE_KEY_PATHOne of the two key options requiredPath to your RSA private key .pem file for request signing
KALSHI_PRIVATE_KEY_PEMOne of the two key options requiredRSA private key as a PEM string (alternative to the path option)

Credentials

To get your Kalshi API credentials:

  1. Create an account at kalshi.com and complete identity verification
  2. Go to Account Settings → API
  3. Generate a new API key and note your API Key ID
  4. Generate an RSA key pair (Kalshi uses RSA-PS256 for request signing):
    openssl genrsa -out kalshi_private.pem 2048
    openssl rsa -in kalshi_private.pem -pubout -out kalshi_public.pem
  5. Upload kalshi_public.pem in your Kalshi API settings
  6. Set KALSHI_PRIVATE_KEY_PATH to the path of your kalshi_private.pem

Available Tools

GET_MARKETS
limit:numbercursor:stringeventTicker:stringseriesTicker:stringstatus:stringtickers:string

Description

List and discover prediction markets on Kalshi. Markets represent binary outcomes users can trade on. Returns paginated results with market details including ticker, title, prices, and volume.

GET_MARKET
ticker:string

Description

Get detailed information about a specific prediction market by its ticker, including current prices, volume, open interest, and settlement rules.

GET_MARKET_ORDERBOOK
ticker:stringdepth:number

Description

Get the current orderbook for a market showing bid prices and quantities for both Yes and No sides.

GET_TRADES
ticker:stringlimit:numbercursor:stringminTs:numbermaxTs:number

Description

Get recent public trades across all markets or for a specific market. Each trade shows price, quantity, and timestamp.

GET_SERIES
seriesTicker:string

Description

Get information about a series, which is a template for recurring events (e.g., monthly jobs reports, daily weather).

GET_BALANCE

No parameters

Description

Get the current account balance and portfolio value. Values are returned in dollars.

GET_POSITIONS
ticker:stringeventTicker:stringlimit:numbercursor:stringcountFilter:string

Description

Get your current portfolio positions showing market exposure, cost basis, and P&L for each position.

GET_FILLS
ticker:stringorderId:stringlimit:numbercursor:stringminTs:numbermaxTs:number

Description

Get your trade fill history. A fill occurs when your order is matched with another trader.

GET_SETTLEMENTS
ticker:stringeventTicker:stringlimit:numbercursor:stringminTs:numbermaxTs:number

Description

Get your settlement history showing resolved markets and their payouts.

GET_ORDERS
ticker:stringeventTicker:stringstatus:stringlimit:numbercursor:string

Description

Get your orders with optional filtering by market, status, or time range.

GET_ORDER
orderId:string

Description

Get detailed information about a specific order by its ID.

CREATE_ORDER
ticker:stringside:stringaction:stringcount:numbertype:stringyesPrice:numbernoPrice:numbertimeInForce:stringpostOnly:booleanreduceOnly:boolean

Description

Create a new order to buy or sell contracts in a prediction market. Use limit orders with a price, or market orders for immediate execution.

CANCEL_ORDER
orderId:string

Description

Cancel an existing open order by its ID.

BATCH_CANCEL_ORDERS
ids:array

Description

Cancel multiple orders at once (up to 20 orders per batch).

DECREASE_ORDER
orderId:stringreduceBy:number

Description

Decrease the quantity of an existing order. This is the only way to reduce order size without fully canceling.

Integration Example

import { AgentBuilder, McpKalshi } from "@iqai/adk";
import * as dotenv from "dotenv";

dotenv.config();

async function main() {
  // Initialize McpKalshi toolset
  const toolset = McpKalshi({
    env: {
      KALSHI_API_KEY: process.env.KALSHI_API_KEY,
      KALSHI_PRIVATE_KEY_PATH: process.env.KALSHI_PRIVATE_KEY_PATH,
    },
  });

  // Get available McpKalshi tools
  const kalshiTools = await toolset.getTools();

  // Create agent with McpKalshi tools
  const { runner } = await AgentBuilder.create("kalshi_agent")
    .withModel("gemini-2.5-flash")
    .withDescription(
      "A prediction market agent that monitors and trades on Kalshi",
    )
    .withTools(...kalshiTools)
    .build();

  const response = await runner.ask(
    "What are the most active prediction markets on Kalshi right now, and what are their current odds",
  );

  console.log(response);
}

main().catch(console.error);

Further Resources