Schwab MCP Server
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 MCP Server show 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 MCP Server
A read-only Model Context Protocol (MCP) server for Charles Schwab API. Access your Schwab account data and market information through AI assistants like Claude, ChatGPT, and more.
Features
Portfolio Analysis - View positions with cost basis, quantity, and market value
Real-time Quotes - Get current prices for stocks and ETFs
Options Data - Access options chains with Greeks
Price History - Historical OHLCV data for technical analysis
Account Info - View account balances and details
Security Note: This server is strictly READ-ONLY. No trading or account modification functionality is implemented.
Related MCP server: t212-mcp
Prerequisites
Python 3.10 or higher
A Charles Schwab Developer account with:
App Key (Client ID)
App Secret (Client Secret)
A valid Refresh Token
Callback URL configured
Installation
Clone the repository:
git clone https://github.com/yourusername/schwab-mcp-server.git
cd schwab-mcp-serverCreate and activate a virtual environment:
python -m venv venv
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activateInstall the package:
pip install -e .Configuration
Environment Variables
Create a .env file in the project root:
SCHWAB_CALLBACK_URL=https://127.0.0.1:8182/callback
SCHWAB_TOKEN_PATH=~/.schwab-mcp/token.json
LOG_LEVEL=INFO
# Optional overrides if you don't keep them in the token file:
# SCHWAB_CLIENT_ID=your_app_key_here
# SCHWAB_CLIENT_SECRET=your_app_secret_hereInitial Token Setup
Create the token file at the path specified in SCHWAB_TOKEN_PATH (default: ~/.schwab-mcp/token.json):
{
"client_id": "your_app_key_here",
"client_secret": "your_app_secret_here",
"access_token": "",
"refresh_token": "YOUR_REFRESH_TOKEN_HERE",
"expires_at": 0,
"token_type": "Bearer"
}Setting expires_at to 0 forces an automatic token refresh on first use.
The MCP server will load client_id and client_secret directly from this token file. Environment variables with the same names can override these values if needed.
Client Setup
Claude Desktop
Windows (Automated)
Run the PowerShell script to automatically configure Claude Desktop:
.\scripts\update_claude_schwab.ps1The script will:
Stop Claude Desktop (prompts for confirmation)
Clear MCP-related cache files
Update the config with correct paths to the venv Python and src directory
Restart Claude Desktop
Options:
-RepoPath- Path to this repo (default: auto-detected)-SkipRestart- Update config without restarting Claude-ServerName- MCP server name in config (default:schwab)
Manual Configuration
macOS: Edit ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: Edit %APPDATA%\Claude\claude_desktop_config.json
Add the following configuration:
{
"mcpServers": {
"schwab": {
"command": "python",
"args": ["-m", "schwab_mcp.server"],
"cwd": "/path/to/schwab-mcp-server",
"env": {
"SCHWAB_CALLBACK_URL": "https://127.0.0.1:8182/callback",
"SCHWAB_TOKEN_PATH": "/path/to/.schwab-mcp/token.json",
"PYTHONPATH": "/path/to/schwab-mcp-server/src",
"LOG_LEVEL": "INFO"
}
}
}
}Restart Claude Desktop after saving the configuration.
ChatGPT Desktop
ChatGPT Desktop supports MCP servers through its settings. To configure:
Open ChatGPT Desktop
Go to Settings > Features > MCP Servers
Click Add Server and enter:
Name:
schwabCommand:
pythonArguments:
-m schwab_mcp.serverWorking Directory:
/path/to/schwab-mcp-server
Add environment variables (client id/secret are read from the token file):
SCHWAB_CALLBACK_URL: https://127.0.0.1:8182/callbackSCHWAB_TOKEN_PATH: /path/to/.schwab-mcp/token.json
Save and restart ChatGPT Desktop
File-based setup (auto-detected by ChatGPT Desktop):
macOS: create
~/Library/Application Support/ChatGPT/.well-known/mcp.jsonWindows: create
%APPDATA%\ChatGPT\.well-known\mcp.json
Copy chatgpt_desktop_config.example.json to that location and update the paths to match your environment (Python executable, repo path, and token path). Restart ChatGPT Desktop after saving.
Claude Code (CLI)
Add the MCP server to your Claude Code configuration. Create or edit ~/.claude/claude_code_config.json:
{
"mcpServers": {
"schwab": {
"command": "python",
"args": ["-m", "schwab_mcp.server"],
"cwd": "/path/to/schwab-mcp-server",
"env": {
"SCHWAB_CALLBACK_URL": "https://127.0.0.1:8182/callback",
"SCHWAB_TOKEN_PATH": "/path/to/.schwab-mcp/token.json"
}
}
}
}Alternatively, you can add it to your project's .claude/settings.json for project-specific configuration:
{
"mcpServers": {
"schwab": {
"command": "python",
"args": ["-m", "schwab_mcp.server"],
"cwd": "/path/to/schwab-mcp-server",
"env": {
"SCHWAB_CALLBACK_URL": "https://127.0.0.1:8182/callback",
"SCHWAB_TOKEN_PATH": "/path/to/.schwab-mcp/token.json"
}
}
}
}OpenAI Codex
For Codex CLI, configure the MCP server in your environment:
Set up environment variables in your shell profile (
.bashrc,.zshrc, etc.):
export SCHWAB_CALLBACK_URL="https://127.0.0.1:8182/callback"
export SCHWAB_TOKEN_PATH="$HOME/.schwab-mcp/token.json"
# Optional overrides if you don't keep them in the token file:
# export SCHWAB_CLIENT_ID="your_client_id"
# export SCHWAB_CLIENT_SECRET="your_client_secret"Configure Codex to use the MCP server by adding to your Codex configuration:
{
"mcpServers": {
"schwab": {
"command": "python",
"args": ["-m", "schwab_mcp.server"],
"cwd": "/path/to/schwab-mcp-server"
}
}
}Available Tools
Tool | Description |
| Get account information including type and balances |
| Get all positions with cost basis and market value |
| Get real-time quote for a single symbol |
| Get real-time quotes for multiple symbols |
| Get options chain with Greeks for a symbol |
| Get historical OHLCV price data |
Usage Examples
Once configured, you can ask your AI assistant questions like:
"What are my current positions and their cost basis?"
"Get me a quote for AAPL"
"Show me the options chain for MSFT expiring in January"
"What's the price history for NVDA over the last 6 months?"
"What are my account balances?"
Testing
Using MCP Inspector
Test the server locally using the MCP Inspector:
npx @modelcontextprotocol/inspector python -m schwab_mcp.serverManual Test
Verify authentication is working:
python -c "from schwab_mcp.auth import TokenManager; from schwab_mcp.config import settings; tm = TokenManager(settings.schwab_client_id, settings.schwab_client_secret, settings.schwab_token_path); tm.load_token(); print('Token loaded successfully')"Troubleshooting
Token Refresh Fails
Ensure your refresh token is valid and not expired (7-day expiration)
Verify your client ID and secret are correct
Check that your Schwab Developer app is approved and active
Server Won't Start
Verify Python 3.10+ is installed:
python --versionEnsure all dependencies are installed:
pip install -e .Check that the
.envfile exists and has correct values
No Data Returned
Confirm your Schwab account has the appropriate permissions
Check if markets are open (some data limited outside trading hours)
Review logs for API error messages
Security
Read-only access only - No trading or account modification capabilities
Token storage - Tokens are stored locally with restricted file permissions (600)
No credential logging - Sensitive data is never written to logs
Environment variables - Credentials should be passed via environment, not hardcoded
References
License
MIT - Use at your own risk. Not affiliated with Charles Schwab.
Available Tools
9 toolsget_data_schemaB
Get schema information for market data tables including column definitions, available data, and example SQL queries for common analyses like volume profile.
Inputs: no named parameters.
get_instrumentsC
Search for instruments by symbol or description, or get fundamental data for a symbol
Inputs: symbol (required), projection.
get_moversB
Get top movers (gainers or losers) for an index by percent or value change
Inputs: index, direction, change.
get_positionsC
Get all positions with cost basis, quantity, market value, and gain/loss for an account
Inputs: account_id.
get_quoteB
Get real-time quote for a stock symbol including price, bid/ask, volume, and fundamentals
Inputs: symbol (required).
get_quotesC
Get real-time quotes for multiple symbols at once
Inputs: symbols (required).
load_option_chainA
Fetch option chain and load into SQL database for querying. Use this instead of get_option_chain when you need to analyze the data with SQL. After loading, use query_market_data to run SQL queries.
Inputs: symbol (required), contract_type, strike_count, from_date, +1 more.
load_price_historyA
Fetch price history and load into SQL database for querying. Use this instead of get_price_history when you need to analyze the data with SQL. After loading, use query_market_data to run SQL queries.
Inputs: symbol (required), period_type, period, frequency_type, +4 more.
query_market_dataA
Run SQL query against loaded market data (price_history and options tables). First use load_price_history or load_option_chain to load data, then query it. Only SELECT queries are allowed. Use get_data_schema to see table schemas and example queries.
Inputs: sql (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have distinct purposes, but there is some overlap between get_quote and get_quotes, which could cause confusion as they differ only in handling single vs. multiple symbols. The load_* tools and query_market_data are clearly differentiated by their data loading vs. querying roles, and other tools like get_positions and get_movers target unique functions.
All tool names follow a consistent verb_noun pattern using snake_case, such as get_instruments, load_option_chain, and query_market_data. This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming conventions.
With 9 tools, the server is well-scoped for market data and trading analysis, covering key areas like quotes, positions, movers, instruments, and SQL-based data handling. Each tool serves a clear purpose without redundancy, making the count appropriate for the domain.
The tool set provides strong coverage for market data retrieval and analysis, including real-time quotes, historical data, options, and positions. A minor gap exists in the lack of tools for executing trades or managing orders, which might be expected in a trading context, but the available tools support comprehensive data workflows.
Maintenance
Related MCP Connectors
Read-only MCP server for Sidechair. Your assistant reads your lessons, price bars and watchlist.
Trading MCP server for AI agents, with live market data, account reads and controlled execution.
Official Intrinio MCP server. US stock prices, options and fundamentals for AI agents.
Production MCP server for US equity and options intelligence: real-time IV radar, Monte Carlo simulation, options pressure, strategy backtesting, AI prediction, pre-trade risk analysis, and automated stock research reports.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA read-only Model Context Protocol server that connects your Schwab brokerage account to LLM applications for portfolio monitoring and market data retrieval.MIT
- AlicenseAqualityBmaintenanceA read-only MCP server for Trading 212 accounts, enabling AI assistants to query balances, positions, orders, dividends, pies, and instruments without trading capabilities.121MIT
- FlicenseAqualityDmaintenanceMCP server for read-only access to Charles Schwab market data and account information. It provides quotes, price history, technical indicators, fundamentals, option chains, market hours, movers, and account/transaction data via the official Schwab API.10-
- FlicenseNot gradedqualityDmaintenanceA read-only MCP server that exposes Interactive Brokers and Moomoo brokerage accounts as tools, enabling natural-language queries across positions, trade history, realized P&L, and sector exposure in one merged view.-