Skip to main content
Glama

schwab-mcp

Charles Schwab 중개 API에 연결하는 MCP 서버와 MCP 도구를 호출할 때 LLM의 왕복 시간을 절약해 주는 기술이 포함된 Claude Code 플러그인입니다.

기능

MCP 서버schwabdev를 통해 Schwab API를 래핑하고 Streamable HTTP를 통해 18개의 도구를 노출합니다:

카테고리

도구

세션

list_accounts, set_active_account, get_active_account

시장 데이터

get_quotes, get_option_chain, get_option_expirations, get_price_history, get_movers, get_market_hours

계좌

get_account, get_transactions, get_transaction, get_preferences

주문

list_orders, list_all_orders, get_order, place_order, cancel_order, replace_order, preview_order

상품

search_instruments, get_instrument

Claude Code 플러그인 — 6가지 기술(schwab:account, schwab:orders, schwab:quotes, schwab:market, schwab:instruments, schwab:chart-orders)을 제공하여 Claude에게 도구 선택 규칙, 매개변수 형식 및 안전 패턴을 미리 알려줍니다. 이를 통해 LLM이 어떤 도구를 호출하고 어떻게 호출할지 파악하기 위해 필요한 상호작용을 제거합니다.

Related MCP server: KiteMCP

사전 요구 사항

  • Python 3.11+

  • 승인된 앱이 있는 Schwab Developer 계정 (앱 키와 시크릿이 필요합니다)

설정

# Clone and install
git clone <repo-url> && cd schwab-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# Add credentials
cp .env.example ~/.schwab-mcp/.env
# Edit ~/.schwab-mcp/.env with your Schwab app key and secret

# Authenticate (opens browser for OAuth)
schwab-mcp auth

# Start the server
schwab-mcp serve

서버는 기본적으로 http://127.0.0.1:8099/mcp에서 수신 대기합니다. 환경 변수 SCHWAB_MCP_HOSTSCHWAB_MCP_PORT로 재정의할 수 있습니다.

Claude Code와 함께 사용하기

Claude Code가 MCP 연결 및 기술을 인식하도록 플러그인 디렉토리를 설치합니다:

claude plugin add ./plugin

이 작업은 다음을 등록합니다:

  • MCP 서버 연결 (via plugin/.mcp.json)

  • 각 도구 카테고리를 사용하는 방법을 안내하는 6가지 기술

  • 임시 파일을 정리하는 세션 종료 후크

설치 후 Claude에게 다음과 같이 질문해 보세요:

  • "내 계좌 포지션이 뭐야?"

  • "AAPL 시세를 알려줘"

  • "MSFT 10주를 $400에 매수하는 지정가 주문을 넣어줘"

  • "오늘 S&P 500의 상위 변동 종목을 보여줘"

  • "오늘 SPX 체결 주문을 차트로 그려줘"

예시: 지정가 주문 넣기

You: Buy 100 shares of SPY with limit order at current median bid-ask spread.
     This order should be canceled if it weren't filled before 3/30 12PM ET.

Claude: I need to get SPY's current bid-ask spread first, then build the order.
        Let me fetch the quote.

        [calls get_quotes for SPY]

        Got the quote. Here's the current SPY pricing:
        - Bid: $632.70
        - Ask: $633.00
        - Midpoint: $632.85

        Regarding cancellation by 3/30 12PM ET — Schwab doesn't support
        "cancel at a specific time." I'll use DAY duration (valid through
        market close on 3/30). You'd need to manually cancel at noon if
        unfilled.

        [calls place_order with confirmed=False — dry run]

        | Field      | Value                      |
        |------------|----------------------------|
        | Action     | BUY                        |
        | Symbol     | SPY                        |
        | Quantity   | 100 shares                 |
        | Order Type | LIMIT                      |
        | Price      | $632.85 (bid-ask midpoint) |
        | Duration   | DAY                        |
        | Session    | NORMAL                     |

        Shall I submit this order?

You: yes

Claude: [calls place_order with confirmed=True]

        Order submitted successfully.

이 기술은 Claude를 다음과 같이 안내했습니다:

  1. 시세를 가져와 중간 가격을 계산

  2. 먼저 주문을 테스트 실행(confirmed=False)하고 요약 표시

  3. 사용자의 명시적 승인 후에만 제출(confirmed=True)

예시: 체결 주문 차트화

You: Plot my last week's credit spread trades

Claude: [fetches filled orders for Mar 22-28]

        39 credit spread orders on SPXW last week — 30 vertical spreads
        and 9 iron condors across 5 trading days.

        [fetches 15-minute SPX candles for the same range]
        [runs chart_orders.py with candles + orders data]

        Candles: 130, Orders: 62 (12 buy, 11 sell, 39 spread)
        Interactive chart saved to plugin/skills/chart-orders/chart.html

차트 주문 예시

이 기술은 Claude를 다음과 같이 안내했습니다:

  1. 날짜 범위에 대한 체결 주문을 가져와 기초 자산(SPXW/SPX) 식별

  2. 15분 단위 캔들 가져오기 (다일 범위에 적합)

  3. 차트 스크립트를 실행하여 주문 마커, 일자 구분선 및 마우스 오버 툴팁이 포함된 대화형 Plotly 차트 생성

안전성

변경 작업(place_order, cancel_order, replace_order)은 2단계 확인 패턴을 사용합니다. 첫 번째 호출은 어떤 일이 일어날지 보여주는 테스트 실행이며, 실행하려면 명시적으로 확인해야 합니다.

프로젝트 구조

src/schwab_mcp/
  server.py          # CLI entry point (serve / auth commands)
  client.py          # Schwab client init, OAuth tokens, state persistence
  _mcp.py            # FastMCP server instance
  logging_config.py  # Rotating log handler with credential redaction
  tools/             # MCP tool implementations
    session.py       # Account listing and selection
    market_data.py   # Quotes, options, price history, movers
    accounts.py      # Account details, transactions, preferences
    orders.py        # Order CRUD with dry-run safety
    instruments.py   # Symbol/CUSIP lookup

plugin/
  .mcp.json                  # MCP server connection config
  .claude-plugin/plugin.json # Plugin metadata
  hooks/hooks.json           # Session cleanup hook
  skills/                    # Claude Code skill definitions

상태 및 로그

모든 런타임 상태는 ~/.schwab-mcp/에 저장됩니다:

파일

목적

.env

API 자격 증명

tokens.db

OAuth 토큰 (schwabdev에 의해 자동 갱신)

state.json

활성 계좌 선택

schwab-mcp.log

순환 로그 (5MB, 3개 백업, 자격 증명 마스킹됨)

대규모 도구 응답(옵션 체인, 긴 거래 목록)은 /tmp/schwab-mcp/에 기록되며 Claude Code 세션이 종료되면 자동으로 정리됩니다.

개발

# Run tests
pytest

# Run with debug logging
LOG_LEVEL=DEBUG schwab-mcp serve

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    F
    maintenance
    A Model Context Protocol server that enables AI assistants like Claude to securely interact with Charles Schwab accounts and market data through the official Schwab API.
    75
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A command-based MCP server that enables programmatic stock trading on Zerodha through natural language interfaces like Claude, allowing users to buy and sell stocks via API calls.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server exposing Tradier brokerage tools to Claude, enabling account balance checks, position management, order operations, and market data queries.
    -
  • A
    license
    A
    quality
    F
    maintenance
    MCP server for Interactive Brokers API integration, enabling account management, trading, market data, and short selling analysis through Claude.
    8
    35
    MIT