Skip to main content
Glama
TopStepX MCP

TopStepX MCP

TopStepX MCP

AI-assisted TopStepX futures trading — connect Claude Code to your TopStepX account for demo and live order management, real-time streaming, and strategy automation.

Personal use only. Read the disclaimer and TopStepX's Terms of Use before using this tool with a live account.

What It Does

Gives your AI assistant full access to your TopStepX account:

  • Order management — place market/limit/stop/trailing orders with optional bracket SL/TP in one call

  • Position management — view, close, and partially close positions

  • Market data — fetch historical OHLCV bars (up to 20,000 per request)

  • Contract search — find futures contracts by symbol (NQ, ES, CL, GC, RTY, etc.)

  • Real-time streaming — live quotes, order fills, position changes, and DOM via SignalR

  • Trade history — P&L analysis and execution review

  • Demo + Live — works on both simulated (combine) and funded accounts

Related MCP server: NexusTrader MCP

Quick Start

1. Get API Access

Subscribe to the TopStepX API at dashboard.projectx.com. You'll need:

  • Your TopStepX username (email)

  • An API key from the dashboard

2. Install

git clone https://github.com/tradesdontlie/topstepx-mcp.git
cd topstepx-mcp
npm install
npm run build

3. Add to Claude Code

Add to your ~/.claude/.mcp.json or project .mcp.json:

{
  "mcpServers": {
    "topstepx": {
      "command": "node",
      "args": ["/path/to/topstepx-mcp/dist/server.js"],
      "env": {
        "TSX_USERNAME": "your@email.com",
        "TSX_API_KEY": "your-api-key"
      }
    }
  }
}

Replace /path/to/topstepx-mcp with your actual path.

4. Verify

Ask Claude: "Use tsx_health_check to verify TopStepX is connected"

How Claude Knows Which Tool to Use

Claude reads CLAUDE.md automatically when working in this project. It contains a decision tree:

You say...

Claude uses...

"What accounts do I have?"

tsx_get_accounts

"Buy 1 MNQ at market"

tsx_place_order type=market

"Buy limit 21500 with 10-tick SL"

tsx_place_order with bracket orders

"What orders are working?"

tsx_get_open_orders

"Flatten my NQ"

tsx_close_position

"Get 5-min NQ bars for last week"

tsx_get_bars unit=minute unitNumber=5

"Stream live quotes for ES"

connect → subscribe → read events

"Show my P&L today"

tsx_get_trades with today's timestamps

Tool Reference (35 tools)

Auth

Tool

Description

tsx_authenticate

Login with username + API key, get JWT token

tsx_validate_session

Check if current token is valid

Accounts

Tool

Description

tsx_get_accounts

List all accounts (demo + live)

tsx_get_account_status

Balance, open positions, open orders summary

Contracts & Market Data

Tool

Description

tsx_search_contracts

Search by symbol (NQ, ES, CL...)

tsx_get_contract

Lookup by contract ID

tsx_list_contracts

List all available contracts

tsx_get_bars

Historical OHLCV bars (max 20,000)

Orders

Tool

Description

tsx_place_order

Place market/limit/stop + optional bracket SL/TP

tsx_cancel_order

Cancel an open order

tsx_modify_order

Change price, size, or stop

tsx_get_open_orders

All currently working orders

tsx_get_order_history

Historical orders by date range

Positions

Tool

Description

tsx_get_positions

All open positions

tsx_close_position

Flatten entire position (market)

tsx_partial_close_position

Reduce position by N contracts

Trades

Tool

Description

tsx_get_trades

Execution history with P&L and fees

Real-Time Streaming

Tool

Description

tsx_stream_connect

Connect SignalR user + market hubs

tsx_stream_subscribe_account

Subscribe to orders/positions/trades

tsx_stream_subscribe_quotes

Subscribe to live quotes

tsx_stream_subscribe_dom

Subscribe to Level 2 book

tsx_stream_unsubscribe

Unsubscribe contract or account

tsx_stream_read_events

Drain buffered events (with filter)

tsx_stream_status

Hub connection status

tsx_stream_disconnect

Close all connections

Info

Tool

Description

tsx_health_check

API + stream connectivity check

tsx_order_types_reference

Enum reference for order types, sides, etc.

Architecture

Claude Code  ←→  MCP Server (stdio)  ←→  REST (port 443)  ←→  api.topstepx.com
                                     ←→  SignalR/WS       ←→  rtc.topstepx.com
  • Transport: MCP over stdio

  • Auth: JWT via POST /api/Auth/loginKey (24h tokens, auto-refresh)

  • REST: All POST with JSON bodies

  • Streaming: @microsoft/signalr with WebSocket-only transport, skipNegotiation, auto-reconnect

Requirements

  • Node.js 18+

  • TopStepX API subscription (from dashboard.projectx.com)

  • Claude Code with MCP support

Environment Variables

TSX_USERNAME=your@email.com        # Required
TSX_API_KEY=your-api-key           # Required

# Optional (defaults to TopStepX endpoints)
TSX_API_URL=https://api.topstepx.com/api
TSX_USER_HUB_URL=https://rtc.topstepx.com/hubs/user
TSX_MARKET_HUB_URL=https://rtc.topstepx.com/hubs/market

Disclaimer

This project is provided for personal, educational, and research purposes only.

This tool is not affiliated with, endorsed by, or associated with Topstep LLC, ProjectX Trading LLC, or any affiliated entities.

By using this software, you acknowledge and agree that:

  1. You are solely responsible for ensuring your use of this tool complies with TopStepX's Terms of Use and all applicable laws.

  2. Running on VPS, cloud servers, or remote access tools is strictly prohibited by TopStepX ToS. This MCP server must run on your local machine only.

  3. You assume all risk associated with using this tool. The authors are not responsible for order errors, account violations, trade losses, or any other consequences.

  4. Orders placed via API cannot be reversed by TopStepX support.

  5. Always test on demo/simulated accounts before using with a funded account.

  6. This tool accesses the official TopStepX/ProjectX Gateway API — but your use must comply with their ToS.

Use at your own risk.

License

MIT — see LICENSE for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to trade on MetaTrader 5 using natural language, supporting account management, order placement, and real-time market data.
      1
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Exposes NexusTrader's account, positions, market data, and trading capabilities to AI assistants via natural language.
      19
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects a brokerage account to AI assistants, enabling portfolio queries, order management, and market data access through natural language.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Connects AI assistants to 16 crypto exchanges and MetaTrader 5 over a single MCP endpoint, enabling trading and account management with server-side risk controls, paper trading by default, and auditable signed receipts.
      4
      CC BY-4.0