IBKR MCP Server

Give your AI assistant a supervised window into your Interactive Brokers account — balances, positions, live quotes and orders.

Local serverstdioJavaScriptMIT 206

What is the IBKR MCP server?

Community-built local MCP server that bridges Interactive Brokers to AI assistants: account balances, positions, real-time quotes, order placement and Flex Queries. Exposed over MCP by the ibkr mcp server, that capability becomes something an assistant can invoke while it works, not something you go and do afterwards.

What it actually does

Community-built local MCP server that bridges Interactive Brokers to AI assistants: account balances, positions, real-time quotes, order placement and Flex Queries.

Its toolset

Everything the assistant can do here goes through one of these:

  • get_account_info — Return account identity, balances and summary figures for the connected IB account
  • get_positions — List current holdings together with quantity and profit-and-loss detail
  • get_market_data — Fetch real-time market data for one or more symbols
  • place_order — Submit a market, limit or stop order. Absent from the tool list when read-only mode is enabled
  • get_order_status — Check the execution state of a previously submitted order
  • get_live_orders — Enumerate all live and open orders currently working in the account
  • get_flex_query — Execute an IB Flex Query and return the resulting statement; the query is auto-saved for later reuse
  • list_flex_queries — Show every Flex Query the server has remembered from earlier runs
  • forget_flex_query — Remove a saved Flex Query from the server's memory

Adding it to your client

Installation goes through your MCP client rather than a global install: point it at interactive-brokers-mcp on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

Configuration

You will need 8 environment variables: IB_PAPER_TRADING, IB_READ_ONLY_MODE, IB_HEADLESS_MODE, IB_USERNAME, IB_PASSWORD_AUTH, IB_FLEX_TOKEN, IB_TOTP_SECRET, IB_FORCE_STANDALONE_GATEWAY. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Node.js 18+ and an Interactive Brokers account (paper or live). The bundled IB Gateway and JRE cover mainstream platforms; Alpine-based containers download a musl JRE on first run.

When to reach for it

Among the payments and commerce options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. IBKR's toolset — get_account_info, get_positions, get_market_data and 6 more — is a fair guide to whether it matches your workflow. It is maintained by code-rabi; worth a glance at recent repository activity before you build anything load-bearing on it.

This entry was verified against IBKR's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Caveats

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 9 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch IBKR.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the ibkr mcp server does with a few real requests.

What you can do with it

Conversational portfolio review

Ask for a plain-language rundown of holdings, concentration and unrealised P&L instead of exporting a CSV and pivoting it by hand.

Statement and trade-confirmation analysis

Run a saved Flex Query and have the assistant summarise realised gains, commissions or a month of fills without you touching Account Management.

Paper-trading rehearsal

Point the server at a paper account and let an agent practise order construction and status polling where mistakes cost nothing.

Open-order monitoring

Have an assistant enumerate working orders and flag anything stale or unexpectedly unfilled during a session.

Available tools

ToolWhat it does
get_account_infoReturn account identity, balances and summary figures for the connected IB account.
get_positionsList current holdings together with quantity and profit-and-loss detail.
get_market_dataFetch real-time market data for one or more symbols.
place_orderSubmit a market, limit or stop order. Absent from the tool list when read-only mode is enabled.
get_order_statusCheck the execution state of a previously submitted order.
get_live_ordersEnumerate all live and open orders currently working in the account.
get_flex_queryExecute an IB Flex Query and return the resulting statement; the query is auto-saved for later reuse.
list_flex_queriesShow every Flex Query the server has remembered from earlier runs.
forget_flex_queryRemove a saved Flex Query from the server's memory.

How to install the IBKR MCP server

{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"],
      "env": {
        "IB_PAPER_TRADING": "true",
        "IB_READ_ONLY_MODE": "true"
      }
    }
  }
}

Configuration

Node.js 18+ and an Interactive Brokers account (paper or live). The bundled IB Gateway and JRE cover mainstream platforms; Alpine-based containers download a musl JRE on first run.

VariableDescriptionRequired
IB_PAPER_TRADINGRoute the session to your Interactive Brokers paper account instead of the live one. Set this first.e.g. trueOptional
IB_READ_ONLY_MODEDisables order placement so the server can only read account, position and market data.e.g. trueOptional
IB_HEADLESS_MODEAuthenticate with stored credentials instead of opening a browser window for the OAuth flow.e.g. trueOptional
IB_USERNAMEInteractive Brokers username, required only when headless mode is enabled.e.g. your_ib_usernameOptional
IB_PASSWORD_AUTHInteractive Brokers password used by headless authentication. Keep it out of version control.e.g. your_ib_passwordOptional
IB_FLEX_TOKENFlex Web Service token generated in IB Account Management; needed for the Flex Query tools.e.g. 123456789012345678901234Optional
IB_TOTP_SECRETTOTP seed used by the automated two-factor override strategy. Review the project's 2FA risk notes before enabling.Optional
IB_FORCE_STANDALONE_GATEWAYSkip discovery of unrelated local gateways and always use the bundled one.e.g. trueOptional

Example prompts to try

  • Summarise my current positions and tell me which three account for the most unrealised loss.
  • List every live order and flag any that have been working for more than a day.
  • Run my monthly activity Flex Query and total the commissions paid.
  • What is the current bid, ask and last price for AAPL and MSFT?

Frequently asked questions

No. It is a community project maintained under the code-rabi GitHub account and is not affiliated with, endorsed by, or supported by Interactive Brokers. The maintainer labels it alpha software. Treat support, uptime and correctness as community-grade, and read the code before you connect a funded account.