MCP ExplorerExplorer

Ibapi Mcp Server

@karimQuanton a year ago
2 MIT
FreeCommunity
AI Systems
Interactive Brokers API Multi-Client Protocol Server

Overview

What is Ibapi Mcp Server

ibapi-mcp-server is a middleware server that connects to Interactive Brokers’ API, allowing Large Language Models (LLMs) to interact with your IB account using the Model Context Protocol (MCP).

Use cases

Use cases include retrieving portfolio information, executing trades via LLMs, and developing trading applications that require real-time data from Interactive Brokers.

How to use

To use ibapi-mcp-server, start your Interactive Brokers Gateway, run the server using Python, and connect client applications to the server. You can choose different transport methods such as stdio or SSE.

Key features

Key features include connection to Interactive Brokers Gateway via the official IB API, support for multiple simultaneous client connections, exposure of IB functionality as MCP tools, connection status monitoring, and error handling with logging.

Where to use

ibapi-mcp-server can be used in financial services, trading applications, and any environment where integration with Interactive Brokers is required.

Content

Interactive Brokers API FastMCP Server

A server implementation for Interactive Brokers’ API that allows LLMs to interact with your IB account using the Model Context Protocol (MCP).

Overview

This project creates a middleware server that connects to Interactive Brokers Gateway and exposes its functionality through the FastMCP framework. This allows LLMs like Claude to interact with your IB account, retrieve portfolio information, and potentially execute trades.

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

Installation

  1. Clone this repository:
git clone https://github.com/karimQuant/ibapi-mcp-server.git
cd ibapi-mcp-server
  1. Install dependencies:
pip install -e .

Usage

  1. Start your IB Gateway and log in

  2. Run the server:

    a. Using stdio transport (default):

    python server.py
    

    b. Using SSE transport:

    python server.py sse
    

    c. Using SSE transport with custom port:

    python server.py sse port=9000
    

    d. Using the FastMCP CLI:

    fastmcp run server.py
    

    e. For development with an interactive testing environment:

    fastmcp dev server.py
    
  3. Connect client applications (like Claude Desktop) to the server

API Documentation

The FastMCP Server provides the following functionality:

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

License

MIT

Contribution

Contributions are welcome! Please feel free to submit a Pull Request.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers