schwab-mcp
# schwab-mcp
A local MCP server exposing the Charles Schwab Individual Trader API
(accounts, quotes, orders, transactions) as MCP tools, built on
[schwabdev](https://github.com/tylerebowers/Schwab-API-Python).
See `CLAUDE.md` for architecture/conventions.
## Setup
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
cp .env.example .env
# fill in SCHWAB_CLIENT_ID, SCHWAB_CLIENT_SECRET, SCHWAB_REDIRECT_URI
python scripts/authorize.py # one-time interactive browser login
```
Re-run `scripts/authorize.py` whenever the refresh token expires (every 7
days, per Schwab's policy).
## Connecting to Claude Desktop
Claude Desktop launches MCP servers as a separate process without your
shell's environment, so pass credentials explicitly via `env` rather than
relying on `.env` discovery. Edit (or create)
`~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"schwab": {
"command": "/Users/edhac/Workspace/schwab-mcp/.venv/bin/python",
"args": ["-m", "schwab_mcp.server"],
"env": {
"SCHWAB_CLIENT_ID": "your-client-id",
"SCHWAB_CLIENT_SECRET": "your-client-secret",
"SCHWAB_REDIRECT_URI": "https://127.0.0.1",
"SCHWAB_TOKEN_PATH": "~/.schwab-mcp/tokens.db"
}
}
}
}
```
Then fully quit and reopen Claude Desktop. Run `scripts/authorize.py`
manually first (Claude Desktop can't complete the interactive browser login
itself) — the server will raise a clear error on startup if the token db is
missing or the refresh token has expired, telling you to do this.
TDQS
Scored across 10 tools
Each tool maps to a unique resource-action pair: accounts list/get, quotes single/batch, orders list/get/place/cancel, transactions list/get. The only similar pair is get_quote vs get_quotes, but the singular/batch distinction is explicit and clear.
Tool names follow a consistent verb_noun pattern: list_* for collections, get_* for single items, and place_/cancel_ for state-changing order actions. This makes the API surface predictable and easy to navigate.
Ten tools is well-scoped for a brokerage server, covering accounts, market quotes, orders, and transactions without redundancy or bloat. Each tool earns its place and the count matches the domain breadth.
Core brokerage workflows are covered: account lookup, quoting, order placement/cancellation, and transaction history. Minor gaps exist, such as order modification/replacement, but the primary agent-facing operations are present and workable.