IBKR MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@IBKR MCP Server check my portfolio VaR and flag any position breaching my concentration limit"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
IBKR MCP Server
A self-hosted, institutional-grade risk engine for Interactive Brokers — with a full trading, market-data, and execution stack wired behind it.
You run this against your own IB Gateway, on your own account, under your own control. Every order it can place — market, limit, bracket, OCA, trailing stop, TWAP/VWAP/DarkIce/Adaptive algos — fires through a real risk layer first: parametric and historical Value-at-Risk, Kelly and volatility-based position sizing, margin/concentration/buying-power limits, and an automatic loss circuit-breaker that halts trading when you cross a drawdown threshold. Exposing IBKR to an AI assistant is the table stakes. The risk stack is the product.
Why this vs IBKR's official MCP / the free clones
IBKR now ships a free official MCP server, and there are 10+ open-source IBKR MCP clones. They connect an LLM to your account and let it read data and route orders. That's it. None of them ship the risk layer — no VaR, no Kelly/vol sizing engine, no enforced margin/concentration limits, no automatic loss circuit-breaker. The most complete OSS clone stops at option Greeks and a concentration check.
Official IBKR MCP / OSS clones | This server | |
Connect an LLM to IBKR | ✅ | ✅ |
Market data, orders, options, futures, scanners | ✅ | ✅ |
Bracket / OCA / trailing / TWAP / VWAP / DarkIce algos | partial | ✅ |
Parametric + historical VaR | ❌ | ✅ |
Kelly / volatility position sizing | ❌ | ✅ |
Enforced margin / concentration / buying-power limits | ❌ | ✅ |
Automatic loss circuit-breaker (halts trading) | ❌ | ✅ |
Self-hosted on your own Gateway + account | — | ✅ |
If all you need is "an LLM that can see my IBKR account," use the free official one. This exists for quant prosumers and small funds who want the AI to trade inside hard risk rails they define.
Related MCP server: Interactive Brokers MCP Server
Safety model — you own the risk
This is a tool you self-host and run against your own account and your own IB Gateway. There is no hosted service in the middle touching accounts you don't own, and there is no third party taking custody of anything.
Default posture is approval-required. Out of the box, the assistant proposes orders; a human confirms before anything routes.
Fully-autonomous (no-human-click) execution is an explicit opt-in that you enable, on your account, on your Gateway. It is off until you turn it on.
The risk gates are always in the path regardless of mode — approval-required or autonomous, orders still pass through VaR, sizing, limit, and circuit-breaker checks before reaching the broker.
This is deliberately different from IBKR's liability-driven mandatory-approval design: you decide how much autonomy to grant, because you're the one holding the account and the risk.
Features
Risk Management
Value at Risk - Parametric and historical VaR
Position Sizing - Fixed risk, Kelly criterion, volatility-based
Risk Limits - Margin utilization, concentration, buying power checks
Circuit Breaker - Automatic trading halt on excessive losses
Trading
Basic Orders - Market, limit, stop orders
Bracket Orders - Entry + take profit + stop loss
Trailing Stops - By amount or percentage
OCA Orders - One-Cancels-All order groups
Algo Orders - TWAP, VWAP, Arrival Price, DarkIce, Adaptive, and more
Account & Portfolio
Account Summary - Balances, buying power, margin status
Positions - Current holdings with P&L
Portfolio Analysis - Allocation by asset class, symbol, currency
Rebalancing - Calculate and execute rebalancing trades
Market Data
Real-time Prices - Live quotes with fast failover
Historical Data - OHLCV bars with pagination
Level 2 - Order book / market depth
Streaming - Real-time data for HFT strategies
Symbol Search - Find tradable instruments
Options
Option Chains - Full chain with Greeks
Spread Analysis - Bull call, bear put, straddle, strangle, iron condor
Futures
Futures Chain - All available contracts
Rollover Detection - Automatic expiry alerts
Continuous Contracts - For historical analysis
Market Scanners
Pre-built Scans - Top gainers, losers, most active, unusual volume
Custom Scanners - Build your own with filters
Options Volume - Unusual options activity
Installation
# From source (this is a private, proprietary repo — not published to PyPI)
git clone git@github.com:YoungMoneyInvestments/ibkr-mcp.git
cd ibkr-mcp
pip install -e .Note: an unrelated
ibkr-mcppackage exists on public PyPI — it is NOT this project. Install from source only.
Prerequisites
Interactive Brokers Account - Live or paper trading account
TWS or IB Gateway - Running and accepting API connections
API Configuration in TWS/Gateway:
Enable API: Configure > API > Settings > Enable ActiveX and Socket Clients
Trusted IPs: Add 127.0.0.1
Port: 7497 (paper) or 7496 (live)
Quick Start
1. Start TWS/IB Gateway
Open TWS or IB Gateway and log in. Ensure API connections are enabled.
2. Configure Claude Desktop
Add to your Claude Desktop mcp.json:
{
"mcpServers": {
"ibkr": {
"command": "ibkr-mcp",
"args": ["--port", "7497"]
}
}
}For live trading (use with caution):
{
"mcpServers": {
"ibkr": {
"command": "ibkr-mcp",
"args": ["--port", "7496"]
}
}
}3. Use with Claude
"Show me my current positions"
"Get a quote for AAPL"
"Place a limit order to buy 100 shares of MSFT at $400"
"What's the option chain for SPY?"
"Scan for top percentage gainers today"
"Calculate position size for TSLA with $500 risk and stop at $350"CLI Usage
# Default settings (paper trading, stdio transport)
ibkr-mcp
# Connect to live trading
ibkr-mcp --port 7496
# Read-only mode (no trading)
ibkr-mcp --readonly
# SSE transport for web clients
ibkr-mcp --transport sse --mcp-port 8080
# Verbose logging
ibkr-mcp -v
# Full options
ibkr-mcp --helpEnvironment Variables
Connection Settings
Variable | Default | Description |
| - | Connection preset (see below) |
| 127.0.0.1 | TWS/Gateway host |
| 7497 | TWS/Gateway port (overridden by IBKR_MODE) |
| 1 | Starting client ID |
| true | Auto-retry with different client ID on conflict |
| 5 | Max attempts to find available client ID |
| false | Disable trading |
| 30 | Connection timeout (seconds) |
| stdio | Transport type |
Connection Mode Presets
Use IBKR_MODE to easily switch between platforms:
Mode | Port | Description |
| 7497 | TWS Paper Trading (default) |
| 7496 | TWS Live Trading |
| 4002 | IB Gateway Paper Trading |
| 4001 | IB Gateway Live Trading |
Examples:
# Connect to IB Gateway paper trading
IBKR_MODE=gateway_paper ibkr-mcp
# Connect to TWS live with custom client ID
IBKR_MODE=tws_live IBKR_CLIENT_ID=10 ibkr-mcp
# Disable client ID auto-retry
IBKR_CLIENT_ID_AUTO_RETRY=false ibkr-mcpAvailable Tools
Connection
connection_status- Check IBKR connectionreconnect- Reconnect to IBKR
Account
get_account_summary- Account balances and valuesget_positions- Current holdingsanalyze_portfolio_allocation- Portfolio breakdowncalculate_rebalancing_orders- Rebalancing planexecute_rebalancing- Execute rebalancing trades
Trading
place_order- Market/limit/stop ordersplace_bracket_order- Bracket ordersplace_trailing_stop- Trailing stop ordersplace_one_cancels_all- OCA order groupsplace_algo_order- Algorithmic orderscancel_order- Cancel an orderget_open_orders- List open orders
Market Data
get_realtime_price- Real-time quoteget_historical_data- Historical barsget_order_book- Level 2 datasearch_symbols- Symbol searchget_news- News bulletins
Options
get_option_chain- Options with Greeksanalyze_option_spread- Spread strategy analysis
Futures
get_futures_chain- Available contractsdetect_rollover_needed- Expiry alerts
Scanners
scan_market- Pre-built market scanscreate_custom_scanner- Custom scansscan_options_volume- Unusual options activity
Risk
calculate_position_size- Position sizingcheck_risk_limits- Risk statusset_stop_loss_orders- Auto stop lossescalculate_var- Value at Risk
Docker
docker build -t ibkr-mcp .
docker run -e IBKR_HOST=host.docker.internal ibkr-mcpDevelopment
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy src
# Linting
ruff check srcSafety Features
Read-only Mode - Disable all trading operations
Rate Limiting - Stay under IBKR API limits
Circuit Breaker - Automatic halt on excessive losses
Input Validation - Validate all order parameters
Error Recovery - Automatic reconnection with backoff
License
Proprietary — Copyright (c) 2026 Cameron Bennion. All Rights Reserved. See LICENSE.
Disclaimer
This software is for educational and informational purposes only. Trading involves substantial risk of loss. Past performance is not indicative of future results. Always test with paper trading first.
Available Tools
38 toolsanalyze_option_spreadC
Analyze option spread strategies (bull_call, bear_put, straddle, etc.).
Inputs: symbol (required), strike1 (required), strategy (required), expiry, +2 more. Returns: object
analyze_portfolio_allocationB
Analyze portfolio allocation by asset class, symbol, and currency.
Inputs: no named parameters. Returns: object
calculate_position_sizeC
Calculate optimal position size based on risk parameters.
Inputs: symbol (required), stop_loss (required), risk_amount (required), method, +1 more. Returns: object
calculate_rebalancing_ordersC
Calculate trades needed to rebalance portfolio to target allocations.
Inputs: target_allocations (required), use_cash, rebalance_threshold. Returns: object
calculate_slippageC
Calculate execution slippage for an order.
Inputs: order_id (required). Returns: object
calculate_varC
Calculate Value at Risk for the portfolio.
Inputs: time_horizon, confidence_level. Returns: object
cancel_orderC
Cancel an open order.
Inputs: order_id (required). Returns: object
check_risk_limitsB
Check current portfolio against risk limits.
Inputs: no named parameters. Returns: object
circuit_breaker_resetB
Reset the circuit breaker after it has been tripped.
Inputs: admin_override. Returns: object
circuit_breaker_statusB
Get circuit breaker status including trip state, daily P&L, and utilization.
Inputs: no named parameters. Returns: object
connection_statusB
Check IBKR connection status.
Inputs: no named parameters. Returns: object
create_custom_scannerC
Create custom scanner with specific criteria.
Inputs: criteria (required). Returns: object
detect_rollover_neededC
Check if futures contract rollover is needed.
Inputs: symbol (required), exchange, days_before. Returns: object
execute_rebalancingB
Execute rebalancing trades from a rebalancing plan.
Approval-required by default; re-call with confirm=True to transmit the full batch of rebalancing orders, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval. The batch is always all-preview or all-execute -- never a partial mix.
Inputs: rebalancing_plan (required), confirm, order_type, execute_sells_first. Returns: object
get_account_summaryA
Get account summary including balances, buying power, and margin.
Inputs: no named parameters. Returns: object
get_contract_by_conidC
Get contract details by contract ID.
Inputs: con_id (required). Returns: object
get_futures_chainC
Get all available futures contracts for an underlying.
Inputs: underlying (required), exchange. Returns: object
get_historical_dataC
Get historical price data with pagination.
Inputs: symbol (required), page, bar_size, duration, +3 more. Returns: object
get_newsC
Get news bulletins for a symbol.
Inputs: symbol (required), exchange, sec_type. Returns: object
get_open_ordersB
Get all open orders.
Inputs: no named parameters. Returns: object
get_option_chainC
Get option chain with Greeks for a symbol.
Inputs: symbol (required), exchange. Returns: object
get_order_bookC
Get Level 2 order book data (market depth).
Inputs: symbol (required), depth. Returns: object
get_positionsA
Get all current positions with P&L.
Inputs: no named parameters. Returns: object
get_realtime_priceC
Get real-time price for a symbol.
Inputs: symbol (required), exchange, sec_type. Returns: object
place_adaptive_orderB
Place an IB Adaptive algorithmic order.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), confirm, +3 more. Returns: object
place_algo_orderB
Place an algorithmic order using IBKR's algo strategies.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), algo_params (required), +4 more. Returns: object
place_arrival_price_orderB
Place an Arrival Price algorithmic order.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), confirm, +7 more. Returns: object
place_bracket_orderB
Place a bracket order (entry + take profit + stop loss).
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), stop_loss (required), +5 more. Returns: object
place_one_cancels_allB
Place One-Cancels-All (OCA) order group.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: orders (required), oca_group (required), confirm, oca_type. Returns: object
place_orderA
Place a trading order (market, limit, or stop).
Approval-required by default: without confirm=True (and unless IBKR_MCP_AUTONOMOUS_EXECUTION=true), this stages the order and returns a PENDING_APPROVAL preview instead of transmitting it. Re-call with confirm=True to actually submit it to IBKR.
Inputs: action (required), symbol (required), quantity (required), confirm, +5 more. Returns: object
place_trailing_stopB
Place a trailing stop order.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), confirm, +4 more. Returns: object
place_twap_orderC
Place a TWAP (Time-Weighted Average Price) algorithmic order.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), confirm, +5 more. Returns: object
place_vwap_orderB
Place a VWAP (Volume-Weighted Average Price) algorithmic order.
Approval-required by default; re-call with confirm=True to transmit, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval.
Inputs: action (required), symbol (required), quantity (required), confirm, +6 more. Returns: object
reconnectB
Reconnect to IBKR.
Inputs: no named parameters. Returns: object
scan_marketC
Run a market scanner (TOP_PERC_GAIN, MOST_ACTIVE, etc.).
Inputs: scan_code (required), location, num_rows, instrument. Returns: object
scan_options_volumeC
Scan for unusual options activity.
Inputs: min_volume, underlying, min_open_interest. Returns: object
search_symbolsC
Search for tradable instruments matching a pattern.
Inputs: pattern (required). Returns: object
set_stop_loss_ordersA
Automatically set stop loss orders for all positions.
Approval-required by default; re-call with confirm=True to transmit the full batch of trailing stops, or set IBKR_MCP_AUTONOMOUS_EXECUTION=true to skip approval. The batch is always all-preview or all-execute -- never a partial mix.
Inputs: confirm, trail_amount, trail_percent. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 38 tools
Most tools have clearly distinct resource+action purposes (data retrieval vs. order placement vs. risk analysis vs. scanning). Minor overlap exists: place_algo_order could be confused with place_twap_order/place_vwap_order/place_arrival_price_order/place_adaptive_order (all algorithmic orders), and set_stop_loss_orders overlaps conceptually with place_trailing_stop. Descriptions help disambiguate but the boundary between generic and specific algo order tools is slightly muddy.
Strong verb_noun snake_case pattern throughout (get_*, place_*, calculate_*, scan_*, analyze_*). A few deviations exist: noun-only status tools (connection_status, circuit_breaker_status) and inverted phrasing (detect_rollover_needed) break the otherwise predictable convention. Still highly readable overall.
38 tools is heavy for any single server. While the domain is broad (market data, orders, algos, risk, scanners, circuit breaker), many order-placement variants (twap, vwap, arrival_price, adaptive, generic algo) could be consolidated into a single parameterized tool, inflating the surface unnecessarily.
Coverage is very thorough: market data, option/futures chains, multiple order types, risk/VaR, rebalancing, scanners, news, order book, and circuit-breaker management are all present. Minor gaps: no explicit order-modify/replace tool, and no trade/execution history retrieval beyond slippage calculation.
Maintenance
Related MCP Connectors
Connect brokerage accounts to AI assistants: holdings, orders, asset lookup, and approved trading.
Unified financial infrastructure connecting AI agents directly to trade live/demo brokerage accounts, Web3 non-custodial wallets, real-time market data across equities, ETFs, crypto, forex, options, DeFi swaps, and prediction markets, institutional research feeds, and algorithmic strategy backtesters.
Send trade alerts from AI agents to your broker: stocks, options, futures, crypto and perps.
Deterministic pre-trade risk firewall and portfolio MCP server for AI agents (IBKR, Alpaca).
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables 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.14317 npm227MIT
- FlicenseNot gradedqualityDmaintenanceConnects AI assistants to Interactive Brokers for intelligent portfolio management, options analysis, risk monitoring, and automated trading strategy suggestions. Enables real-time account tracking, Greeks calculations, option chain analysis, and playbook-based risk adjustments through natural language.5-
- AlicenseAqualityDmaintenanceEnables 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.9MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to query and trade through Interactive Brokers using 38 tools for order placement and management with risk checks, account and position data, market and historical data, and options analytics. Includes diagnostics and configurable safety limits, designed primarily for paper trading.MIT