ibkr-mcp-server
Click on "Install 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-servershow my current positions"
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
MCP server that exposes Interactive Brokers via the TWS API as 14 tools: account reads, market data, contract resolution, and order placement.
Paper-by-default. Live trading requires explicit opt-in via IBKR_TRADING_MODE=live.
Prerequisites
TWS or IB Gateway running locally. Download from IBKR.
API enabled in TWS/Gateway: Configure → API → Settings
Check "Enable ActiveX and Socket Clients"
Uncheck "Read-Only API"
Socket port:
7497(paper) or7496(live) — defaults match this serverAdd
127.0.0.1to "Trusted IPs"
uv installed:
curl -LsSf https://astral.sh/uv/install.sh | sh
Related MCP server: IBKR TWS MCP Server
Install
git clone <this repo>
cd ibkr-mcp-server
uv syncConfigure
Copy .env.example and adjust as needed (or export the vars in your shell / MCP client config).
Register with Claude Code
Add to ~/.claude.json (or a per-project .mcp.json):
{
"mcpServers": {
"ibkr": {
"command": "uv",
"args": [
"--directory", "/absolute/path/to/ibkr-mcp-server",
"run", "ibkr-mcp-server"
],
"env": {
"IBKR_TRADING_MODE": "paper",
"IBKR_CLIENT_ID": "17"
}
}
}
}Tools
Tool | Purpose |
| Connection + mode + gateway info |
| Cash, net liq, buying power, margin |
| Open positions with market price enrichment |
| Account-level or per-position P&L |
| Today's fills (or since ISO timestamp) |
| IBKR symbol search |
| Resolve symbol → canonical contract with conid |
| Snapshot bid/ask/last/volume |
| OHLCV bars |
| Place MKT/LMT/STP/STP_LMT order |
| Entry + take-profit + stop-loss |
| Modify an existing open order |
| Cancel an open order |
| List currently open orders |
Safety
Mode gate: server reads
managedAccountson connect and verifies prefixes (DU*= paper,U*= live). On mismatch, all order tools are blocked.Audit log: every order placement / modification / cancellation is appended as a JSON line to
$IBKR_AUDIT_LOG(default~/.ibkr-mcp-server/audit.log).Read-only mode: set
IBKR_READONLY=1to disable all order tools.
Risk rails (v2)
Three additional rails apply to place_order, place_bracket_order, and modify_order. cancel_order and list_open_orders are intentionally not gated.
Notional caps. Per-order and daily-cumulative ceilings in USD. Mode-aware: paper and live have independent envs. Set to
unlimitedto disable an individual cap.Rate limit. Each gated tool has its own token bucket (capacity 10, refill 10/min). Hardcoded in v2.
Kill switch. If
IBKR_HALT_FILEexists, every gated tool returns{status:"rejected", error_code:"HALT", ...}immediately. Remove the file to re-enable.
Blocks are returned as data (same shape as IB-side rejections) and appended to the audit log. They do not raise.
get_quote now returns a data_type field: "live" | "delayed" | "delayed_frozen" | "frozen". The server calls ib.reqMarketDataType(3) on connect so weekend/out-of-hours quotes fall back to delayed data instead of returning nulls.
Env var | Default | Purpose |
|
| Per-order notional cap in paper (USD); |
|
| Per-order notional cap in live (USD); |
|
| Daily cumulative cap in paper; |
|
| Daily cumulative cap in live; |
|
| Path probed on every order; presence halts all order-mutating tools |
Testing
uv run pytest # unit tests (default)
IBKR_INTEGRATION_TESTS=1 uv run pytest -m integration # against a running paper gateway
uv run python scripts/smoke.py # manual end-to-end smokeMaintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityAmaintenanceEnables 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.14518212MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLM clients to interact with Interactive Brokers Trader Workstation for automated trading workflows. Supports market data retrieval, portfolio management, and order execution through the TWS API.5
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Interactive Brokers via the TWS API or IB Gateway to manage accounts, retrieve market data, and execute trades. It supports features like real-time market data, historical data queries, and order management for stocks and options.4
- AlicenseAqualityAmaintenanceEnables 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.2012MIT
Related MCP Connectors
MCP server for OpenMM — exposes market data, account, trading, and strategy tools to AI agents
Hosted MCP for stocks, options, Greeks, brokers, order previews, alerts, and workflows.
Connect any MCP client to MetaTrader 4/5 to read prices, manage positions, and place trades.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/selvakumarEsra/ibkr-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server