ib-async-mcp
An MCP server that provides an interface for the Interactive Brokers API via the ib_async library. It enables users to manage accounts, access real-time and historical market data, and execute or monitor trades through TWS or IB Gateway.
README
ib-async-mcp
MCP (Model Context Protocol) server wrapping ib_async for Interactive Brokers API.
Features
- Connection Management: Connect/disconnect to TWS or IB Gateway
- Account Data: Account values, summary, portfolio, positions, P&L
- Contracts: Create and qualify contracts (stocks, options, futures, forex, crypto, etc.)
- Market Data: Real-time quotes and historical data
- Orders: Place, modify, cancel orders (market, limit, stop, stop-limit)
- Options: Option chains, implied volatility, option pricing
- Scanners: Market scanners with various criteria
- News: News providers and articles
Prerequisites
- Python 3.10+
- Interactive Brokers TWS or IB Gateway running with API enabled
- API port configured (default: 7497 for TWS, 4001 for Gateway)
Installation
cd ib-async-mcp
uv sync
Usage
Running the Server
uv run ib-async-mcp
MCP Configuration
Add to your MCP client configuration (e.g., .kiro/settings/mcp.json):
{
"mcpServers": {
"ib-async": {
"command": "uv",
"args": ["--directory", "/path/to/ib-async-mcp", "run", "ib-async-mcp"],
"env": {}
}
}
}
Or using uvx (after publishing):
{
"mcpServers": {
"ib-async": {
"command": "uvx",
"args": ["ib-async-mcp"],
"env": {}
}
}
}
Available Tools
Connection
connect- Connect to TWS/Gatewaydisconnect- Disconnectis_connected- Check connection status
Account
get_accounts- List managed accountsget_account_values- Account values (balance, margin, etc.)get_account_summary- Account summaryget_portfolio- Portfolio with market valuesget_positions- All positionsget_pnl- Profit and loss
Contracts
create_contract- Create a contractqualify_contracts- Qualify contracts (fill conId)get_contract_details- Detailed contract infosearch_symbols- Search for symbols
Market Data
get_market_data- Real-time snapshotget_historical_data- Historical barsget_head_timestamp- Earliest available data
Orders
place_order- Place new ordercancel_order- Cancel ordercancel_all_orders- Cancel all ordersget_open_orders- List open ordersget_open_trades- List open tradesget_executions- Execution reportsget_fills- Order fillswhat_if_order- Check margin impact
Options
get_option_chain- Option chaincalculate_implied_volatility- Calculate IVcalculate_option_price- Calculate option price
Scanners
get_scanner_parameters- Available scanner paramsrun_scanner- Run market scanner
News
get_news_providers- List news providersget_news_article- Get articleget_historical_news- Historical headlines
Utility
get_current_time- TWS server time
Example Usage
# Connect first
connect(host="127.0.0.1", port=7497, client_id=1)
# Get account info
get_accounts()
get_portfolio()
# Get market data
get_market_data(contract_type="stock", symbol="AAPL")
# Get historical data
get_historical_data(
contract_type="stock",
symbol="SPY",
duration="5 D",
bar_size="1 hour"
)
# Place an order
place_order(
contract_type="stock",
symbol="AAPL",
action="BUY",
quantity=100,
order_type="limit",
limit_price=150.00
)
License
MIT
Disclaimer
This software is not affiliated with Interactive Brokers Group, Inc. Use at your own risk.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.