home / mcp / ib mcp server

IB MCP Server

Provides an HTTP MCP endpoint and a local CLI runtime to interact with the IB REST API via MCP.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "rcontesti-ib_mcp": {
      "url": "http://localhost:5002/mcp/",
      "headers": {
        "MCP_SERVER_HOST": "0.0.0.0",
        "MCP_SERVER_PATH": "/mcp",
        "MCP_SERVER_PORT": "5002",
        "MCP_TRANSPORT_PROTOCOL": "streamable-http"
      }
    }
  }
}

This MCP server provides a Model Context Protocol interface on top of Interactive Brokers REST API, using the Web API as the data source. It exposes a fast, scriptable interface for querying IB data and issuing standard actions through a simple HTTP endpoint and a local, self-contained MCP runtime.

How to use

You connect to the MCP server via an HTTP client or through a local, command-based interface. Use the HTTP endpoint to query IB data and perform standard actions in a RESTful, JSON-friendly way. If you prefer a local runtime integration, run the MCP server as a stdio process and communicate with it using the provided command-line entry points.

How to install

Prerequisites you need on your machine are Docker Desktop and Git, along with a modern Python runtime for the MCP server if you opt to run it directly. Follow these steps to set up the containerized MCP server stack.

# Clone the repository
git clone https://github.com/rcontesti/IB_MCP.git

# Navigate to the project directory
cd IB_MCP

# Copy the .env.example file to .env and edit as needed
cp .env.example .env

# Build and start the images (detached)
docker compose up --build -d

Additional configuration notes

After the images are up, authenticate through the Client Portal Gateway UI at a URL like https://localhost:5055/ to establish a session. This MCP stack uses a gateway with a tickler service to keep sessions alive. The MCP server itself is exposed for HTTP access at http://localhost:5002/mcp/.

Additional setup steps for VS Code integration

Add the MCP server connection in your editor by configuring the MCP server entry. Use the values shown to point your editor to the local MCP endpoint.