MCP server,
Brokerage MCP server
An MCP server that lets AI agents review an Interactive Brokers account and prepare orders, with dry-run previews, an audit log and human approval before anything trades.

I wanted to use Claude and Codex for portfolio reviews without handing a language model the keys to a brokerage account. The Interactive Brokers API is large, and exposing it one endpoint at a time gives an agent too many ways to do the wrong thing. So I built a small MCP server around a fixed set of workflows instead.
The tools
There are twelve tools, each covering one workflow. portfolio returns the account context an agent needs before suggesting anything. position_size calculates position size from account value, stop distance and current exposure. submit_order stages a bracket order and returns a dry-run preview by default.
Multi-step judgement is left to the client’s prompts and skills. The server only enforces the limits.
Try it Tool boundary & dry-run gate
Three of the twelve tools: one reads the account, one calculates a position size, one submits an order.
1. Agent tool call
mcp.call("submit_order", {
symbol: "MSFT",
side: "BUY",
qty: 64,
limit_price: 422.50,
stop_loss: 408.00,
take_profit: 451.00
}) 2. Server boundary checks
- Bracket legs (stop_loss + take_profit) validated
- Appended to local SQLite audit log (row #042)
- Dry-run preview returned before any wire transmit
3. Returned payload (Synthetic demo feed)
{
"mode": "demo_dry_run",
"transmitted": false,
"audit_id": "audit_20260507_042",
"preview": "BUY 64 MSFT @ 422.50 LMT (SL 408.00 / TP 451.00)",
"estimated_commission": "$1.00"
} Safety model
- Demo mode is the default, with synthetic account, market and option data, so anyone can try it without broker credentials
- Orders are dry-run previews unless live mode and live trading are both explicitly switched on
- Every mutating action is written to a local SQLite audit log
- Live submit, cancel and modify are designed to sit behind a human approval step
Try it
It runs in demo mode out of the box:
uv sync
AGENTIC_BROKERAGE_MCP_BROKER_MODE=demo uv run agentic-brokerage-mcp The public repo is extracted from a larger private project, without the agent daemon, backtesting code and personal settings.
Then the official one arrived
Interactive Brokers has since released an official connector, which covers most of what I built this for. I’d still do three things the same way in any agent that can move money: preview first, keep an audit trail and keep the list of tools short.