IB Portfolio Tracker MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/vinbg/ib-mcp-server.git
cd ib-mcp-server
./setup.sh
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add ib-portfolio-tracker -- node "<FULL_PATH_TO_IB_MCP_SERVER>/dist/index.js"

Replace <FULL_PATH_TO_IB_MCP_SERVER>/dist/index.js with the actual folder you prepared in step 1.

README.md

Connects Claude AI to your Interactive Brokers account for real-time tracking

IB Portfolio Tracker - MCP Server

An MCP (Model Context Protocol) server that connects Claude AI to your Interactive Brokers account for real-time portfolio tracking, financial news, and sentiment analysis.

What Can You Do?

Once set up, you can ask Claude things like:

  • "What's my portfolio value?"
  • "Show my positions with P&L"
  • "Give me a full news analysis for NVDA" (combines IB + Finnhub + sentiment)
  • "What's the sentiment around Tesla?"
  • "Show historical data for SPY"
  • "What news providers are available from IB?"

All responses come directly from your Interactive Brokers account, IB news feeds (Reuters, Dow Jones, etc.), and optionally Finnhub API.


Quick Start

Prerequisites

  • macOS, Linux, or Windows
  • Python 3.10+ installed
  • Interactive Brokers account
  • Claude Desktop or Claude Code (VS Code)

Step 1: Download IB Gateway

IB Gateway is a lightweight app that allows API access to your IBKR account.

  1. Download from: https://www.interactivebrokers.com/en/trading/ibgateway-stable.php
  2. Install and log in with your IBKR credentials
  3. Configure API settings:
    • Go to Configure → Settings → API → Settings
    • Set Socket port to 4001
    • Check Read-Only API (recommended for safety)
  4. Keep IB Gateway running whenever you want to use the portfolio features

Note: IBKR Desktop app does NOT support API connections. You need IB Gateway or TWS.

Step 2: Get a Finnhub API Key (Optional)

Finnhub provides additional news and social sentiment data. This is optional - IB native news works without it.

  1. Sign up at: https://finnhub.io/register
  2. Copy your API key from the dashboard
  3. Free tier: 60 requests/minute (plenty for personal use)

Step 3: Install the MCP Server

# Clone or download this repository
git clone https://github.com/vinbg/ib-mcp-server.git
cd ib-mcp-server

# Run the setup script
# Mac/Linux:
chmod +x setup.sh
./setup.sh

# Windows:
setup.bat

The setup script will:

  • Create a Python virtual environment
  • Install all dependencies
  • Guide you through configuration
  • Test your connections

Step 4: Configure Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "ib-portfolio": {
      "command": "/FULL/PATH/TO/ib-mcp-server/.venv/bin/python",
      "args": ["-m", "ib_mcp.server"],
      "cwd": "/FULL/PATH/TO/ib-mcp-server"
    }
  }
}

Replace /FULL/PATH/TO/ with your actual path!

Then restart Claude Desktop (Cmd+Q, then reopen).


Optional: Add LunarCrush for Crypto Sentiment

LunarCrush provides social sentiment data for cryptocurrencies. To add it alongside this server:

  1. Get an API key at: https://lunarcrush.com/developers
  2. Add to your Claude Desktop config:
{
  "mcpServers": {
    "ib-portfolio": {
      "command": "/FULL/PATH/TO/ib-mcp-server/.venv/bin/python",
      "args": ["-m", "ib_mcp.server"],
      "cwd": "/FULL/PATH/TO/ib-mcp-server"
    },
    "LunarCrush": {
      "type": "http",
      "url": "https://lunarcrush.ai/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_LUNARCRUSH_API_KEY"
      }
    }
  }
}

Now you can ask Claude about crypto social sentiment alongside your IBKR portfolio!


Available Tools (22 total)

Comprehensive News (RECOMMENDED)

Tool Description
get_comprehensive_news All-in-one news analysis - combines IB news, Finnhub news, social sentiment, insider sentiment, and AI-analyzed scores

Portfolio Tools (requires IB Gateway)

Tool Description
get_account_summary Net liquidation value, buying power, cash, margin
get_positions All positions with quantities, cost basis, P&L
get_portfolio_pnl Daily, unrealized, and realized P&L breakdown
get_position_details Detailed info for a specific symbol
get_open_orders List pending orders
get_executions Recent trade fills

Market Data Tools (requires IB Gateway)

Tool Description
get_quote Real-time/delayed quotes (bid, ask, last, volume)
get_historical_data OHLCV historical bars
get_contract_details Symbol info, trading hours
search_symbols Find contracts by name

IB Native News Tools (requires IB Gateway)

Tool Description
get_ib_news_providers List available news sources (Reuters, Dow Jones, etc.)
get_ib_news Get historical news from IB for a symbol
get_ib_news_article Get full article text by article ID

Finnhub News & Sentiment Tools (requires Finnhub API)

Tool Description
search_news Search by symbol or keyword
get_company_news Company-specific headlines
get_market_news General market

Tools (17)

get_comprehensive_newsCombines IB news, Finnhub news, social sentiment, insider sentiment, and AI-analyzed scores.
get_account_summaryRetrieves net liquidation value, buying power, cash, and margin.
get_positionsLists all positions with quantities, cost basis, and P&L.
get_portfolio_pnlProvides daily, unrealized, and realized P&L breakdown.
get_position_detailsProvides detailed info for a specific symbol.
get_open_ordersLists pending orders.
get_executionsRetrieves recent trade fills.
get_quoteRetrieves real-time or delayed quotes including bid, ask, last, and volume.
get_historical_dataRetrieves OHLCV historical bars.
get_contract_detailsRetrieves symbol info and trading hours.
search_symbolsFinds contracts by name.
get_ib_news_providersLists available news sources like Reuters and Dow Jones.
get_ib_newsGets historical news from IB for a specific symbol.
get_ib_news_articleGets full article text by article ID.
search_newsSearches news by symbol or keyword.
get_company_newsRetrieves company-specific headlines.
get_market_newsRetrieves general market news.

Environment Variables

FINNHUB_API_KEYOptional API key for additional news and social sentiment data.

Configuration

claude_desktop_config.json
{"mcpServers": {"ib-portfolio": {"command": "/FULL/PATH/TO/ib-mcp-server/.venv/bin/python", "args": ["-m", "ib_mcp.server"], "cwd": "/FULL/PATH/TO/ib-mcp-server"}}}

Try it

What is my current portfolio value and total P&L?
Show me my open positions and their current performance.
Give me a full news analysis for NVDA including sentiment.
What is the current market sentiment around Tesla?
Show me the historical price data for SPY.

Frequently Asked Questions

What are the key features of IB Portfolio Tracker?

Real-time portfolio tracking and position management via Interactive Brokers. Historical market data retrieval including OHLCV bars. Comprehensive news analysis combining IB, Finnhub, and social sentiment. Access to IB native news providers like Reuters and Dow Jones. Support for trade execution monitoring and order status.

What can I use IB Portfolio Tracker for?

Investors wanting to query their portfolio performance using natural language. Traders needing to quickly aggregate news and sentiment for specific tickers. Users performing technical analysis by fetching historical market data directly into Claude. Monitoring pending orders and recent trade executions without opening the TWS interface.

How do I install IB Portfolio Tracker?

Install IB Portfolio Tracker by running: git clone https://github.com/vinbg/ib-mcp-server.git && cd ib-mcp-server && ./setup.sh

What MCP clients work with IB Portfolio Tracker?

IB Portfolio Tracker works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep IB Portfolio Tracker docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare