XI

xiao81/ibkr-mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

23 stars 10 forks 품질 56 트렌드 0NOASSERTION

IBKR TWS API를 위한 MCP 서버

개요

A Model Context Protocol (MCP) Server for Interactive Brokers TWS API는 AI Assistants를 사용하여 포트폴리오 데이터, 계정 정보 및 실시간 시장 가격을 액세스 할 수 있습니다. - get portfolio() - 포지션과 P&L로 현재 포트폴리오를 검색 - get account summary() - 계정 잔고 및 키 메트릭 받기 - get stock price(symbol) - 현재 주식 가격을 확인 - get option price(symbol, expiry, 타격, 권리) - 옵션을 얻으십시오 TWS에서 → → →로 이동 : - ✅ - ✅ : 7497 (서류) 또는 7496 (라이브) - ❌ (사용 불가) ~/Library/Application Support/Claude/claude desktop config.json에 추가하십시오: - "현재 포트폴리오 성능 분석" - "AAPL 및 MSFT의 현재 가격은 무엇입니까?" - "내 계정 요약보기" - TWS / IB 게이트웨이가 실행되도록 보장 - TWS에서 API 설정 활성화 - 올바른 포트를 확인 (7497 대 7496) - TWS 설정에서 "Read-Only API" 비활성화 - TWS 글로벌 설정에서 API 활성화 ⚠️ : 이 소프트웨어는 교육 목적으로 사용됩니다. 당신의 위험에 사용.

개요(AI 번역)

A Model Context Protocol (MCP) Server for Interactive Brokers TWS API는 AI Assistants를 사용하여 포트폴리오 데이터, 계정 정보 및 실시간 시장 가격을 액세스 할 수 있습니다.

특징

  • get_portfolio() - 포지션과 P&L로 현재 포트폴리오 검색
  • get_account_summary() - 계정 잔고 및 키 메트릭을 얻기
  • get_stock_price(symbol) - 현재 주식 가격을 찾습니다
  • get_option_price(symbol, expiry, strike, right) - 옵션 가격을 얻으십시오

필수품

1.Interactive Brokers 계정 (Paper 또는 Live) 2. TWS (Trader Workstation) 또는 IB Gateway 실행 3. ** Python 3.10 + **

빠른 시작

##1. 종속 설치

##2. 연결 구성

##3. TWS 구성

TWS에서 Configure → Global Configuration → API → ** 설정**:

  • ✅ ** ActiveX 및 소켓 클라이언트 활성화 **
  • ✅ ** 소켓 포트 **: 7497 (서류) 또는 7496 (라이브)
  • ❌ Read-Only API (사용 불가)

##4. 테스트 설정

5. 서버 실행

6. Claude 데스크탑 통합

~/Library/Application Support/Claude/claude_desktop_config.json에 추가:

사용 예제

  • “내 현재 포트폴리오 성능 분석”
  • “AAPL 및 MSFT의 현재 가격은 무엇입니까?”

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

IBKR-MCP-Server

A Model Context Protocol (MCP) Server for Interactive Brokers TWS API that enables AI assistants to access portfolio data, account information, and real-time market prices.

Features

  • get_portfolio() - Retrieve current portfolio with positions and P&L
  • get_account_summary() - Get account balances and key metrics
  • get_stock_price(symbol) - Look up current stock prices
  • get_option_price(symbol, expiry, strike, right) - Get option prices

Prerequisites

  1. Interactive Brokers Account (Paper or Live)
  2. TWS (Trader Workstation) or IB Gateway running
  3. Python 3.10+

Quick Start

1. Install Dependencies

# Clone and setup
git clone https://github.com/your-username/IBKR-MCP-Server.git
cd IBKR-MCP-Server

# Install with UV (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync

# Or with pip
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e .

2. Configure Connection

# Copy example config
cp env.example .env

# Edit .env file:
IBKR_HOST=127.0.0.1
IBKR_PORT=7497              # 7497 for paper, 7496 for live
IBKR_CLIENT_ID=1
IBKR_IS_PAPER=true          # true for paper, false for live

3. Configure TWS

In TWS, go to Configure → Global Configuration → API → Settings:

  • ✅ Enable ActiveX and Socket Clients
  • ✅ Socket port: 7497 (paper) or 7496 (live)
  • ❌ Read-Only API (must be disabled)

4. Test Setup

# Test connection
uv run python test_connection.py

5. Run Server

# Start the MCP server
uv run python src/ibkr_mcp/server.py

6. Claude Desktop Integration

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

{
  "mcpServers": {
    "ibkr": {
      "command": "uv",
      "args": ["run", "python", "src/ibkr_mcp/server.py"],
      "cwd": "/path/to/IBKR-MCP-Server",
      "env": {
        "IBKR_PORT": "7497",
        "IBKR_IS_PAPER": "true"
      }
    }
  }
}

Usage Examples

  • “Analyze my current portfolio performance”
  • “What’s the current price of AAPL and MSFT?”
  • “Show me my account summary”

Troubleshooting

Connection Issues:

  • Ensure TWS/IB Gateway is running
  • Check API settings are enabled in TWS
  • Verify correct port (7497 vs 7496)

Permission Issues:

  • Disable “Read-Only API” in TWS settings
  • Enable API in TWS global configuration

⚠️ Disclaimer: This software is for educational purposes. Use at your own risk. Start with paper trading.

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "ibkr": { "command": "uv", "args": ["run", "python", "src/ibkr_mcp/server.py"], "cwd": "/path/to/IBKR-MCP-Server", "env": { "IBKR_PORT": "7497", "IBKR_IS_PAPER": "true" } } } }