MCP server wrapping ib_async for Interactive Brokers API
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ib_async_mcp-0.1.1.tar.gz.
File metadata
- Download URL: ib_async_mcp-0.1.1.tar.gz
- Upload date:
- Size: 65.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
525125e0e219eb50182d530e9b175a0e6ed2acfa580a1c7a2a0af549a3b49a14
|
|
| MD5 |
aa77e4e25bbf7b3bc8a427578097e94c
|
|
| BLAKE2b-256 |
edeb318a225bed3f23f6bfb644f15935b7b41dfa875aaa72c858011b8be12982
|
Provenance
The following attestation bundles were made for ib_async_mcp-0.1.1.tar.gz:
Publisher:
publish.yml on atomcp-ai/ib-async-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ib_async_mcp-0.1.1.tar.gz -
Subject digest:
525125e0e219eb50182d530e9b175a0e6ed2acfa580a1c7a2a0af549a3b49a14 - Sigstore transparency entry: 779617212
- Sigstore integration time:
-
Permalink:
atomcp-ai/ib-async-mcp@90b6f36bb1eaf3e553ff85468b86f5c5f24610e5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/atomcp-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90b6f36bb1eaf3e553ff85468b86f5c5f24610e5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ib_async_mcp-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ib_async_mcp-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7b36ad4977b3c488f17bf7801ef16450e4fe59434ae72192e105c179129055f
|
|
| MD5 |
6064f191058bcfcdaf4a24221b70c391
|
|
| BLAKE2b-256 |
a2ef0855d3ab481f1e5cd6b84d6015f326514df72e725c595f64195009592fba
|
Provenance
The following attestation bundles were made for ib_async_mcp-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on atomcp-ai/ib-async-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ib_async_mcp-0.1.1-py3-none-any.whl -
Subject digest:
d7b36ad4977b3c488f17bf7801ef16450e4fe59434ae72192e105c179129055f - Sigstore transparency entry: 779617213
- Sigstore integration time:
-
Permalink:
atomcp-ai/ib-async-mcp@90b6f36bb1eaf3e553ff85468b86f5c5f24610e5 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/atomcp-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@90b6f36bb1eaf3e553ff85468b86f5c5f24610e5 -
Trigger Event:
release
-
Statement type: