Get the FREE Ultimate OpenClaw Setup Guide →

ibkr

MCP Server for IBKR Client

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio seriallazer-ibkr-mcp-server python -m uvicorn app.main:app --reload

How to use

This MCP server is a FastAPI application that interfaces with the Interactive Brokers (IBKR) API to fetch portfolio details. Once running, you can access the automatically generated API docs at http://localhost:8000/docs, where you’ll find endpoints related to portfolio data. The server exposes an endpoint that retrieves current portfolio information via the IBKR integration, and it’s designed to be invoked by MCP tooling or any client that can call HTTP APIs. Typical usage involves starting the server locally or in your environment and then querying the portfolio endpoints to obtain holdings, positions, and value metrics.

Tools and capabilities include:

  • An API endpoint to fetch portfolio details from IBKR using the configured credentials in your environment.
  • Automatic OpenAPI docs and interactive Swagger UI for exploring available endpoints and response schemas.
  • A FastAPI-based structure that allows easy extension if you need additional IBKR-related data (e.g., positions by account, unrealized P&L, or margin details).

To use, ensure your environment is pointed to IBKR with valid credentials (see Setup Instructions) and call the exposed HTTP endpoints from your MCP workflow or any HTTP client.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Access to IBKR API credentials (IBKR account with API enabled)
  • Network access to IBKR endpoints from the host running this server

Install steps:

  1. Clone the repository and navigate into it: git clone <repository-url> cd ibkr-mcp-server

  2. Create and activate a virtual environment: python -m venv venv

    macOS/Linux

    source venv/bin/activate

    Windows

    venv\Scripts\activate

  3. Install dependencies: pip install -r requirements.txt

  4. Configure environment variables:

    • Create a .env file in the project root and add your IBKR API credentials as required by the application (e.g., IBKR_API_KEY, IBKR_API_SECRET, IBKR_CLIENT_ID, etc.).
    • Example (adjust to actual env vars used by the app): IBKR_API_KEY=your_key IBKR_API_SECRET=your_secret IBKR_CLIENT_ID=your_client_id
  5. Run the application: uvicorn app.main:app --reload

    If you prefixed with the MCP runtime command, use the equivalent as defined in mcp_config.

  6. Verify the server is running by visiting http://localhost:8000/docs for the API docs.

Additional notes

Notes and tips:

  • Ensure your IBKR credentials are stored securely and not committed to version control.
  • If you switch environments (dev, staging, prod), keep separate .env configurations or use a secrets manager.
  • The OpenAPI docs at /docs will help you discover available endpoints and their request/response schemas.
  • If you encounter connectivity issues with IBKR, verify network access and that any required IBKR API services are reachable from your host.
  • You can customize the port or reload behavior by adjusting the uvicorn startup options in the mcp_config or your local startup script.

Related MCP Servers

Sponsor this space

Reach thousands of developers