mm-ibkr-mcp
Enables human-in-the-loop approval for trade orders and trade intents via Telegram bot and chat messages.
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., "@mm-ibkr-mcpPreview an order to buy 100 shares of AAPL"
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.
mm-ibkr-mcp
⚠️ LIVE CAPITAL AT RISK — USE AT YOUR OWN RISK
This project connects to Interactive Brokers and can place real, irreversible trades with real money. It is a proof-of-concept research implementation for agent-driven trading workflows. It is not financial advice, not a licensed trading system, and not production-ready.
Agent systems can and do make errors: misnamed parameters, hallucinated calculations, incorrect order quantities, and wrong order sides have all been observed in testing. The human-in-the-loop Telegram approval gate exists precisely because automated execution without oversight is dangerous.
You are solely responsible for any losses incurred through use of this software. If you do not understand the risks, do not use this project.
mm-ibkr-mcp is the canonical Interactive Brokers MCP repo for agent-driven account monitoring and trade execution.
It assumes the user already has IB Gateway or TWS running locally. This repo does not manage the broker process. Its job is to connect, inspect account state, preview orders, place trades, persist execution state, and gate submissions through Telegram when required.
The older mm-ibkr-gateway repo remains public for now and will later narrow into gateway deployment and maintenance tooling. This repo is the canonical monitoring and trading MCP surface.
Scope
Included:
account health, balances, P&L, positions, open orders
market data, contract resolution, options chain and snapshot tools
single-order preview and placement
durable basket execution through persisted trade intents
SQLite-backed audit, approvals, trade intents, execution state, and position snapshots
Telegram approval flow for single orders and baskets
compare-and-swap admin control over
control.json
Not included as part of the canonical workflow:
starting or stopping IB Gateway
web UI or REST admin as a first-class interface
schedulers, signal ingestion, or separate OMS daemons
Related MCP server: ib-async-mcp
Safety model
Two layers control execution:
control.jsonorders_enableddry_runblock_reason
MCP_ORDER_APPROVAL_MODEtelegram: order submission requires Telegram approvalyolo: no approval gate
Safe defaults are:
orders_enabled=falsedry_run=trueMCP_ORDER_APPROVAL_MODE=telegram
Configuration
On first start, uv run ibkr-mcp creates safe defaults for:
data/ibkr-mcp/config.jsondata/ibkr-mcp/control.json
Edit config.json to match your local IB Gateway or TWS connection:
{
"ibkr_host": "127.0.0.1",
"ibkr_port": 4002,
"ibkr_client_id": 1,
"default_account_id": null
}.env is optional. Copy .env.example to .env only if you want Telegram approval or explicit yolo mode:
MCP_ORDER_APPROVAL_MODE=telegramIf using Telegram approval mode, also set:
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...For monitoring only, you can leave .env empty and use the default approval posture.
Advanced-only environment overrides:
MM_IBKR_DATA_DIR=/path/to/data
MM_IBKR_CONFIG_PATH=/path/to/config.json
MM_IBKR_CONTROL_DIR=/path/to/control-dir
MCP_TRANSPORT=streamable-http
MCP_HOST=127.0.0.1
MCP_PORT=8001
MCP_AUTH_TOKEN=change-me
MCP_ENABLE_ADMIN_TOOLS=true
APPROVED_UNUSED_EXPIRY_SECONDS=600 # auto-expiry for approved-but-unused approvals (default 600 s)Running
Install dependencies:
uv sync --group devStart the MCP server over stdio:
uv run ibkr-mcpThe default transport is local stdio, which is the lowest-friction MCP setup for Claude Code/Desktop style clients.
Run over HTTP only for advanced self-hosted setups:
export MCP_TRANSPORT=streamable-http
export MCP_HOST=127.0.0.1
export MCP_PORT=8001
export MCP_AUTH_TOKEN=change-me
uv run ibkr-mcpRemote Execution Host
If IB Gateway runs on another machine, the recommended agent setup is to run mm-ibkr-mcp on that execution host and launch it over SSH stdio from the client machine.
Why this is preferred:
control.json, approvals, and audit state stay on the execution hostthe MCP process connects to the gateway through that host's own
127.0.0.1:4001/127.0.0.1:4002OpenCode or Claude does not need a separate local socket tunnel for the execution workflow
Use local SSH port forwarding only for other applications that require local gateway sockets on the client machine, such as a tracker or sync job that connects directly through ib_insync.
Canonical tools
Core monitoring and execution:
healthget_trading_statusget_schedule_statusget_account_summaryget_positionsget_pnllist_open_ordersget_order_statuspreview_orderplace_ordercancel_order
Basket execution:
preview_order_basketcreate_trade_intentrequest_trade_intent_approvalsubmit_trade_intentget_trade_intentlist_trade_intentsreconcile_trade_intentcancel_trade_intent
Approval and safety:
request_trade_approval(Blocks until approved/denied/timeout)request_trade_intent_approval(Blocks until approved/denied/timeout)request_environment_change(Blocks until approved/denied/timeout)execute_environment_changecheck_approval_statusemergency_stop
Expected workflow
Single order:
get_trading_statusresolve_contractpreview_orderassess_order_impactvalidate_against_profileIf
MCP_ORDER_APPROVAL_MODE=telegram, request approvalplace_order
Basket:
preview_order_basketcreate_trade_intentIf
MCP_ORDER_APPROVAL_MODE=telegram, request approvalsubmit_trade_intentreconcile_trade_intent
Persistence
The MCP server uses one SQLite database for:
audit_logorder_historyapprovalstrade_intentintent_orderexecution_stateposition_snapshot
This gives the agent one durable source of truth for approvals, order submission, reconciliation, and audit.
This server cannot be installed
Maintenance
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
- Alicense-qualityDmaintenanceAn MCP server that enables interaction with Interactive Brokers TWS/Gateway via natural language for portfolio management and market data retrieval. It provides tools for account summaries, historical data, and a secure two-step confirmation process for placing and canceling orders.6MIT
- AlicenseBqualityCmaintenanceMCP server for Interactive Brokers API, enabling account management, trading, market data, options, scanners, and news via natural language.333MIT
- Alicense-qualityDmaintenanceAn MCP server for Interactive Brokers, enabling account management, trading operations, and market data queries.8MIT
- Alicense-qualityDmaintenanceMCP 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.1MIT
Related MCP Connectors
Open-source MCP server for Zerodha Kite Connect. Portfolio, market data, backtesting, alerts.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
Hosted MCP for stocks, options, Greeks, brokers, order previews, alerts, and workflows.
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/MrRolie/mm-ibkr-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server