Skip to main content
Glama
ib-async-mcp

ib-async-mcp

by nadavgb-atom

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

Related MCP server: ib-async-mcp

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/Gateway

  • disconnect - Disconnect

  • is_connected - Check connection status

Account

  • get_accounts - List managed accounts

  • get_account_values - Account values (balance, margin, etc.)

  • get_account_summary - Account summary

  • get_portfolio - Portfolio with market values

  • get_positions - All positions

  • get_pnl - Profit and loss

Contracts

  • create_contract - Create a contract

  • qualify_contracts - Qualify contracts (fill conId)

  • get_contract_details - Detailed contract info

  • search_symbols - Search for symbols

Market Data

  • get_market_data - Real-time snapshot

  • get_historical_data - Historical bars

  • get_head_timestamp - Earliest available data

Orders

  • place_order - Place new order

  • cancel_order - Cancel order

  • cancel_all_orders - Cancel all orders

  • get_open_orders - List open orders

  • get_open_trades - List open trades

  • get_executions - Execution reports

  • get_fills - Order fills

  • what_if_order - Check margin impact

Options

  • get_option_chain - Option chain

  • calculate_implied_volatility - Calculate IV

  • calculate_option_price - Calculate option price

Scanners

  • get_scanner_parameters - Available scanner params

  • run_scanner - Run market scanner

News

  • get_news_providers - List news providers

  • get_news_article - Get article

  • get_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.

Available Tools

33 tools
calculate_implied_volatilityC

Calculate implied volatility from option price.

Inputs: symbol (required), expiry (required), strike (required), right (required), +2 more.

calculate_option_priceC

Calculate option price from volatility.

Inputs: symbol (required), expiry (required), strike (required), right (required), +2 more.

cancel_all_ordersA

Cancel all open orders.

Inputs: no named parameters.

cancel_orderB

Cancel an existing order.

Inputs: order_id (required).

connectA

Connect to TWS or IB Gateway. Must be called before using other tools.

Inputs: host, port, client_id, readonly.

create_contractB

Create a contract for trading. Types: stock, option, future, forex, index, cfd, crypto, bond.

Inputs: contract_type (required), symbol (required), exchange, currency, +4 more.

disconnectA

Disconnect from TWS/Gateway.

Inputs: no named parameters.

get_accountsA

Get list of managed account names.

Inputs: no named parameters.

get_account_summaryC

Get account summary.

Inputs: account.

get_account_valuesB

Get account values (balance, margin, etc.).

Inputs: account.

get_contract_detailsC

Get detailed contract information.

Inputs: contract_type (required), symbol (required), exchange, currency.

get_current_timeA

Get current TWS server time.

Inputs: no named parameters.

get_executionsC

Get execution reports.

Inputs: no named parameters.

get_fillsC

Get order fills.

Inputs: no named parameters.

get_head_timestampC

Get earliest available historical data timestamp.

Inputs: contract_type (required), symbol (required), exchange, currency, +1 more.

get_historical_dataC

Get historical bar data.

Inputs: contract_type (required), symbol (required), exchange, currency, +4 more.

get_historical_newsC

Get historical news headlines.

Inputs: con_id (required), provider_codes (required), total_results.

get_market_dataC

Get real-time market data snapshot for a contract.

Inputs: contract_type (required), symbol (required), exchange, currency.

get_news_articleC

Get a news article.

Inputs: provider_code (required), article_id (required).

get_news_providersC

Get available news providers.

Inputs: no named parameters.

get_open_ordersB

Get all open orders.

Inputs: no named parameters.

get_open_tradesB

Get all open trades.

Inputs: no named parameters.

get_option_chainC

Get option chain for an underlying.

Inputs: symbol (required), exchange, underlying_sec_type.

get_pnlC

Get profit and loss.

Inputs: account.

get_portfolioC

Get portfolio positions with market values.

Inputs: account.

get_positionsC

Get all positions.

Inputs: account.

get_scanner_parametersC

Get available scanner parameters.

Inputs: no named parameters.

is_connectedB

Check if connected to TWS/Gateway.

Inputs: no named parameters.

place_orderC

Place a new order.

Inputs: contract_type (required), symbol (required), action (required), quantity (required), +5 more.

qualify_contractsC

Qualify contracts to fill in missing fields like conId.

Inputs: contract_type (required), symbol (required), exchange, currency.

run_scannerC

Run a market scanner.

Inputs: scan_code (required), instrument, location_code, num_rows.

search_symbolsC

Search for matching symbols/contracts.

Inputs: pattern (required).

what_if_orderC

Check margin impact without placing order.

Inputs: contract_type (required), symbol (required), action (required), quantity (required), +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 33 tools

    Disambiguation5/5

    Each tool has a distinct purpose with clear boundaries, such as 'cancel_order' vs 'cancel_all_orders', 'get_account_summary' vs 'get_account_values', and 'place_order' vs 'what_if_order'. The descriptions specify unique functions, preventing agent misselection.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern (e.g., 'calculate_implied_volatility', 'get_historical_data', 'place_order'), with no deviations in style or convention. This predictability aids agent tool selection and understanding.

    Tool Count3/5

    With 33 tools, the count is borderline high for an MCP server, potentially overwhelming for agents. While the domain (Interactive Brokers trading) is complex, it may benefit from consolidation or categorization to improve usability.

    Completeness5/5

    The toolset comprehensively covers the trading domain, including connection management, contract creation, market data, order placement, account information, and analytics. No obvious gaps exist for core workflows, from setup to execution and monitoring.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An 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.
      6
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      MCP server for Interactive Brokers API, enabling account management, trading, market data, options, scanners, and news via natural language.
      33
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server for Interactive Brokers, enabling account management, trading operations, and market data queries.
      8
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Read-only MCP server for Interactive Brokers that exposes market data, positions, and account info as MCP tools.
      8
      MIT