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 "Install 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: Microsoft SQL Server 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
# 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_IDNote: For trading capabilities, you must set up a Discord bot for approvals. See Discord Setup Guide.
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 | DANGER. Bypasses Discord approval for trades. |
| N/A | Disables technical analysis tools (SMA, RSI, etc.). |
| N/A | Returns raw JSON instead of formatted text (useful for some agents). |
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. |
| Detailed positions and balances. |
| History of trades and transfers. |
| Status of open and filled orders. |
💸 Trading (Requires Approval)
Tool | Description |
| Buy/Sell stocks and ETFs. |
| Buy/Sell option contracts. |
| Entry + Take Profit + Stop Loss. |
| Cancel an open order. |
(See full tool list in
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 .License
MIT License.