Skip to main content

Kalshi MCP Server

An open-source Model Context Protocol (MCP) server for Kalshi’s Trade API v2. It gives MCP clients a practical interface for researching markets, reading an account, and managing orders with RSA-PSS or Ed25519 authentication.

Important: This server can place and cancel real orders. It defaults to Kalshi’s production environment; set KALSHI_ENV=demo explicitly for demo trading. Review the code, configure conservative limits, and test with demo credentials before using production credentials.

What it provides

Market research

  • Exchange status
  • Markets and events
  • Individual market data
  • Order books
  • Public trades

Account and trading

  • Balance, positions, and orders
  • Current V2 order placement
  • Batched order placement
  • Individual and bulk cancellation
  • Order amendment and quantity reduction
  • Order-group creation, limits, reset, trigger, listing, and deletion
  • Legacy order helpers retained for compatibility

The kalshi_endpoint tool also exposes the validated operations from the bundled Kalshi OpenAPI catalog. It checks the HTTP method, endpoint template, query parameters, request body, and authentication requirements before making a request.

Requirements

  • Python 3.11 or newer
  • A Kalshi API key and Ed25519 private key
  • An MCP-compatible client

Installation

From a released package or a source checkout:

python -m venv .venv
. .venv/bin/activate
python -m pip install -e .

For environments where cryptography must use prebuilt wheels:

python -m pip install --only-binary=:all: httpx cryptography mcp

Configuration

Copy the example configuration and provide credentials through your secret manager or process environment:

cp .env.example .env

Required for authenticated tools:

KALSHI_API_KEY_ID=your-api-key-id
KALSHI_PRIVATE_KEY_BASE64=base64-encoded-PEM-private-key

Environment selection is explicit. Production is the default:

# Default: production
KALSHI_ENV=production

# Explicit demo selection
KALSHI_ENV=demo

Optional settings:

  • KALSHI_BASE_URL — override the selected API base URL.
  • KALSHI_PRIVATE_KEY_BASE64 — base64-encoded PEM Ed25519 private key; this avoids requiring the MCP host to provide filesystem access.
  • KALSHI_MAX_ORDER_CONTRACTS — maximum contracts per order.
  • KALSHI_MAX_ORDER_CENTS — maximum per-order notional in cents.
  • KALSHI_DAILY_CONTRACT_LIMIT — intended daily contract ceiling.
  • KALSHI_MIN_CASH_CENTS — intended minimum cash reserve.

Never commit .env, private keys, API credentials, or request signatures.

Running the server

Run the stdio server directly:

KALSHI_ENV=production kalshi-degen-mcp

Example configuration for an MCP client that supports local stdio servers:

{
  "mcpServers": {
    "kalshi": {
      "command": "/absolute/path/to/.venv/bin/kalshi-degen-mcp",
      "env": {
        "KALSHI_ENV": "production",
        "KALSHI_API_KEY_ID": "your-api-key-id",
        "KALSHI_PRIVATE_KEY_BASE64": "base64-encoded-PEM-private-key"
      }
    }
  }
}

For Hermes, use the same executable under its local MCP server configuration.

Safety and operational guidance

  • Production is the default; select demo explicitly with KALSHI_ENV=demo.
  • Production writes are not silently redirected to demo.
  • Order tools reject invalid sides, prices, counts, and unsupported fixed-point formats.
  • Per-order contract and notional caps are configurable.
  • Start with demo credentials and small limits.
  • Confirm the selected environment and account before placing or cancelling orders.
  • Treat AI-generated trade decisions as untrusted until reviewed.

This project does not provide investment advice and does not guarantee profitable or error-free trading. You are responsible for credentials, orders, losses, and compliance with Kalshi’s terms.

Development

. .venv/bin/activate
pytest -q
python -m py_compile kalshi_mcp/*.py

The test suite covers endpoint resolution, request validation, order safety checks, batch validation, order-group validation, and strict fixed-point input rejection.

License

See the repository for licensing information.

Release files for kalshi-degen-mcp 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kalshi-degen-mcp 0.1.2
File Size Uploaded
kalshi_degen_mcp-0.1.2.tar.gz 59.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kalshi-degen-mcp 0.1.2
File Interpreter ABI Platform
kalshi_degen_mcp-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 120.5 kB

Release files / kalshi_degen_mcp-0.1.2.tar.gz

Download URL kalshi_degen_mcp-0.1.2.tar.gz
Size 59.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9259e0ab7e014074e23b0beaf1a4694511c8aca39a472d2c3560a495bc7d77d8
BLAKE2b-256 checksum
How to use checksums
826eadd6fc1fb265dedc21cf4c9cf1e4193588397193796ad59026371635330e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / kalshi_degen_mcp-0.1.2-py3-none-any.whl

Download URL kalshi_degen_mcp-0.1.2-py3-none-any.whl
Size 60.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2486767145e86d61be54c06633e23f34dfa2e6d2d6f30fe98a3907ffd2cf9a73
BLAKE2b-256 checksum
How to use checksums
32b1690c2b4c47bf0d4724a415e62f5d9f7bb13a29c782a6ce2de00347dffd6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page