MCPSERV.CLUB
seriallazer

IBKR MCP Server

MCP Server

FastAPI service for Interactive Brokers portfolio data

Stale(50)
48stars
1views
Updated 12 days ago

About

A FastAPI application that connects to the Interactive Brokers API, retrieves portfolio details, and exposes them through REST endpoints for easy integration into monitoring or analytics workflows.

Capabilities

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

Overview

The IBKR MCP Server bridges the gap between AI assistants and real‑time brokerage data by exposing Interactive Brokers (IBKR) portfolio information through the Model Context Protocol. Rather than hard‑coding data retrieval logic into a chatbot, developers can delegate all interactions with the IBKR API to this lightweight FastAPI service. The server translates standard MCP requests into authenticated calls against the IBKR gateway, fetches account balances, positions, and market data, and returns structured JSON payloads that Claude or any other MCP‑compatible assistant can consume directly.

This approach solves a common pain point for finance developers: the need to maintain secure, up‑to‑date API credentials while keeping conversational agents stateless. By centralizing authentication and rate limiting within the MCP server, developers can expose a single endpoint to their assistant workflows. The server’s design follows typical best practices—environment‑based configuration, dependency injection through FastAPI, and clear separation of concerns between routing (), business logic (), and data models (). This structure makes the codebase easy to extend, test, and deploy in containerized environments.

Key capabilities of the server include:

  • Portfolio Retrieval – fetch current holdings, cash balances, and margin information with a single API call.
  • Secure Credential Management – environment variables hold IBKR credentials, preventing accidental exposure in source control.
  • MCP‑Ready Endpoints – the API is annotated for automatic generation of MCP resources, allowing an AI assistant to discover and invoke it without manual configuration.
  • FastAPI Integration – built‑in OpenAPI documentation () and automatic validation simplify debugging and client generation.

Typical use cases span from automated portfolio monitoring to dynamic strategy execution. An AI assistant can ask, “What’s my current equity exposure?” and the MCP server will return a concise snapshot that the assistant can interpret, summarize, or trigger downstream actions such as rebalancing scripts. In a trading firm, the server can be part of a larger orchestration pipeline where AI insights drive order placement through separate MCP endpoints.

Because the server handles all IBKR communication, developers can focus on higher‑level business logic. The MCP interface abstracts away connection details, authentication flow, and error handling, giving assistants a clean, reliable data source. This decoupling also enhances security: credentials never leave the server, and only vetted API responses reach the assistant. Overall, the IBKR MCP Server provides a robust, scalable bridge that empowers AI assistants to interact seamlessly with live brokerage data.