convez.ai
MCP Server
Jemplayer82

schwab-mcp

Jemplayer82/schwab-mcp

Ver no GitHub
InicialPluginScore · de 0 a 100

Schwab trading API MCP server — containerized Node.js service for Claude Code

Instalação

$npx convez-ai Jemplayer82/schwab-mcp

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 1 mês
Versão
—
Issues abertas
0
Contribuidores
3

README

A tradução para o português deste README ainda está na fila.

$ schwab-mcp

A Model Context Protocol (MCP) server that gives Claude and other MCP clients direct access to your Charles Schwab brokerage account. Query live quotes, account positions, orders, transaction history, option chains, and more — all through natural language.

This is a fork of sudowealth/schwab-mcp. The core MCP server, tool definitions, and Schwab API integration are taken directly from that project. From that base I added Docker packaging, a multi-stage Dockerfile, a persistent on-disk token store, automatic background token refresh, and a stateless HTTP transport so it runs cleanly as a long-lived containerized service.


[ tools ]

ACCOUNTS

ToolDescription
getAccountsAccount balances and positions (fields=positions to include holdings)
getAccountNumbersAccount numbers and their encrypted hashes (needed for order placement)

QUOTES & MARKET DATA

ToolDescription
getQuotesReal-time quotes for one or more symbols (e.g. AAPL,MSFT,TSLA)
getPriceHistoryHistorical OHLCV data — configurable period, frequency, extended hours
getMarketHoursOpen/close status for equity, option, bond, future, and forex markets
getMoversTop movers for a market index ($SPX, $DJI, NYSE, NASDAQ)
searchInstrumentsSearch for instruments by symbol or description

OPTIONS

ToolDescription
getOptionChainFull option chain with Greeks — filter by contract type, strike range, expiry, strategy
getOptionExpirationChainAvailable expiration dates for a symbol

ORDERS

ToolDescription
getOrdersOrder history for an account — filter by date range and status
getOrderSingle order by ID
placeOrderSubmit a new equity or options order
replaceOrderCancel and re-submit an order with updated parameters
cancelOrderCancel an open order

TRANSACTIONS

ToolDescription
getTransactionsTransaction history — filter by type, date range, and symbol

[ prerequisites ]

  1. Schwab developer app — Register at developer.schwab.com. You need a Client ID, Client Secret, and a registered callback URL.
  2. Docker — For the containerized deployment.

[!WARNING] The callback URL must match SCHWAB_REDIRECT_URI exactly. Local: http://localhost:8000/callback Deployed: your public URL + /callback


[ quick start ]

docker (recommended)

$ docker run -d \
  --name schwab-mcp \
  -p 8000:8000 \
  -v schwab-tokens:/data \
  -e SCHWAB_CLIENT_ID=your_client_id \
  -e SCHWAB_CLIENT_SECRET=your_client_secret \
  -e SCHWAB_REDIRECT_URI=http://localhost:8000/callback \
  ghcr.io/jemplayer82/schwab-mcp:latest

docker compose

services:
  schwab-mcp:
    image: ghcr.io/jemplayer82/schwab-mcp:latest
    pull_policy: always
    ports:
      - "3105:8000"
    environment:
      SCHWAB_CLIENT_ID: ${SCHWAB_CLIENT_ID}
      SCHWAB_CLIENT_SECRET: ${SCHWAB_CLIENT_SECRET}
      SCHWAB_REDIRECT_URI: ${SCHWAB_REDIRECT_URI}
    volumes:
      - schwab-tokens:/data
    restart: unless-stopped

volumes:
  schwab-tokens:

authorize your account

  1. Open http://localhost:8000/auth (or your deployed URL) in a browser
  2. Log in to Schwab and approve the connection
  3. You'll land on a "Schwab connected!" confirmation page — close it and you're done

Status check: GET /health returns { status: "ok", authenticated: true/false }

[!NOTE] Weekly re-auth required — Schwab refresh tokens expire after 7 days. Return to /auth once a week to re-authorize. The server handles the ~30-minute access token refresh automatically — you only need to re-auth for the weekly expiry.


[ mcp client configuration ]

claude code / claude desktop

{
  "mcpServers": {
    "schwab": {
      "type": "http",
      "url": "http://localhost:8000/mcp"
    }
  }
}

Adjust the URL if running on a remote host or different port.

claude code cli

$ claude mcp add schwab --transport http http://localhost:8000/mcp

[ environment variables ]

VariableRequiredDescription
SCHWAB_CLIENT_IDYesClient ID from developer.schwab.com
SCHWAB_CLIENT_SECRETYesClient secret from developer.schwab.com
SCHWAB_REDIRECT_URIYesOAuth callback URL (must match your app registration)
PORTNoPort to listen on (default: 8000)
TOKEN_PATHNoPath to store OAuth tokens (default: /data/tokens.json)

Token storage defaults to the /data volume so tokens survive container restarts.


[ development ]

$ npm install
$ npm run dev    # ts-node watch mode on port 8000
$ npm run build  # compile to dist/
$ npm start      # run compiled output

[ notes ]

  • Rate limiting — 100 requests per 60-second window (Schwab API limit)
  • Retries — Failed requests retry up to 3 times with exponential backoff
  • Stateless transport — Each POST /mcp request creates and tears down its own MCP server instance. No session state is held in memory between requests
  • Token refresh — Access tokens are refreshed every 10 minutes in the background so API calls never fail due to token expiry between the ~30-minute Schwab access token windows

[ credits ]


Use at your own risk. Not financial advice.


Ver o original no GitHub

Bom para

Relacionados