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.

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.

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

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.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

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.