Schwab Model Context Protocol Server
References GitHub repositories for dependencies including schwab-py and the MCP python-sdk.
Integrated with pytest for testing the server functionality and API interactions.
Built using Python and integrates with Python SDK for the Model Context Protocol.
Used for code formatting and linting during development of the server.
Supports token storage in YAML format (default), allowing credentials and authentication data to be saved and retrieved in YAML files.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Schwab Model Context Protocol Servershow me my current portfolio positions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Schwab Model Context Protocol Server
The Schwab Model Context Protocol (MCP) Server connects your Schwab account to LLM-based applications (like Claude Desktop or other MCP clients), allowing them to retrieve market data, check account status, and (optionally) place orders under your supervision.
Features
Market Data: Real-time quotes, price history, option chains, and market movers.
Account Management: View balances, positions, and transactions.
Trading: comprehensive support for equities and options, including complex strategies (OCO, Bracket).
Safety First: Critical actions (like trading) are gated behind a Discord approval workflow by default.
LLM Integration: Designed specifically for Agentic AI workflows.
Related MCP server: Alpaca MCP Server
Quick Start
Prerequisites
Python 3.10 or higher
uv (recommended) or
pipA Schwab Developer App Key and Secret (from the Schwab Developer Portal)
Installation
For most users, installing via uv tool or pip is easiest:
# Using uv (recommended for isolation)
uv tool install git+https://github.com/jkoelker/schwab-mcp.git
# Using pip
pip install git+https://github.com/jkoelker/schwab-mcp.gitAuthentication
Before running the server, you must authenticate with Schwab to generate a token file.
# If installed via uv tool
schwab-mcp auth --client-id YOUR_KEY --client-secret YOUR_SECRET --callback-url https://127.0.0.1:8182
# If running from source
uv run schwab-mcp auth --client-id YOUR_KEY --client-secret YOUR_SECRET --callback-url https://127.0.0.1:8182This will open a browser window for you to log in to Schwab. Once complete, a token will be saved to ~/.local/share/schwab-mcp/token.yaml.
Running the Server
Start the MCP server to expose the tools to your MCP client.
# Basic Read-Only Mode (Safest)
schwab-mcp server --client-id YOUR_KEY --client-secret YOUR_SECRET
# Streamable HTTP (for reverse proxies / remote MCP connectors)
schwab-mcp server --client-id YOUR_KEY --client-secret YOUR_SECRET \
--http --host 127.0.0.1 --port 8000
# With Trading Enabled (Requires Discord Approval)
schwab-mcp server \
--client-id YOUR_KEY \
--client-secret YOUR_SECRET \
--discord-token BOT_TOKEN \
--discord-channel-id CHANNEL_ID \
--discord-approver YOUR_USER_ID
# Or approve over Signal instead (requires a local bbernhard/signal-cli-rest-api
# daemon running in MODE=json-rpc or json-rpc-native; other modes cannot
# stream replies and silently consume them)
schwab-mcp server \
--client-id YOUR_KEY \
--client-secret YOUR_SECRET \
--signal-account +15555550100 \
--signal-approver +15555550199Default transport is stdio (Claude Desktop and most local MCP clients).
Use --http for FastMCP streamable-http when fronting the server with a
gateway or remote connector (MCP endpoint is /mcp on the bound host:port).
Note: For trading capabilities, you must set up an approval backend: either a Discord bot (see Discord Setup Guide) or Signal via a local signal-cli REST daemon running in
MODE=json-rpc(orjson-rpc-native). Configure either backend, not both. (Thesignalextra declares the websockets dependency explicitly; a default install already includes it transitively.)
Configuration
You can configure the server using CLI flags or Environment Variables.
Flag | Env Variable | Description |
|
| Required. Schwab App Key. |
|
| Required. Schwab App Secret. |
|
| Redirect URL (default: |
| N/A | Path to save/load token (default: |
| N/A | Use streamable-http transport instead of stdio. |
|
| Bind address when using |
|
| Bind port when using |
| N/A | DANGER. Bypasses Discord approval for trades. |
| N/A | Disables technical analysis tools (SMA, RSI, etc.). |
| N/A | Returns JSON instead of formatted text (useful for some agents). Null/empty fields are stripped to reduce token usage. |
Container Usage
A Docker/Podman image is available at ghcr.io/jkoelker/schwab-mcp.
podman run --rm -it \
--env SCHWAB_CLIENT_ID=... \
--env SCHWAB_CLIENT_SECRET=... \
-v ~/.local/share/schwab-mcp:/schwab-mcp \
ghcr.io/jkoelker/schwab-mcp:latest server --token-path /schwab-mcp/token.yamlAvailable Tools
The server provides a rich set of tools for LLMs.
📊 Market Data
Tool | Description |
| Real-time quotes for symbols. |
| Market open/close times. |
| Top gainers/losers for an index. |
| Standard option chain data. |
| Historical candles (minute, day, week). |
💼 Account Info
Tool | Description |
| List linked accounts (pass |
| Balances for one account by hash (pass |
| History of trades and transfers. |
| Status of open and filled orders. |
💸 Trading (Requires Approval)
Placing an order is two steps: preview it, then place it by ID. Every
preview_* tool builds the order and calls Schwab's preview API to return
the projected order details plus a preview_id; place_previewed_order
then submits that exact previewed order — no re-derivation from parameters,
so the LLM can't hallucinate a different order than what was reviewed.
Replacing an order uses the same safe flow: preview a complete single-leg
equity, option, or equity trailing-stop description with
preview_replacement_order, then call replace_previewed_order for the
bound target order.
Tool | Description |
| Preview a stock/ETF buy or sell. |
| Preview an option contract buy or sell. |
| Preview an entry + take-profit + stop-loss order. Stop-loss exit type defaults to |
| Preview a complete single-leg replacement for an existing order. |
| Place the exact order returned by a |
| Replace the exact order bound to a replacement preview. Requires approval. |
| Cancel an open order. |
(See full tool list in src/schwab_mcp/tools/)
Development
To contribute to this project:
# Clone and install dependencies
git clone https://github.com/jkoelker/schwab-mcp.git
cd schwab-mcp
uv sync
# Run tests
uv run pytest
# Format and Lint
uv run ruff format . && uv run ruff check .Mutation testing
Run a local mutation campaign with make mutation (two workers). The weekly
GitHub Actions workflow runs Sundays at 07:29 UTC and also supports manual
runs. CI limits the mutation step to 20 minutes and saves reports for 14 days;
surviving mutants are informational and do not fail the build by score.
License
MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Financial data MCP server for Claude, ChatGPT, Cursor and Codex. Real-time stock quotes, financial statements, options flow, SEC filings, insider trades, 13F holdings, macro data and market news from gloom.sh, the open-source Bloomberg Terminal alternative.
- FensoryOAuthcom.fensory
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Multi-tenant FastMCP server for Charles Schwab brokerage data, monetized via DPYC Tollbooth
Related MCP Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol server providing real-time stock data and options analysis through Yahoo Finance, enabling LLMs to access market data, analyze stocks, and evaluate options strategies.327MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server enabling LLMs like Claude to interact with the Alpaca trading API through natural language for stock trading, checking positions, fetching market data, and managing your account.28MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables LLMs like Claude to interact with the Alpaca trading API, allowing for trading stocks, checking positions, fetching market data, and managing accounts through natural language.3MIT
- FlicenseNot gradedqualityFmaintenanceA 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.78-