Skip to main content
Glama
Interactive Brokers MCP Server

Interactive Brokers MCP Server

by code-rabi

Interactive Brokers MCP 서버

면책 조항: 본 서버는 비공식 커뮤니티 개발 MCP 서버이며, Interactive Brokers와 제휴하거나 보증하지 않습니다. 이 소프트웨어는 알파 상태이며 완벽하게 작동하지 않을 수 있습니다.

Interactive Brokers 트레이딩 플랫폼과의 통합을 제공하는 모델 컨텍스트 프로토콜(MCP) 서버입니다. 이 서버를 통해 AI 어시스턴트가 귀하의 IB 계정과 상호작용하여 시장 데이터를 검색하고, 포지션을 확인하며, 주문을 실행할 수 있습니다.

🔒 보안 공지

Interactive Brokers MCP 소개

Related MCP server: Interactive Brokers MCP Server

주요 기능

  • Interactive Brokers API 통합: 계정 관리, 포지션 추적, 실시간 시장 데이터, 주문 관리(시장가, 지정가, 스탑 주문)를 포함한 전체 트레이딩 기능 지원

  • Flex Query 지원: Flex Query를 실행하여 계정 명세서, 거래 확인서 및 과거 데이터를 검색합니다. 쿼리는 재사용이 쉽도록 자동으로 저장됩니다.

  • 유연한 인증: 브라우저 기반 OAuth 인증 또는 자동화된 환경을 위한 자격 증명 기반 헤드리스 모드 중 선택 가능

  • 간편한 설정: npx로 직접 실행 가능 - Docker나 추가 설치가 필요 없습니다. 모든 플랫폼을 위한 사전 구성된 IB Gateway 및 Java 런타임이 포함되어 있습니다.

보안 공지

중요 경고:

  • 재무적 위험: 트레이딩은 상당한 손실 위험을 수반합니다. 항상 모의 투자(Paper Trading)로 먼저 테스트하십시오.

  • 보안: 이 소프트웨어는 민감한 금융 데이터를 처리합니다. 로컬에서만 실행하고, 공용 서버에서는 절대 실행하지 마십시오.

  • 보증 없음: 이 비공식 소프트웨어는 어떠한 보증도 제공하지 않습니다. 사용자의 책임하에 사용하십시오.

  • 투자 조언 아님: 이 도구는 자동화를 위한 것이며, 투자 조언이 아닙니다.

사전 요구 사항

추가 설치가 필요 없습니다! 이 패키지에는 다음이 포함되어 있습니다:

  • 모든 플랫폼(Linux, macOS, Windows)용 사전 구성된 IB Gateway

  • IB Gateway용 Java 런타임 환경(JRE), Alpine 기반 컨테이너(예: node:lts-alpine, supergateway)를 위한 musl-libc 빌드 포함

  • 모든 필수 종속성

필요한 것:

  • Interactive Brokers 계정 (모의 투자 또는 실거래)

  • Node.js 18+ (MCP 서버 실행용)

빠른 시작

Cursor/Claude 설정에 이 MCP 서버를 추가하십시오:

{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"]
    }
  }
}

서버를 처음 사용할 때, Interactive Brokers OAuth 인증 흐름을 위한 웹 브라우저 창이 자동으로 열립니다. IB 자격 증명으로 로그인하여 연결을 승인하십시오.

헤드리스 모드 설정

자동화된 환경이나 인증을 위해 브라우저를 사용하지 않으려는 경우, MCP 서버 설정에서 헤드리스 모드를 구성하여 활성화할 수 있습니다:

{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"],
      "env": {
        "IB_HEADLESS_MODE": "true",
        "IB_USERNAME": "your_ib_username",
        "IB_PASSWORD_AUTH": "your_ib_password"
      }
    }
  }
}

헤드리스 모드에서는 브라우저 창을 열지 않고도 자격 증명을 사용하여 서버가 자동으로 인증합니다. 이는 다음 상황에 유용합니다:

  • 자동화된 트레이딩 시스템

  • 디스플레이가 없는 서버 환경

  • CI/CD 파이프라인

  • 브라우저 상호작용을 원하지 않는 상황

중요: 헤드리스 모드에서도 Interactive Brokers는 2단계 인증(2FA)을 요구할 수 있습니다. 2FA가 트리거되면, 헤드리스 인증은 귀하가 구성한 방법(모바일 앱, SMS 등)을 통해 2FA 프로세스를 완료할 때까지 대기합니다.

모의 투자를 활성화하려면 환경 변수에 "IB_PAPER_TRADING": "true"를 추가하십시오:

{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"],
      "env": {
        "IB_HEADLESS_MODE": "true",
        "IB_USERNAME": "your_ib_username",
        "IB_PASSWORD_AUTH": "your_ib_password",
        "IB_PAPER_TRADING": "true"
      }
    }
  }
}

