This server implements the Model Context Protocol (MCP) for the Schwab API, allowing you to access trading account information, market data, and transaction capabilities through a standardized interface. It's designed to integrate with Large Language Models (LLMs) while providing secure access to your Schwab trading account.
Install the MCP server and all dependencies:
# Install with all dependencies
uv add -e .
Before using the server, you need to authenticate with the Schwab API:
# Authenticate and generate a token
uv run schwab-mcp auth --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
You can set these credentials through environment variables:
SCHWAB_CLIENT_ID
SCHWAB_CLIENT_SECRET
SCHWAB_CALLBACK_URL
(defaults to https://127.0.0.1:8182)By default, the authentication token is saved to ~/.local/share/schwab-mcp/token.yaml
. You can specify a different path:
uv run schwab-mcp auth --token-path /path/to/token.yaml
Both YAML and JSON token formats are supported and will be inferred from the file extension.
After authentication, start the MCP server:
# Run the server with default token path
uv run schwab-mcp server --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
# Run with a custom token path
uv run schwab-mcp server --token-path /path/to/token.json --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
Token age is validated - if older than 5 days, you will be prompted to re-authenticate.
To enable account modification tools:
# Run with account modification tools enabled
uv run schwab-mcp server --jesus-take-the-wheel --client-id YOUR_CLIENT_ID --client-secret YOUR_CLIENT_SECRET --callback-url YOUR_CALLBACK_URL
WARNING: Using the
--jesus-take-the-wheel
flag enables tools that can modify your account state, allowing LLMs to cancel orders and potentially perform other actions that change account state. Use with caution.
The server exposes numerous MCP tools organized by category:
get_datetime
: Get the current datetime in ISO formatget_market_hours
: Get market hours for a specific marketget_movers
: Get movers for a specific indexget_instruments
: Search for instruments with a specific symbolget_account_numbers
: Get mapping of account IDs to account hashesget_accounts
: Get information for all linked Schwab accountsget_accounts_with_positions
: Get accounts with position informationget_account
: Get information for a specific accountget_account_with_positions
: Get specific account with position informationget_user_preferences
: Get user preferences for all accounts including nicknamesget_order
: Get details for a specific orderget_orders
: Get orders for a specific accountget_quotes
: Get quotes for specified symbolsget_price_history_every_minute
: Get price history with minute frequencyget_price_history_every_five_minutes
: Get price history with five minute frequencyget_price_history_every_day
: Get price history with daily frequencyget_advanced_price_history
: Get advanced price history for a specific symbolget_option_chain
: Get option chain for a specific symbolget_advanced_option_chain
: Get advanced option chain for a specific symbolget_option_expiration_chain
: Get option expiration information for a symbolget_transactions
: Get transactions for a specific accountget_transaction
: Get details for a specific transaction--jesus-take-the-wheel
flag)cancel_order
: Cancel a specific orderTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "schwab" '{"command":"uv","args":["run","schwab-mcp","server"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"schwab": {
"command": "uv",
"args": [
"run",
"schwab-mcp",
"server"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"schwab": {
"command": "uv",
"args": [
"run",
"schwab-mcp",
"server"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect