ibapi-mcp-server

ibapi-mcp-server

2

The Interactive Brokers API FastMCP Server is a middleware server that uses the Model Context Protocol to allow LLMs to interact with an Interactive Brokers account. It exposes IB functionality as MCP tools, enabling operations like portfolio retrieval and trade execution.

Interactive Brokers API FastMCP Server

A server implementation for Interactive Brokers' API using the Model Context Protocol (MCP).

Features

  • Connect to Interactive Brokers Gateway via the official IB API
  • Support multiple simultaneous client connections through FastMCP
  • Expose IB functionality as MCP tools and resources
  • Connection status monitoring
  • Error handling and logging

Prerequisites

  • Python 3.11+
  • Interactive Brokers Gateway installed and running
  • IB account with API access enabled

Usage

  1. Start your IB Gateway and log in
  2. Run the server using stdio or SSE transport.
  3. Connect client applications to the server.

API Documentation

Available Tools

  • get_portfolio_tool: Retrieve your current portfolio positions and account summary

Resources

  • ibgateway://{host}/{port}: Get the current status of the IB Gateway connection