MCPSERV.CLUB
karimQuant

Interactive Brokers API FastMCP Server

MCP Server

LLMs access Interactive Brokers via FastMCP for portfolio and trades

Stale(55)
3stars
0views
Updated Aug 7, 2025

About

This server bridges Interactive Brokers Gateway with the FastMCP framework, allowing large language models to retrieve portfolio data and execute trades through a standardized MCP interface. It supports multiple concurrent clients, real‑time status monitoring, and robust error handling.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Overview

The Interactive Brokers API FastMCP Server is a lightweight middleware that bridges the gap between large language models (LLMs) and Interactive Brokers’ trading platform. By exposing the IB Gateway’s API through the Model Context Protocol (MCP), it lets AI assistants such as Claude query account data and, in future iterations, place trades directly from natural‑language commands. This removes the need for custom integration code and allows developers to prototype trading strategies or portfolio dashboards in a conversational interface.

At its core, the server connects to an already‑running IB Gateway using the official Python client. Once authenticated, it registers a set of MCP tools and resources with the FastMCP framework. The most prominent tool, , fetches real‑time portfolio positions and account summaries, returning them in a structured JSON format that the LLM can consume. A resource endpoint () exposes connection health, enabling the assistant to check whether the gateway is online before attempting operations. The server also monitors connection status, logs errors, and supports multiple concurrent client connections, making it suitable for shared environments or multi‑assistant deployments.

Key capabilities include:

  • Real‑time data retrieval – Pull the latest holdings, P&L, and account metrics without manual API calls.
  • Connection health checks – A dedicated resource allows clients to verify gateway availability, reducing failed trade attempts.
  • Concurrent access – FastMCP’s multiplexing lets several assistants or applications query the same IB account simultaneously.
  • Extensibility – The architecture is modular; additional tools (e.g., order placement, market data) can be added with minimal effort.

Typical use cases span the spectrum of algorithmic trading and financial analysis. A developer could ask an AI assistant to “Show me my current positions” or “What’s the unrealized profit on my portfolio?” and receive an instant, accurate response. In a more advanced scenario, the assistant could be instructed to “Rebalance my portfolio by selling 10% of XYZ” and the server would translate that into a market order via the IB API. Financial analysts can leverage the same interface to generate reports or run simulations, all within a conversational workflow.

Integration into existing AI pipelines is straightforward. Once the server is running, any MCP‑compatible client—such as Claude Desktop or custom agents built with FastMCP CLI tools—can connect via standard transport protocols (stdio, SSE). The LLM can then invoke the or query the status resource as part of its reasoning process, enabling seamless data‑driven decision making without leaving the chat interface. This tight coupling between language models and brokerage APIs unlocks new possibilities for automated trading, portfolio monitoring, and interactive financial education.