보안 참고: 자격 증명을 안전하게 보관하고 버전 관리 시스템에 커밋하지 마십시오. 환경 변수 파일이나 안전한 자격 증명 관리 시스템 사용을 고려하십시오.

Flex Query 설정 (선택 사항)

계정 명세서 및 과거 데이터를 검색하기 위해 Flex Query를 사용하려면 Flex Web Service 토큰을 구성해야 합니다:

{
  "mcpServers": {
    "interactive-brokers": {
      "command": "npx",
      "args": ["-y", "interactive-brokers-mcp"],
      "env": {
        "IB_FLEX_TOKEN": "your_flex_token_here"
      }
    }
  }
}

Flex 토큰을 얻는 방법:

  1. Interactive Brokers 계정 관리에 로그인

  2. 설정(Settings) → **계정 설정(Account Settings)**으로 이동

  3. 보고서(Reporting) → Flex Web Service로 이동

  4. Flex Web Service 토큰을 생성하거나 검색

Flex Web Service 활성화에 대한 자세한 지침은 IB Flex Web Service 가이드를 참조하십시오.

Flex Query 생성 방법:

  1. 계정 관리에서 보고서(Reports) → **Flex 쿼리(Flex Queries)**로 이동

  2. 쿼리 템플릿을 생성하거나 사용자 지정

  3. 쿼리 옆의 정보 아이콘을 클릭하여 쿼리 ID 확인

Flex Query 생성 및 사용자 지정에 대한 전체 가이드는 IB Flex 쿼리 가이드를 참조하십시오.

참고: Flex Query를 처음 실행하면 MCP 서버가 API에서 가져온 이름으로 자동으로 저장합니다. 이후 실행 시에는 ID나 저장된 이름으로 쿼리를 참조할 수 있습니다.

Flex Query 기능:

  • 자동 메모리: Flex Query를 실행하면 향후 사용을 위해 자동으로 저장됩니다.

  • 간편한 재사용: 이전에 사용한 쿼리가 기억되므로 쿼리 ID를 반복해서 복사할 필요가 없습니다.

  • 친숙한 이름: 쿼리를 처음 실행할 때 선택적으로 친숙한 이름을 제공할 수 있습니다.

  • 쿼리 삭제: forget_flex_query 도구로 더 이상 필요 없는 쿼리를 제거할 수 있습니다.

설정 변수

기능

환경 변수

명령줄 인수

사용자 이름

IB_USERNAME

--ib-username

비밀번호

IB_PASSWORD_AUTH

--ib-password-auth

헤드리스 모드

IB_HEADLESS_MODE

--ib-headless-mode

모의 투자

IB_PAPER_TRADING

--ib-paper-trading

인증 타임아웃

IB_AUTH_TIMEOUT

--ib-auth-timeout

Flex 토큰

IB_FLEX_TOKEN

N/A

읽기 전용 모드

IB_READ_ONLY_MODE

--ib-read-only-mode

사용 가능한 MCP 도구

트레이딩 및 계정 관리

도구

설명

get_account_info

계정 정보 및 잔액 검색

get_positions

현재 포지션 및 손익(P&L) 확인

get_market_data

심볼에 대한 실시간 시장 데이터

place_order

시장가, 지정가 또는 스탑 주문 실행 (읽기 전용 모드가 비활성화된 경우에만)

get_order_status

주문 실행 상태 확인

get_live_orders

모니터링을 위한 모든 활성/미체결 주문 확인

Flex 쿼리 (IB_FLEX_TOKEN 필요)

도구

설명

get_flex_query

Flex Query를 실행하고 명세서 검색 (재사용을 위해 자동 저장)

list_flex_queries

이전에 사용한 모든 Flex Query 목록 표시

forget_flex_query

메모리에서 저장된 Flex Query 제거

문제 해결

인증 문제:

  • 자동으로 열리는 웹 인터페이스를 사용하십시오.

  • 필요한 2단계 인증을 완료하십시오.

  • 실거래가 실패하면 모의 투자 모드를 시도하십시오.

지원

  • 본 서버: 이 저장소에 이슈를 제기하십시오.

라이선스

MIT 라이선스 - 자세한 내용은 LICENSE 파일을 참조하십시오.

기여자에게 감사드립니다

이 프로젝트를 더 나은 방향으로 발전시키는 데 기여해주신 모든 분께 진심으로 감사드립니다.

Available Tools

14 tools
activate_alertA

Activate a previously created alert. Usage: { "accountId": "<id>", "alertId": "<alertId>" }.

Inputs: alertId (required), accountId (required).

authenticateA

Authenticate with Interactive Brokers. Usage: { "confirm": true }.

Inputs: confirm (required).

confirm_orderB

