Interactive Brokers

v1.21.10Finance & Fintechstable

Connects AI assistants to Interactive Brokers for intelligent portfolio management, options analysis, risk monitoring, and automated trading strategy suggestions. Enables real-time account tracking, Greeks calculations, option chain analysis, and pla

ibkribkr-apiinteractive-brokersmcpmcp-server
Share:
133
Stars
0
Downloads
0
Weekly
0/5

What is Interactive Brokers?

Interactive Brokers is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to connects ai assistants to interactive brokers for intelligent portfolio management, options analysis, risk monitoring, and automated trading strategy suggestions. enables real-time account tracking, g...

Connects AI assistants to Interactive Brokers for intelligent portfolio management, options analysis, risk monitoring, and automated trading strategy suggestions. Enables real-time account tracking, Greeks calculations, option chain analysis, and pla

This server falls under the Finance & Fintech category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Connects AI assistants to Interactive Brokers for intelligen

Use Cases

Monitor portfolio performance and analyze options Greeks through AI.
Suggest automated trading strategies based on risk analysis and market data.
code-rabi

Maintainer

LicenseMIT License
Languagejavascript
Versionv1.21.10
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y interactive-brokers-mcp

Manual Installation

npx -y interactive-brokers-mcp

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Interactive Brokers

The Interactive Brokers MCP server is an unofficial, community-built integration that connects AI assistants directly to your Interactive Brokers trading account via the IB Client Portal Gateway. It bundles a pre-configured IB Gateway and Java runtime so no separate installation is required — just run it with npx. The server supports browser-based OAuth authentication as well as headless credential-based mode for automated environments, and it enables AI-assisted portfolio monitoring, real-time market data retrieval, options analysis, order placement, and Flex Query execution for historical account data.

Prerequisites

  • An Interactive Brokers account (paper trading account recommended for initial testing)
  • Node.js 18+ installed
  • An MCP client such as Claude Desktop or Cursor
  • Optional: IB Flex Web Service Token (from IB Account Management) for Flex Query features
  • Important: This is an unofficial, alpha-stage tool — always test with paper trading before using live accounts
1

Add the MCP server to your client config

The simplest setup uses npx to run the server without any prior installation. On first use, a browser window opens automatically for Interactive Brokers OAuth authentication.

2

Complete the browser-based OAuth authentication

When the server starts for the first time, it launches your default browser and navigates to the IB OAuth login page. Log in with your Interactive Brokers credentials to authorize the connection.

3

Configure headless mode for automated environments

For automated or server-side use without a browser, set IB_HEADLESS_MODE=true along with your credentials. If two-factor authentication is triggered, the server waits up to 60 seconds for you to approve it via your mobile app or SMS.

4

Enable paper trading for safe testing

Set the IB_PAPER_TRADING environment variable to true to route all operations through your IB paper trading account instead of your live account.

5

Configure Flex Query access for historical data

To use Flex Queries for account statements and historical data, retrieve your Flex Web Service Token from IB Account Management (Settings > Account Settings > Reporting > Flex Web Service) and set it as IB_FLEX_TOKEN.

Interactive Brokers Examples

Client configuration

Minimal configuration using browser OAuth. For headless mode with paper trading, include the env block with credentials.

{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"]
    }
  }
}

// Headless + paper trading variant:
{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"],
      "env": {
        "IB_HEADLESS_MODE": "true",
        "IB_USERNAME": "your_ib_username",
        "IB_PASSWORD_AUTH": "your_ib_password",
        "IB_PAPER_TRADING": "true",
        "IB_FLEX_TOKEN": "your_flex_token"
      }
    }
  }
}

Prompts to try

After connecting and authenticating, use these prompts with your AI assistant to interact with your IB account.

- "Show me my current portfolio positions and their P&L"
- "What is the options chain for AAPL expiring next month? Show me the Greeks"
- "Place a limit buy order for 10 shares of MSFT at $420"
- "Run my monthly account statement Flex Query and summarize the results"
- "What is the current bid/ask spread for SPY?"

Troubleshooting Interactive Brokers

Browser does not open for OAuth or authentication times out

Ensure your default browser is configured and accessible. If running in a headless environment, switch to headless mode by setting IB_HEADLESS_MODE=true with IB_USERNAME and IB_PASSWORD_AUTH. For 2FA, you have 60 seconds to approve via the IB mobile app.

Flex Query returns 'token not configured' error

Set the IB_FLEX_TOKEN environment variable with your Flex Web Service Token from IB Account Management. Navigate to Settings > Account Settings > Reporting > Flex Web Service to generate or retrieve the token.

Server fails to start or Gateway connection refused

The bundled IB Gateway starts as a detached process and stores runtime files under ib-gateway/.runtime/. If a stale Gateway process is interfering, kill it manually and restart the MCP server. Check that no other IB Gateway instance is already running on the same port.

Frequently Asked Questions about Interactive Brokers

What is Interactive Brokers?

Interactive Brokers is a Model Context Protocol (MCP) server that connects ai assistants to interactive brokers for intelligent portfolio management, options analysis, risk monitoring, and automated trading strategy suggestions. enables real-time account tracking, greeks calculations, option chain analysis, and pla It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Interactive Brokers?

Install via npm with the command: npx -y interactive-brokers-mcp. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with Interactive Brokers?

Interactive Brokers works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Interactive Brokers free to use?

Yes, Interactive Brokers is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.

Browse More Finance & Fintech MCP Servers

Explore all finance & fintech servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "interactive-brokers-mcp-server": { "command": "npx", "args": ["-y", "interactive-brokers-mcp"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Interactive Brokers?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides