ibkr-mcp-server
MCP server for Interactive Brokers that exposes portfolio data, market quotes, trading, and analysis to any MCP-compatible AI client, with support for EU investors and safety-gated trading.
README
ibkr-mcp-server
MCP server for Interactive Brokers — expose your portfolio data, market quotes, trading, and analysis to any MCP-compatible AI client.
Built for international/EU investors. Supports UCITS/PRIIPs-aware analysis, multi-currency portfolios, and Estonian/EU tax context.
Features
12 Tools
| Tool | Type | Description |
|---|---|---|
get_positions |
read | Current positions with P&L |
get_account_summary |
read | NAV, buying power, margin |
get_nav |
read | Quick net asset value check |
get_open_orders |
read | List pending orders |
get_quote |
read | Real-time quote for any symbol |
get_historical_bars |
read | OHLCV bars (configurable period/size) |
search_contracts |
read | Find IBKR contracts by symbol/name |
portfolio_snapshot |
read | Full analysis with weights and concentration warnings |
concentration_check |
read | Flag positions exceeding a weight threshold |
transition_plan |
read | Calculate sell/buy plan for target allocation |
place_order |
write | Place a limit order (safety-gated) |
cancel_order |
write | Cancel an open order (safety-gated) |
All read tools are annotated with readOnlyHint=True. Write tools are annotated with destructiveHint=True and require SAFETY_PAPER_ONLY=false.
4 Resources
| URI | Description |
|---|---|
ibkr://positions |
Live positions list |
ibkr://account/summary |
Account summary |
ibkr://orders/open |
Open orders |
ibkr://portfolio/snapshot |
Full portfolio analysis |
4 Prompts
| Prompt | Description |
|---|---|
portfolio-review |
Analyze portfolio for risks and opportunities |
rebalance-plan |
Create a rebalance plan toward target allocation |
risk-check |
Check concentration risk and exposure |
tax-analysis |
Analyze tax implications (EU/Estonian context) |
Prerequisites
- IB Gateway running (via Docker or standalone)
- Python 3.12+ with uv
- IBKR account with API access enabled
IB Gateway via Docker
docker run -d \
--name ib-gateway \
-p 4003:4003 \
-p 5900:5900 \
-e TWS_USERID=your_username \
-e TWS_PASSWORD=your_password \
-e TRADING_MODE=live \
-e TWS_PORT=4003 \
ghcr.io/gnzsnz/ib-gateway:stable
Approve the 2FA prompt on IBKR Mobile after starting.
Install
git clone https://github.com/deividi86/ibkr-mcp-server.git
cd ibkr-mcp-server
cp .env.example .env
# Edit .env with your gateway host/port
uv sync
Configure in Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"ibkr": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ibkr-mcp-server", "ibkr-mcp"]
}
}
}
Configure in Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"ibkr": {
"command": "uv",
"args": ["run", "--directory", "/path/to/ibkr-mcp-server", "ibkr-mcp"]
}
}
}
Usage
Once configured, ask your AI client things like:
- "What are my current positions?"
- "Analyze my portfolio risk"
- "Create a rebalance plan toward 70% VWCE, 20% AGGG, 10% IBC1"
- "Get a quote for VWCE"
- "Search for Vanguard UCITS ETFs"
Safety
Trading is disabled by default. The SAFETY_PAPER_ONLY=true environment variable blocks place_order and cancel_order. All read-only tools work regardless.
To enable live trading:
SAFETY_PAPER_ONLY=false
Even with trading enabled, only limit orders are supported — no market orders.
Environment Variables
| Variable | Default | Description |
|---|---|---|
IB_GATEWAY_HOST |
127.0.0.1 |
IB Gateway host |
IB_GATEWAY_PORT |
4003 |
IB Gateway port |
IB_ACCOUNT |
(empty) | Account ID (optional, uses first managed account) |
SAFETY_PAPER_ONLY |
true |
Block trading tools when true |
Development
uv sync --dev
uv run pytest -v
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。