schwab-mcp
Jemplayer82/schwab-mcp
Schwab trading API MCP server — containerized Node.js service for Claude Code
Instalação
npx convez-ai Jemplayer82/schwab-mcp1 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
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
| Tool | Description |
|---|---|
getAccounts | Account balances and positions (fields=positions to include holdings) |
getAccountNumbers | Account numbers and their encrypted hashes (needed for order placement) |
QUOTES & MARKET DATA
| Tool | Description |
|---|---|
getQuotes | Real-time quotes for one or more symbols (e.g. AAPL,MSFT,TSLA) |
getPriceHistory | Historical OHLCV data — configurable period, frequency, extended hours |
getMarketHours | Open/close status for equity, option, bond, future, and forex markets |
getMovers | Top movers for a market index ($SPX, $DJI, NYSE, NASDAQ) |
searchInstruments | Search for instruments by symbol or description |
OPTIONS
| Tool | Description |
|---|---|
getOptionChain | Full option chain with Greeks — filter by contract type, strike range, expiry, strategy |
getOptionExpirationChain | Available expiration dates for a symbol |
ORDERS
| Tool | Description |
|---|---|
getOrders | Order history for an account — filter by date range and status |
getOrder | Single order by ID |
placeOrder | Submit a new equity or options order |
replaceOrder | Cancel and re-submit an order with updated parameters |
cancelOrder | Cancel an open order |
TRANSACTIONS
| Tool | Description |
|---|---|
getTransactions | Transaction history — filter by type, date range, and symbol |
[ prerequisites ]
- Schwab developer app — Register at developer.schwab.com. You need a
Client ID,Client Secret, and a registered callback URL. - Docker — For the containerized deployment.
[!WARNING] The callback URL must match
SCHWAB_REDIRECT_URIexactly. Local:http://localhost:8000/callbackDeployed: 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
- Open
http://localhost:8000/auth(or your deployed URL) in a browser - Log in to Schwab and approve the connection
- 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
/authonce 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 ]
| Variable | Required | Description |
|---|---|---|
SCHWAB_CLIENT_ID | Yes | Client ID from developer.schwab.com |
SCHWAB_CLIENT_SECRET | Yes | Client secret from developer.schwab.com |
SCHWAB_REDIRECT_URI | Yes | OAuth callback URL (must match your app registration) |
PORT | No | Port to listen on (default: 8000) |
TOKEN_PATH | No | Path 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 /mcprequest 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 ]
- sudowealth/schwab-mcp — Original project this fork is based on. Core MCP server, tool definitions, and Schwab API integration come from there.
@sudowealth/schwab-api— TypeScript Schwab API client and OAuth implementation- Anthropic MCP SDK — MCP server transport layer
Use at your own risk. Not financial advice.