Skip to main content
Glama

ibkr-mcp

A Model Context Protocol (MCP) server for Interactive Brokers. Connect any MCP-compatible AI agent to TWS or IB Gateway and get access to 80+ tools — market data, order management, account monitoring, risk analytics, news, and scanning — all through natural language.

Features

  • 80+ MCP tools across 8 categories (contracts, market data, orders, accounts, risk, news, scanners, admin)

  • Pre-trade guardrails — max qty, max notional, daily loss limit, symbol allow/deny lists, read-only mode

  • Streaming support — real-time market data, order status, account updates via MCP notifications

  • Structured envelope responses — every response wrapped in { success, data, error, meta } with request IDs, timestamps, and latency

  • Reconnection with backoff — exponential backoff + jitter, automatic subscription resumption

  • Rate limiting — token-bucket pacing at 45 req/sec (respects IB's 50 msg/sec limit)

  • Full TypeScript strict mode — noUncheckedIndexedAccess, noUnusedLocals, noPropertyAccessFromIndexSignature, and all strict flags enabled

  • ESLint with typescript-eslint strict + stylistic presets

  • esbuild bundler — single-file 780KB bundle, tree-shaken, with optional minification

  • Docker support — multi-stage build + compose with IB Gateway

Related MCP server: IBKR TWS MCP Server

Architecture

┌─────────────┐    stdio     ┌──────────────────────────────────────────────┐
│  MCP Client │◄────────────►│  ibkr-mcp                                    │
│  (AI Agent) │              │                                              │
└─────────────┘              │  app.ts ─► tools/ ─► services/ ─► ib_conn   │
                             │              │          │                     │
                             │          schemas/   middleware/               │
                             │        (zod validation) (guardrails,         │
                             │                          rate limit,         │
                             │                          error mapping)      │
                             └──────────────────────────────────────────────┘
                                                          │
                                                     TCP 4001/4002
                                                          │
                                                ┌─────────▼─────────┐
                                                │  TWS / IB Gateway │
                                                └───────────────────┘

Prerequisites

Before setting up the IBKR MCP server, ensure you have the following:

Required

  • Node.js ≥ 20 — download

  • Interactive Brokers Account — a funded or paper trading account

  • TWS (Trader Workstation) or IB Gateway — download

    • API connections must be enabled: TWS → Edit → Global Configuration → API → Settings

    • Enable "Enable ActiveX and Socket Clients"

    • Note the Socket port (default: 7497 for TWS paper, 4002 for Gateway paper)

    • Optionally add 127.0.0.1 to Trusted IPs to skip connection prompts

Optional

  • Docker & Docker Compose — for containerized deployment

  • Claude Desktop, Cursor, or any MCP-compatible client — to connect to the server

IB Gateway vs TWS

IB Gateway

TWS

Best for

Headless / server use

Interactive trading + API

Paper port

4002

7497

Live port

4001

7496

GUI

Minimal

Full trading UI

Stability

Recommended for always-on

May require interaction

Quick Start

Install & Build

git clone https://github.com/guramrit-dhillon/ibkr-mcp.git
cd ibkr-mcp
npm install
cp .env.example .env  # edit with your settings
npm run build

Setup

1. Configure IB Gateway / TWS

  1. Launch IB Gateway or TWS and log in (use paper trading to start)

  2. Enable the API:

    • TWS: Edit → Global Configuration → API → Settings

    • IB Gateway: Configure → Settings → API → Settings

  3. Check "Enable ActiveX and Socket Clients"

  4. Note the Socket port (default 4002 for Gateway paper, 7497 for TWS paper)

  5. Optionally add 127.0.0.1 to Trusted IPs to avoid connection confirmation dialogs

2. Configure the MCP Server

Copy the example environment file and edit it:

cp .env.example .env

Key settings in .env:

# Connection — match your IB Gateway/TWS settings
IB_HOST=127.0.0.1
IB_PORT=4002          # 4002=Gateway paper, 7497=TWS paper, 4001=Gateway live, 7496=TWS live
IB_CLIENT_ID=1
IB_MODE=paper         # paper | live

# Safety — start with read-only mode
IB_READ_ONLY=true     # blocks all order mutations; set to false when ready to trade

# Risk guardrails
RISK_MAX_ORDER_QTY=1000           # max shares/contracts per order
RISK_MAX_ORDER_NOTIONAL=100000    # max order value in USD
RISK_DAILY_LOSS_LIMIT=10000       # daily loss circuit breaker in USD

3. Connect from an MCP Client

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "ibkr": {
      "command": "npx",
      "args": ["ibkr-mcp"],
      "env": {
        "IB_HOST": "127.0.0.1",
        "IB_PORT": "4002",
        "IB_READ_ONLY": "true"
      }
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project or global config:

{
  "mcpServers": {
    "ibkr": {
      "command": "npx",
      "args": ["ibkr-mcp"]
    }
  }
}

Any stdio-compatible MCP client

# The server communicates over stdin/stdout using the MCP protocol
npx ibkr-mcp

4. Verify the Connection

After connecting, try these prompts to confirm everything works:

  1. "What's the connection status?" — should show connected: true

  2. "List my accounts" — should show your paper/live account(s)

  3. "What's the current price of AAPL?" — should return a market data snapshot

Example Prompts

Once connected, you can ask your AI assistant questions like:

Market Data & Research

  • "What's the current price of AAPL?"

  • "Show me historical daily bars for TSLA over the last 6 months"

  • "Get me a quote snapshot for SPY, QQQ, and IWM"

  • "What are the fundamentals for MSFT — P/E ratio, market cap, earnings?"

  • "Show me the order book depth for AMZN"

Contracts & Options

  • "Search for all contracts matching 'META'"

  • "What are the available option expirations and strikes for AAPL?"

  • "Build me an option chain for SPY expiring next month with strikes near the money"

  • "What are the trading rules for ES futures — tick size, trading hours, order types?"

Portfolio & Account

  • "What's my account summary — net liquidation, buying power, margin?"

  • "Show me all my current positions"

  • "What's my portfolio PnL today?"

  • "What are my cash balances by currency?"

  • "Show me margin requirements for 100 shares of GOOG"

Orders & Trading

  • "Place a limit order to buy 50 shares of AAPL at $180"

  • "Preview the margin impact of buying 200 shares of MSFT"

  • "Show me all my open orders"

  • "Place a bracket order: buy 100 TSLA at market with a take profit at $300 and stop loss at $250"

  • "What are my recent executions today?"

Risk & Analytics

  • "Calculate the implied volatility for the AAPL 200 call expiring in March"

  • "What are the greeks for my portfolio?"

  • "Run a stress test: what happens if SPY drops 10%?"

  • "Show me my exposure breakdown by sector"

  • "What's my portfolio Value at Risk at 95% confidence?"

  • "Simulate the impact of adding 500 shares of NVDA to my portfolio"

Scanners & News

  • "Run a scanner for the top gainers in US stocks today"

  • "Show me the most active options by volume"

  • "Get me the latest news headlines for TSLA"

Admin

  • "What's the connection status to IB Gateway?"

  • "Show me the recent error log"

  • "List all active streaming subscriptions"

Tools Reference

Contracts (8 tools)

Tool

Description

contract_search

Search contracts by symbol/name with optional filters

contract_details

Get full contract details (by conId or symbol)

contract_qualify

Qualify a contract — fully resolve and validate

contract_rules

Get trading rules (min tick, order types, trading hours)

security_definitions_option_parameters

Get option chain parameters (expirations, strikes)

option_chain

Build a filtered option chain with greeks

instrument_metadata

Get instrument metadata (industry, category, long name)

symbol_to_conid_mapping

Resolve a symbol to qualified conId(s)

Market Data (15 tools)

Tool

Description

market_data_snapshot

Get a snapshot of current market data (bid, ask, last, etc.)

market_data_bulk_snapshot

Bulk snapshots for multiple contracts

historical_data

Get historical OHLCV bars

historical_ticks

Get historical tick data

fundamental_data

Get fundamental data (financials, ratios, etc.)

market_depth_snapshot

Get current order book depth snapshot

market_data_stream_subscribe

Subscribe to streaming market data

market_data_stream_unsubscribe

Unsubscribe from streaming market data

tick_by_tick_stream_subscribe

Subscribe to tick-by-tick data

tick_by_tick_stream_unsubscribe

Unsubscribe from tick-by-tick data

market_depth_stream_subscribe

Subscribe to streaming order book

market_depth_stream_unsubscribe

Unsubscribe from streaming order book

realtime_bars_stream_subscribe

Subscribe to real-time 5-second bars

realtime_bars_stream_unsubscribe

Unsubscribe from real-time bars

list_market_data_subscriptions

List all active market data subscriptions

Orders (14 tools)

Tool

Description

order_place

Place a new order (LMT, MKT, STP, TRAIL, etc.)

order_modify

Modify an existing order

order_cancel

Cancel a specific order

orders_cancel_all

Cancel all open orders

orders_open_list

List all open orders

orders_completed_list

List completed orders

executions_list

List recent executions

order_preview

Preview order impact (margin, commission)

exercise_options

Exercise or lapse options

bracket_order

Place a bracket order (entry + take profit + stop loss)

oco_order

Place a one-cancels-other order group

order_status_stream_subscribe

Subscribe to order status updates

order_status_stream_unsubscribe

Unsubscribe from order status updates

Account (17 tools)

Tool

Description

accounts_list

List all managed accounts

account_summary

Get account summary (NLV, buying power, etc.)

account_values

Get all account values (key-value pairs)

positions_list

List all positions

portfolio_list

List portfolio with PnL

pnl_account

Get account-level PnL

pnl_position

Get position-level PnL

account_updates_subscribe

Subscribe to real-time account updates

account_updates_unsubscribe

Unsubscribe from account updates

buying_power

Get available buying power

cash_balances

Get cash balances by currency

leverage_metrics

Get leverage/margin metrics

margin_requirements

Get margin requirements for a contract

fa_groups_list

List Financial Advisor groups

fa_profiles_list

List Financial Advisor profiles

fa_aliases_list

List Financial Advisor aliases

fa_replace

Replace Financial Advisor configuration

Risk Analytics (14 tools)

Tool

Description

option_price_calculate

Calculate theoretical option price

implied_volatility_calculate

Calculate implied volatility

greeks_calculate

Calculate option greeks

portfolio_greeks

Get aggregate portfolio greeks

stress_test_portfolio

Run portfolio stress test with custom scenarios

exposure_by_symbol

Get notional exposure by symbol

exposure_by_sector

Get exposure breakdown by sector

value_at_risk

Calculate portfolio Value at Risk

beta_exposure

Calculate portfolio beta exposure

correlation_matrix

Generate correlation matrix for portfolio

simulate_trade_impact

Simulate impact of a hypothetical trade

dividends_and_splits_history

Get dividend/split history

corporate_actions_calendar

Get upcoming corporate actions

News (6 tools)

Tool

Description

news_providers_list

List available news providers

news_bulletins_subscribe

Subscribe to IB bulletins

news_bulletins_unsubscribe

Unsubscribe from IB bulletins

news_headlines

Get news headlines for a contract

news_article

Get full news article by ID

historical_news

Get historical news for a contract

Scanner (5 tools)

Tool

Description

scanner_parameters

Get available scanner parameters XML

scanner_run

Run a market scanner with custom criteria

scanner_cancel

Cancel a running scanner subscription

scanner_presets_list

List scanner presets

scanner_run_preset

Run a scanner from a preset name

Admin (7 tools)

Tool

Description

connection_status

Get connection state, uptime, error log

connection_reconnect

Force reconnection to TWS/IB Gateway

server_config

View current server configuration

error_log

Get recent IB error log

subscriptions_list

List all active subscriptions

server_time

Get server time

ping

Health check / ping

Configuration

All configuration via environment variables (see .env.example):

Variable

Default

Description

IB_HOST

127.0.0.1

TWS/Gateway host

IB_PORT

4002 (paper) / 4001 (live)

API port

IB_CLIENT_ID

1

Client ID

IB_MODE

paper

paper or live

IB_READ_ONLY

true

Block all order mutations

IB_ACCOUNT_ID

(auto)

Account ID override

RISK_MAX_ORDER_QTY

1000

Max shares/contracts per order

RISK_MAX_ORDER_NOTIONAL

100000

Max order notional ($)

RISK_DAILY_LOSS_LIMIT

10000

Daily loss limit ($)

RISK_ALLOWED_ORDER_TYPES

MKT,LMT,STP,STP_LMT,TRAIL

Allowed order types

RISK_SYMBOL_ALLOWLIST

(none)

Only allow these symbols

RISK_SYMBOL_DENYLIST

(none)

Block these symbols

RISK_ALLOW_OUTSIDE_RTH

false

Allow outside-hours orders

LOG_LEVEL

info

debug, info, warn, error

Docker

# Set credentials
cp .env.example .env
# Edit .env: TWS_USERID, TWS_PASSWORD, TRADING_MODE

# Start IB Gateway + MCP server
docker compose up -d

# Check logs
docker compose logs -f mcp

Standalone

docker build -t ibkr-mcp .
docker run --rm -i \
  -e IB_HOST=host.docker.internal \
  -e IB_PORT=4002 \
  ibkr-mcp

Development

# Run in development mode
npm run dev

# Type-check only
npm run typecheck

# Lint
npm run lint
npm run lint:fix

# Full check (typecheck + lint)
npm run check

# Run tests
npm test
npm run test:watch
npm run test:coverage

# Build (typecheck + bundle)
npm run build

# Bundle only (skip typecheck)
npm run build:bundle
npm run build:bundle:min  # minified

Project Structure

src/
├── app.ts                    # MCP server bootstrap
├── config.ts                 # Environment-driven configuration
├── connection/
│   ├── ib_connection.ts      # IB API connection manager
│   └── event_bus.ts          # Typed event pub/sub
├── middleware/
│   ├── logging.ts            # JSON structured logger
│   ├── error_mapping.ts      # Error normalization + response envelope
│   ├── rate_limit.ts         # Token-bucket rate limiter
│   └── guardrails.ts         # Pre-trade safety checks
├── schemas/
│   ├── common.ts             # Shared types (contract, error, response)
│   ├── contract_schemas.ts   # Contract tool schemas
│   ├── market_data_schemas.ts
│   ├── order_schemas.ts
│   ├── account_schemas.ts
│   ├── news_schemas.ts
│   └── scanner_schemas.ts
├── services/
│   ├── contract_service.ts   # Contract operations
│   ├── market_data_service.ts
│   ├── orders_service.ts
│   ├── account_service.ts
│   ├── risk_service.ts
│   ├── news_service.ts
│   └── scanner_service.ts
├── tools/
│   ├── index.ts              # Tool aggregation + O(1) dispatch
│   ├── contract_tools.ts     # Tool definitions + handlers
│   ├── market_data_tools.ts
│   ├── order_tools.ts
│   ├── account_tools.ts
│   ├── risk_tools.ts
│   ├── news_tools.ts
│   ├── scanner_tools.ts
│   └── admin_tools.ts
└── resources/
    ├── index.ts              # MCP resource definitions
    └── server_instructions.md
tests/
├── config.test.ts
├── error_mapping.test.ts
├── guardrails.test.ts
├── rate_limit.test.ts
├── schemas.test.ts
└── event_bus.test.ts

Response Format

Every tool returns a standardized envelope:

{
  "success": true,
  "data": { ... },
  "error": null,
  "meta": {
    "request_id": "550e8400-e29b-41d4-a716-446655440000",
    "timestamp": "2025-01-15T12:34:56.789Z",
    "latency_ms": 42
  }
}

On error:

{
  "success": false,
  "data": null,
  "error": {
    "code": "IB_CONTRACT_NOT_FOUND",
    "message": "No matching contract found",
    "details": {},
    "ib_error_code": 200,
    "retriable": false
  },
  "meta": { ... }
}

Safety

  • Read-only by default — IB_READ_ONLY=true blocks all order mutations

  • Pre-trade guardrails — quantity limits, notional limits, daily loss limits

  • Symbol filtering — allowlist/denylist enforcement

  • Order type restrictions — only configured order types allowed

  • Outside-RTH protection — disabled by default

Disclaimer

This project is not affiliated with, endorsed by, or sponsored by Interactive Brokers Group, Inc. "Interactive Brokers", "IBKR", "TWS", and "IB Gateway" are registered trademarks of Interactive Brokers Group, Inc. Use of the Interactive Brokers API is subject to their API License Agreement. This software is provided as-is with no warranty — use at your own risk, especially when placing live orders.

License

MIT

Available Tools

84 tools
accounts_listB

List all managed accounts associated with the connection.

Inputs: no named parameters.

account_summaryA

Get account summary: net liquidation, equity, cash, margin, buying power, etc. Supports filtering by tags.

Inputs: tags, group, account.

account_updates_subscribeC

Subscribe to live account updates (values and portfolio changes).

Inputs: account.

account_updates_unsubscribeC

Unsubscribe from live account updates.

Inputs: subscription_id (required).

account_valuesB

Get all key-value pairs from account: all balances, margin values, etc.

Inputs: account.

beta_exposureC

Calculate portfolio beta exposure relative to a benchmark (e.g., SPY).

Inputs: account, lookbackDays, benchmarkSymbol.

bracket_orderC

Place a bracket order: parent + take-profit + stop-loss. All three orders are linked and submitted together.

Inputs: side (required), quantity (required), stopLossPrice (required), entryOrderType (required), +11 more.

buying_powerC

Get buying power details for an account.

Inputs: account.

cash_balancesC

Get cash balance breakdown by currency.

Inputs: account.

connection_reconnectA

Force a reconnect to IB Gateway/TWS. Disconnects and reconnects the session.

Inputs: no named parameters.

connection_statusA

Check the IB Gateway/TWS connection status: connected, server version, managed accounts, error buffer, active subscriptions count.

Inputs: no named parameters.

contract_detailsA

Get full contract details including trading hours, min tick, valid exchanges, etc. Provide conId or contract specification.

Inputs: conId, symbol, secType, currency, +1 more.

contract_qualifyA

Qualify a partial contract specification to get the full conId and resolved exchange. MUST be called before using contracts in market data or order tools.

Inputs: symbol (required), secType (required), right, strike, +4 more.

contract_rulesB

Get trading rules for a contract: min tick, size increment, valid exchanges, order types.

Inputs: conId (required), exchange.

corporate_actions_calendarA

Get upcoming corporate actions (dividends, splits, earnings) for contracts. NOTE: Requires Thomson Reuters subscription.

Inputs: conIds (required).

correlation_matrixC

Compute pairwise correlation matrix for a set of symbols based on historical returns.

Inputs: symbols (required), barSize, lookbackDays.

dividends_and_splits_historyC

Get historical dividends and stock splits for a symbol.

Inputs: conId (required), symbol.

error_logB

Get the recent error log ring buffer. Returns the last N errors from the IB connection.

Inputs: count.

executions_listB

List execution reports (fills) with optional filter by symbol, side, time, etc.

Inputs: side, time, symbol, secType, +3 more.

exercise_optionsC

Exercise or lapse an option contract.

Inputs: conId (required), account (required), exerciseAction (required), exerciseQuantity (required), +1 more.

exposure_by_sectorC

Get portfolio exposure breakdown by sector/industry.

Inputs: account.

exposure_by_symbolB

Get portfolio exposure breakdown by symbol: market value, weight, delta exposure.

Inputs: account.

fa_aliases_listB

List Financial Advisor account aliases (FA accounts only).

Inputs: no named parameters.

fa_groups_listA

List Financial Advisor account groups (FA accounts only).

Inputs: no named parameters.

fa_profiles_listA

List Financial Advisor allocation profiles (FA accounts only).

Inputs: no named parameters.

fa_replaceB

Replace Financial Advisor configuration XML (groups, profiles, or aliases).

Inputs: xml (required), faDataType (required).

fundamental_dataC

Get fundamental data for a stock: financial summary, ratios, earnings, etc.

Inputs: reportType (required), conId, symbol, secType, +2 more.

greeks_calculateC

Calculate option Greeks (delta, gamma, theta, vega) for one or more contracts.

Inputs: conId (required), symbol, secType, currency, +1 more.

historical_dataC

Get OHLCV historical bars. Supports durations like "1 D", "1 W", "1 M", "1 Y". Bar sizes: "1 min", "5 mins", "1 hour", "1 day", etc.

Inputs: durationStr (required), barSizeSetting (required), conId, symbol, +6 more.

historical_newsC

Get historical news headlines for a contract.

Inputs: conId (required), providerCodes (required), endDateTime, totalResults, +1 more.

historical_ticksC

Get individual tick data (time & sales). Returns up to 1000 ticks for a given time range.

Inputs: conId, symbol, useRTH, secType, +6 more.

implied_volatility_calculateC

Calculate implied volatility from option price using IB API.

Inputs: conId (required), underPrice (required), optionPrice (required), symbol, +3 more.

instrument_metadataB

Get metadata for an instrument: symbol, primary exchange, industry, category, subcategory.

Inputs: conId (required).

leverage_metricsB

Get leverage and margin utilization metrics: gross/net leverage, margin used vs available, cushion.

Inputs: account.

list_market_data_subscriptionsA

List all active market data streaming subscriptions.

Inputs: no named parameters.

margin_requirementsA

Get margin requirements for a hypothetical trade (uses order what-if).

Inputs: side (required), contract (required), quantity (required).

market_data_bulk_snapshotB

Get snapshots for multiple contracts simultaneously. Uses frozen snapshot (type 3). Returns array of results.

Inputs: contracts (required), fields.

market_data_snapshotB

Get a point-in-time snapshot of market data for one contract: bid/ask/last/volume/OHLC etc. Resolves when data arrives or times out.

Inputs: conId, fields, symbol, secType, +3 more.

market_data_stream_subscribeC

Subscribe to a live streaming market data feed (ticks) for a contract. Events are delivered via MCP resources.

Inputs: conId, symbol, secType, currency, +2 more.

market_data_stream_unsubscribeC

Unsubscribe from a market data stream by subscription_id.

Inputs: subscription_id (required).

market_depth_snapshotC

Get an order book snapshot (Level 2 data). Returns the current market depth rows.

Inputs: conId, symbol, numRows, secType, +2 more.

market_depth_stream_subscribeC

Subscribe to streaming market depth (Level 2) updates.

Inputs: conId, symbol, numRows, secType, +2 more.

market_depth_stream_unsubscribeC

Unsubscribe from market depth stream.

Inputs: subscription_id (required).

news_articleA

Get the full text of a news article by providerCode and articleId.

Inputs: articleId (required), providerCode (required).

news_bulletins_subscribeC

Subscribe to IB system news bulletins (exchange messages, system status, etc.).

Inputs: allMsgs.

news_bulletins_unsubscribeB

Unsubscribe from IB news bulletins.

Inputs: no named parameters.

news_headlinesC

Get recent news headlines, optionally filtered by provider codes and contract ID.

Inputs: conId, endDateTime, totalResults, providerCodes, +1 more.

news_providers_listA

List available news providers with their codes.

Inputs: no named parameters.

oco_orderC

Place a One-Cancels-Other (OCO) order group. When one order fills, the other is cancelled.

Inputs: side (required), ocaGroup (required), quantity (required), order1Type (required), +10 more.

option_chainB

Get the full option chain for an underlying: expirations, strikes, rights (C/P), multipliers.

Inputs: currency, exchange, underlyingConId, underlyingSymbol.

option_price_calculateC

Calculate theoretical option price using Black-Scholes model via IB API.

Inputs: conId (required), underPrice (required), volatility (required), symbol, +3 more.

order_cancelB

Cancel an open order by orderId.

Inputs: orderId (required), manualOrderCancelTime.

order_modifyB

Modify an existing open order. Requires the same fields as order_place plus the orderId to modify.

Inputs: side (required), orderId (required), quantity (required), orderType (required), +10 more.

order_placeB

Place a new order. Requires: side, quantity, order type, and a qualified contract. Enforces all guardrails (read-only check, max qty, max notional, allowed order types, symbol allowlist/denylist).

Inputs: side (required), quantity (required), orderType (required), tif, +19 more.

order_previewB

Preview/what-if an order: see estimated commission, margin impact, equity with loan before actually sending.

Inputs: side (required), quantity (required), orderType (required), tif, +7 more.

orders_cancel_allA

Cancel ALL open orders via global cancel. Use with extreme caution.

Inputs: no named parameters.

orders_completed_listA

List completed (filled, cancelled) orders.

Inputs: no named parameters.

orders_open_listC

List all open/pending orders with their current status.

Inputs: account.

order_status_stream_subscribeA

Subscribe to live order status updates. Events are delivered via MCP notifications.

Inputs: no named parameters.

order_status_stream_unsubscribeB

Unsubscribe from order status updates.

Inputs: subscription_id (required).

pingA

Simple health check — returns "pong" with uptime and connection status.

Inputs: no named parameters.

pnl_accountC

Get real-time account PnL: daily, unrealized, realized PnL.

Inputs: account, modelCode.

pnl_positionB

Get real-time PnL for a specific position by conId.

Inputs: conId (required), account, modelCode.

portfolio_greeksA

Aggregate Greeks for all option positions in the portfolio. Returns portfolio-level delta, gamma, theta, vega.

Inputs: account.

portfolio_listB

Get portfolio positions with market value, unrealized/realized PnL from the account model.

Inputs: account.

positions_listA

List all open positions across all accounts, with conId, size, avgCost, unrealized PnL.

Inputs: account.

realtime_bars_stream_subscribeC

Subscribe to 5-second realtime bars.

Inputs: conId, symbol, useRTH, secType, +3 more.

realtime_bars_stream_unsubscribeC

Unsubscribe from realtime bars stream.

Inputs: subscription_id (required).

scanner_cancelB

Cancel a running scanner subscription by reqId.

Inputs: reqId (required).

scanner_parametersA

Get available scanner parameters: scan types, instruments, location codes, filter types. Returns XML — parse for valid values.

Inputs: no named parameters.

scanner_presets_listB

List all available scanner presets with their configurations.

Inputs: no named parameters.

scanner_runB

Run a market scanner with custom parameters. Returns matching instruments.

Inputs: scanCode (required), instrument (required), locationCode (required), abovePrice, +7 more.

scanner_run_presetC

Run a pre-configured scanner preset by name: top_gainers, top_losers, most_active, high_iv, unusual_volume, breakout_candidates, gap_up, gap_down.

Inputs: presetName (required), numberOfRows.

security_definitions_option_parametersB

Get available option expirations, strikes, and trading classes for an underlying.

Inputs: underlyingConId (required), exchange, underlyingSymbol, underlyingSecType.

server_configA

Get the current server configuration (sanitized — no secrets). Shows mode, risk limits, cache TTL, reconnect settings.

Inputs: no named parameters.

server_timeA

Request current server time from IB Gateway. Useful for health checks and clock sync verification.

Inputs: no named parameters.

simulate_trade_impactC

Simulate the impact of a hypothetical trade on portfolio risk metrics (margin, Greeks, VaR).

Inputs: side (required), conId (required), quantity (required), symbol, +5 more.

stress_test_portfolioB

Stress test the current portfolio under hypothetical market scenarios: price moves, vol changes, time decay.

Inputs: scenarios (required), account.

subscriptions_listB

List all active streaming subscriptions (market data, ticks, depth, bars, order status).

Inputs: no named parameters.

symbol_to_conid_mappingB

Resolve a symbol to its conId. Results are cached.

Inputs: symbol (required), secType, exchange.

tick_by_tick_stream_subscribeC

Subscribe to tick-by-tick data (Last, AllLast, BidAsk, MidPoint) for highest resolution.

Inputs: tickType (required), conId, symbol, secType, +4 more.

tick_by_tick_stream_unsubscribeB

Unsubscribe from tick-by-tick data stream.

Inputs: subscription_id (required).

value_at_riskB

Calculate portfolio Value-at-Risk (VaR) using parametric method. Returns 1-day and N-day VaR at given confidence.

Inputs: account, lookbackDays, confidenceLevel, holdingPeriodDays.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.7/5.0

    Scored across 84 tools

    Disambiguation2/5

    The set contains many overlapping tools: subscriptions_list vs list_market_data_subscriptions, positions_list vs portfolio_list, account_summary/account_values/buying_power/cash_balances, and multiple contract resolution paths (contract_search, contract_details, contract_qualify, symbol_to_conid_mapping). An agent can often choose a plausible but non-canonical tool, especially across market data, news, and account queries.

    Naming Consistency3/5

    Mostly snake_case, but verb/noun order and prefixing vary: list_market_data_subscriptions (verb_noun) alongside subscriptions_list (noun_list), contract_search (noun_verb), contract_details (noun), news_article (noun), and fa_groups_list (prefix_entity_list). The subscribe/unsubscribe pairs are consistent, but the overall convention is mixed.

    Tool Count1/5

    84 tools is far beyond a well-scoped set; many are granular variants such as snapshot vs bulk snapshot, multiple stream subscribe/unsubscribe pairs, and several account summary views. This creates a large surface area with overlapping choices and raises selection cost.

    Completeness4/5

    Covers the core IBKR lifecycle broadly: contract discovery, market data, historical data, orders and bracket/OCO, positions/account, risk analytics, scanners, news, and FA admin. Some gaps exist (e.g., alerts, richer order-history filtering, and some specialty data), but major workflows are represented.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants to interact with Interactive Brokers trading accounts to retrieve market data, check positions, and place trades. Includes pre-configured IB Gateway and handles OAuth authentication automatically.
      14
      317 npm
      227
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with Interactive Brokers through 48 tools for market data, orders, account management, and more, via the MCP protocol.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to trade on Interactive Brokers: check quotes, balance, positions, and execute buy/sell orders (including fractional shares by dollar amount) via the Client Portal API.
      20
      15
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables LLM agents to interact with Interactive Brokers accounts for market data, account info, and order entry with built-in risk controls and a two-step confirmation flow.
      9
      MIT