Interactive Brokers MCP

v1.0.0Finance & Fintechstable

This project provides an Interactive Brokers (IB) API interface using the Model Context Protocol (MCP).

fastmcpinteractive-brokersmcp-serverpython
Share:
124
Stars
0
Downloads
0
Weekly
0/5

What is Interactive Brokers MCP?

Interactive Brokers MCP is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to this project provides an interactive brokers (ib) api interface using the model context protocol (mcp).

This project provides an Interactive Brokers (IB) API interface using the Model Context Protocol (MCP).

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

Features

  • This project provides an Interactive Brokers (IB) API interf

Use Cases

Access Interactive Brokers API through FastMCP Python interface.
Enable AI-driven trading and portfolio management operations.
rcontesti

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 10, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx ib-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 MCP

IB MCP provides a Model Context Protocol interface to the Interactive Brokers Web API, exposing account management, portfolio monitoring, live market data, and order management to AI assistants through a locally-running FastMCP Python server. It runs the official IBKR Client Portal Gateway in Docker and bridges it to any MCP-compatible client, making it possible to query positions, place orders, and analyze portfolio data through natural language without writing code. Traders and developers who already have an Interactive Brokers account can use it to bring AI-assisted analysis directly into their brokerage workflow.

Prerequisites

  • An active Interactive Brokers account with Web API access enabled
  • Docker and Docker Compose installed on the host machine
  • Python 3.10 or later (for local development; Docker handles production)
  • An MCP-compatible client such as Claude Desktop or VS Code with Copilot Chat
  • Network access to localhost on port 5055 (IBKR gateway) and 5002 (MCP server)
1

Clone the repository and configure environment

Clone the IB_MCP repository and copy the example environment file. Edit .env to set your gateway and MCP server parameters before starting any services.

git clone https://github.com/rcontesti/IB_MCP.git
cd IB_MCP
cp .env.example .env
2

Start the services with Docker Compose

Build and start the IBKR Client Portal Gateway and the MCP server containers in detached mode.

docker compose up --build -d
3

Authenticate with Interactive Brokers

Open your browser and navigate to the gateway login page. Enter your Interactive Brokers credentials. This step is required every session as IBKR sessions expire periodically.

# Default gateway URL (open in browser)
https://localhost:5055/
4

Configure your MCP client

Add the running MCP server to your client. For VS Code with GitHub Copilot Chat, create or edit .vscode/mcp.json in your workspace with the HTTP transport URL.

5

Verify the connection

The MCP server calls the /tickle endpoint automatically every 60 seconds to keep the IBKR session alive. Confirm the MCP server is reachable on port 5002.

curl http://localhost:5002/mcp/

Interactive Brokers MCP Examples

Client configuration

VS Code Copilot Chat configuration using the HTTP transport. Place this in .vscode/mcp.json or in VS Code settings.json.

{
  "servers": {
    "ib-mcp-server": {
      "type": "http",
      "url": "http://localhost:5002/mcp/"
    }
  }
}

Prompts to try

These prompts work after the gateway session is authenticated and the MCP server is connected to your client.

- "Show me my current portfolio positions and their P&L."
- "What is the current market price for AAPL?"
- "List all open orders on my account."
- "What is my account's buying power and available cash?"
- "Show me the recent activity in my account."

Troubleshooting Interactive Brokers MCP

Browser shows SSL certificate warning when opening the gateway

The IBKR Client Portal Gateway uses a self-signed certificate. Click 'Advanced' and proceed — this is expected behavior for the local gateway and does not affect security.

MCP server returns authentication errors after working initially

The IBKR session expires. Return to https://localhost:5055/ and re-authenticate with your IB credentials. The /tickle keepalive only extends an active session; it cannot re-authenticate after timeout.

Docker Compose fails to start the gateway container

Ensure no other service is using ports 5055 or 5002. Check GATEWAY_PORT and MCP_SERVER_PORT in your .env file and adjust if needed, then re-run 'docker compose up --build -d'.

Frequently Asked Questions about Interactive Brokers MCP

What is Interactive Brokers MCP?

Interactive Brokers MCP is a Model Context Protocol (MCP) server that this project provides an interactive brokers (ib) api interface using the model context protocol (mcp). It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Interactive Brokers MCP?

Follow the installation instructions on the Interactive Brokers MCP GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Interactive Brokers MCP?

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

Is Interactive Brokers MCP free to use?

Yes, Interactive Brokers MCP is open source and available under the MIT 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": { "ib-mcp": { "command": "npx", "args": ["-y", "ib-mcp"] } } }

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

Read the full setup guide →

Ready to use Interactive Brokers MCP?

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