Interactive Brokers API FastMCP Server logo

Interactive Brokers API FastMCP Server

by karimQuant

This server allows LLMs to interact with your Interactive Brokers account using the Model Context Protocol (MCP). It acts as a middleware connecting to IB Gateway and exposing its functionality through the FastMCP framework.

View on GitHub

Last updated: N/A

What is Interactive Brokers API FastMCP Server?

This project creates a middleware server that connects to Interactive Brokers Gateway and exposes its functionality through the FastMCP framework, enabling LLMs to interact with your IB account.

How to use Interactive Brokers API FastMCP Server?

  1. Start your IB Gateway and log in. 2. Clone the repository and install dependencies. 3. Run the server using one of the provided commands (stdio, SSE, or FastMCP CLI). 4. Connect client applications (like Claude Desktop) to the server.

Key features of Interactive Brokers API FastMCP Server

  • 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

Use cases of Interactive Brokers API FastMCP Server

  • Retrieving portfolio information using LLMs

  • Executing trades through LLMs (potentially)

  • Automated trading strategies using LLMs

  • Integrating IB API with LLM-based applications

FAQ from Interactive Brokers API FastMCP Server

What is the purpose of this server?

It allows LLMs to interact with your Interactive Brokers account.

What are the prerequisites for using this server?

Python 3.11+, Interactive Brokers Gateway installed and running, and an IB account with API access enabled.

How do I install the server?

Clone the repository and install the dependencies using pip install -e ..

How do I run the server?

Use the command python server.py or fastmcp run server.py, or the other provided options.

What functionality is exposed by the server?

The server provides tools like get_portfolio_tool and resources like ibgateway://{host}/{port}.