Skip to main content
Glama
jgalea

ibkr-mcp

by jgalea

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
IBKR_HOSTNoTWS / Gateway host127.0.0.1
IBKR_PORTNoMatch your TWS / Gateway mode (7496 live, 7497 paper, 4001 live gateway, 4002 paper gateway)7497
IBKR_TIMEOUTNoConnect and request timeout in seconds10
IBKR_CLIENT_IDNoUnique per API client (must be at least 1)23
IBKR_FLEX_TOKENNoThe Flex Web Service token itself (fallback; prefer IBKR_FLEX_TOKEN_CMD)
IBKR_FLEX_QUERY_IDNoNumeric ID of your Activity Flex Query (or IBKR_FLEX_QUERY_IDS for multiple)
IBKR_ENABLE_TRADINGNoSet to 'true', '1', or 'yes' to register order tools
IBKR_FLEX_TOKEN_CMDNoCommand whose stdout is the Flex Web Service token
IBKR_MAX_ORDER_VALUENoCap on order notional (ceiling 10,000,000)50000
IBKR_MARKET_DATA_TYPENo1 live, 2 frozen, 3 delayed, 4 delayed-frozen3
IBKR_ORDERS_PER_MINUTENoAggregate order rate limit across concurrent calls6
IBKR_MAX_ORDER_QUANTITYNoHard cap on units per order (ceiling 1,000,000)1000
IBKR_ALLOW_EXTERNAL_CANCELNoSet to 'true' to allow cancel_order to cancel orders not placed by this server

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
extensions
{
  "io.modelcontextprotocol/ui": {}
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
list_accountsB

List account IDs managed by the current TWS/Gateway login.

get_account_summaryB

Account summary: net liquidation, cash, buying power, margin, etc.

get_positionsB

Current positions with quantity and average cost.

get_portfolioB

Portfolio with market value, unrealized and realized PnL per position.

review_positionsA

Review open positions for loss discipline. Flags positions that have fallen past a loss threshold so a deliberate decision gets made — "has the thesis changed, or just the price?" — instead of defaulting to holding. Surfaces the book so the well-documented tendency to hold losers and sell winners (the disposition effect) gets a conscious check. Informational, not advice.

get_pnlB

Today's realized/unrealized/daily PnL for an account.

get_quoteC

Market data snapshot (delayed by default; see IBKR_MARKET_DATA_TYPE).

get_historical_dataC

Historical OHLCV bars.

lookup_contractC

Resolve a symbol to a fully qualified IB contract (conId, exchange, etc.).

search_contractsC

Search instruments by symbol or company name.

get_open_ordersA

Open (working) orders across accounts.

get_executionsA

Executions (fills) from the current session/day.

get_history_coverageA

Date span and row counts of locally archived account history.

get_trade_historyA

Historical executed trades from the configured Flex query (up to its period, plus everything previously archived locally). Needs IBKR_FLEX_QUERY_ID + token; see README.

get_cash_transactionsC

Historical cash activity (dividends, interest, deposits/withdrawals, fees) from the configured Flex query. Needs IBKR_FLEX_QUERY_ID + token; see README.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

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/jgalea/ibkr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server