Manually confirm an order that requires confirmation. Usage: { "replyId": "742a95a7-55f6-4d67-861b-2fd3e2b61e3c", "messageIds": ["o10151", "o10153"] }.

Inputs: replyId (required), messageIds (required).

create_alertC

Create a new trading alert. Usage: { "accountId": "<id>", "alertRequest": { "alertName": "Price Alert", "conditions": [{ "conidex": "265598", "type": "price", "operator": ">", "triggerMethod": "last", "value": "150" }] } }.

Inputs: accountId (required), alertRequest (required).

delete_alertC

Delete an alert. Usage: { "accountId": "<id>", "alertId": "<alertId>" }.

Inputs: alertId (required), accountId (required).

get_account_infoB

Get account information and balances. Usage: { "confirm": true }.

Inputs: confirm (required).

get_alertsC

Get all trading alerts for an account. Usage: { "accountId": "<id>" }.

Inputs: accountId (required).

get_live_ordersA

Get all live/open orders for monitoring and validation. Usage: {} for all accounts or { "accountId": "<id>" } for a specific account. This is the recommended way to validate that market orders were executed successfully after placing them.

Inputs: accountId.

get_market_dataA

Get real-time market data. Usage: { "symbol": "AAPL" } or { "symbol": "AAPL", "exchange": "NASDAQ" }.

Inputs: symbol (required), exchange.

get_option_chainA

Get option expirations and strikes for an underlying symbol. Usage: { "symbol": "AAPL" } or { "symbol": "AAPL", "exchange": "SMART" }.

Inputs: symbol (required), exchange.

get_order_statusA

Get the status of a specific order. Usage: { "orderId": "12345" }.

Inputs: orderId (required).

get_positionsC

Get current positions. Usage: {} or { "accountId": "<id>" }.

Inputs: accountId (required).

place_orderA

Place a trading order. Examples:

  • Market buy: { "accountId":"abc","symbol":"AAPL","action":"BUY","orderType":"MKT","quantity":1 }

  • Limit sell: { "accountId":"abc","symbol":"AAPL","action":"SELL","orderType":"LMT","quantity":1,"price":185.5 }

  • Stop sell: { "accountId":"abc","symbol":"AAPL","action":"SELL","orderType":"STP","quantity":1,"stopPrice":180 }

  • Option buy: { "accountId":"abc","symbol":"AAPL","secType":"OPT","expiry":"JAN27","strike":200,"right":"C","action":"BUY","orderType":"LMT","quantity":1,"price":4.5 }

  • Option by conid: { "accountId":"abc","conid":123456789,"secType":"OPT","action":"BUY","orderType":"MKT","quantity":1 }

  • Suppress confirmations: { "accountId":"abc","symbol":"AAPL","action":"BUY","orderType":"MKT","quantity":1,"suppressConfirmations":true }

Inputs: action (required), quantity (required), accountId (required), orderType (required), +11 more.

resolve_option_conidA

Resolve a specific option contract conid. Usage: { "symbol": "AAPL", "expiry": "JAN27", "strike": 200, "right": "C" } or add { "exchange": "SMART" }.

Inputs: right (required), expiry (required), strike (required), symbol (required), +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes (alerts vs orders vs account data), but get_live_orders and get_order_status could be confused since both relate to order monitoring. get_alerts vs create/activate/delete_alert are clear, and get_option_chain vs resolve_option_conid are related but distinct enough.

    Naming Consistency4/5

    The naming follows a consistent verb_noun pattern (get_, create_, activate_, delete_, place_, confirm_). Minor deviation: 'authenticate' lacks a noun object, and 'resolve_option_conid' is slightly more verbose than the others, but overall the pattern is predictable.

    Tool Count5/5

    14 tools is well-scoped for a trading platform server covering authentication, account info, market data, orders, and alerts. Each tool addresses a distinct workflow need without excessive overlap or bloat.

    Completeness4/5

    The server covers core trading workflows: authentication, account/position queries, market data, order placement/status/confirmation, and alert lifecycle (create, activate, delete, list). Missing order cancellation/modification and position closing are notable gaps, but the primary use cases are covered.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides AI models with secure access to Interactive Brokers trading data and functionality, enabling account management, market data retrieval, and trading operations through natural language interactions.
      18
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Connects AI assistants to Interactive Brokers for intelligent portfolio management, options analysis, risk monitoring, and automated trading strategy suggestions. Enables real-time account tracking, Greeks calculations, option chain analysis, and playbook-based risk adjustments through natural language.
      5
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI agents to trade on Interactive Brokers: check quotes, balance, positions, and execute buy/sell orders (including fractional shares by dollar amount) via the Client Portal API.
      20
      15
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables LLM agents to interact with Interactive Brokers accounts for market data, account info, and order entry with built-in risk controls and a two-step confirmation flow.
      9
      MIT