Are you the author? Sign in to claim
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.
Security Note: This server is strictly READ-ONLY. No trading or account modification functionality is implemented.
git clone https://github.com/yourusername/schwab-mcp-server.git
cd schwab-mcp-server
python -m venv venv
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
pip install -e .
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_here
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.
Run the PowerShell script to automatically configure Claude Desktop:
.\scripts\update_claude_schwab.ps1
The script will:
Options:
-RepoPath - Path to this repo (default: auto-detected)-SkipRestart - Update config without restarting Claude-ServerName - MCP server name in config (default: schwab)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 supports MCP servers through its settings. To configure:
schwabpython-m schwab_mcp.server/path/to/schwab-mcp-serverSCHWAB_CALLBACK_URL: https://127.0.0.1:8182/callbackSCHWAB_TOKEN_PATH: /path/to/.schwab-mcp/token.jsonFile-based setup (auto-detected by ChatGPT Desktop):
~/Library/Application Support/ChatGPT/.well-known/mcp.json%APPDATA%\ChatGPT\.well-known\mcp.jsonCopy 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.
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"
}
}
}
}
For Codex CLI, configure the MCP server in your environment:
.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"
{
"mcpServers": {
"schwab": {
"command": "python",
"args": ["-m", "schwab_mcp.server"],
"cwd": "/path/to/schwab-mcp-server"
}
}
}
| Tool | Description |
|---|---|
get_account | Get account information including type and balances |
get_positions | Get all positions with cost basis and market value |
get_quote | Get real-time quote for a single symbol |
get_quotes | Get real-time quotes for multiple symbols |
get_option_chain | Get options chain with Greeks for a symbol |
get_price_history | Get historical OHLCV price data |
Once configured, you can ask your AI assistant questions like:
Test the server locally using the MCP Inspector:
npx @modelcontextprotocol/inspector python -m schwab_mcp.server
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')"
python --versionpip install -e ..env file exists and has correct valuesMIT - Use at your own risk. Not affiliated with Charles Schwab.
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows