Interactive Brokers MCP Server
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.
README
Interactive Brokers MCP Server
<div align="center"> <img src="https://www.interactivebrokers.com/images/web/logos/ib-logo-text-black.svg" alt="Interactive Brokers" width="300"> </div>
⚠️ DISCLAIMER: This is an unofficial, community-developed MCP server and is NOT affiliated with or endorsed by Interactive Brokers. This software is in Alpha state and may not work perfectly.
A Model Context Protocol (MCP) server that provides integration with Interactive Brokers' trading platform. This server allows AI assistants to interact with your IB account to retrieve market data, check positions, and place trades.
🔒 Security Notice
This MCP server is designed to run locally only for security reasons. Never deploy this to remote servers or cloud platforms as it handles sensitive trading credentials and financial data.
✨ Features
- Account Management: Get account information and balances
- Position Tracking: View current positions and P&L
- Market Data: Real-time market data for stocks and instruments
- Order Management: Place market, limit, and stop orders
- Order Monitoring: Check order status and execution details
Prerequisites
No additional installations required! This package includes:
- Pre-configured IB Gateway for all platforms (Linux, macOS, Windows)
- Java Runtime Environment (JRE) for IB Gateway
- All necessary dependencies
You only need:
- Interactive Brokers account (paper or live trading)
- Node.js 18+ (for running the MCP server)
Quick Start
Add this MCP server to your Cursor/Claude configuration:
{
"mcpServers": {
"interactive-brokers": {
"command": "npx",
"args": ["-y", "interactive-brokers-mcp"]
}
}
}
When you first use the server, a web browser window will automatically open for the Interactive Brokers OAuth authentication flow. Log in with your IB credentials to authorize the connection.
Headless Mode Configuration
For automated environments or when you prefer not to use a browser for authentication, you can enable headless mode by configuring it in your MCP server configuration:
{
"mcpServers": {
"interactive-brokers": {
"command": "npx",
"args": ["-y", "interactive-brokers-mcp"],
"env": {
"IB_HEADLESS_MODE": "true",
"IB_USERNAME": "your_ib_username",
"IB_PASSWORD_AUTH": "your_ib_password"
}
}
}
}
In headless mode, the server will automatically authenticate using your credentials without opening a browser window. This is useful for:
- Automated trading systems
- Server environments without a display
- CI/CD pipelines
- Situations where browser interaction is not desired
Important: Even in headless mode, Interactive Brokers may still require two-factor authentication (2FA). When 2FA is triggered, the headless authentication will wait for you to complete the 2FA process through your configured method (mobile app, SMS, etc.) before proceeding.
Security Note: Store credentials securely and never commit them to version control. Consider using environment variable files or secure credential management systems.
Available MCP Tools
| Tool | Description |
|---|---|
get_account_info |
Retrieve account information and balances |
get_positions |
Get current positions and P&L |
get_market_data |
Real-time market data for symbols |
place_order |
Place market, limit, or stop orders |
get_order_status |
Check order execution status |
Troubleshooting
Authentication Problems:
- Use the web interface that opens automatically
- Complete any required two-factor authentication
- Try paper trading mode if live trading fails
Security & Risk Disclaimer
⚠️ IMPORTANT WARNINGS:
- Financial Risk: Trading involves substantial risk of loss. Always test with paper trading first.
- Security: This software handles sensitive financial data. Only run locally, never on public servers.
- No Warranty: This unofficial software comes with no warranties. Use at your own risk.
- Not Financial Advice: This tool is for automation only, not financial advice.
Support
- IB Gateway Issues: Interactive Brokers API Documentation
- MCP Protocol: Model Context Protocol Documentation
- This Server: Open an issue in this repository
License
MIT License - see LICENSE file for details.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。