schwab-mcp
An MCP server that connects to the Charles Schwab brokerage API to enable account management, market data retrieval, and secure order execution. It includes a Claude Code plugin with specialized skills for optimized tool selection and safety-focused confirmation patterns for trading.
README
schwab-mcp
An MCP server that connects to the Charles Schwab brokerage API, plus a Claude Code plugin with skills that save LLM roundtrips when calling the MCP tools.
What this does
MCP Server — Wraps the Schwab API via schwabdev and exposes 18 tools over Streamable HTTP:
| Category | Tools |
|---|---|
| Session | list_accounts, set_active_account, get_active_account |
| Market Data | get_quotes, get_option_chain, get_option_expirations, get_price_history, get_movers, get_market_hours |
| Accounts | get_account, get_transactions, get_transaction, get_preferences |
| Orders | list_orders, list_all_orders, get_order, place_order, cancel_order, replace_order, preview_order |
| Instruments | search_instruments, get_instrument |
Claude Code Plugin — Ships six skills (schwab:account, schwab:orders, schwab:quotes, schwab:market, schwab:instruments, schwab:chart-orders) that give Claude the tool-selection rules, parameter formats, and safety patterns upfront. This eliminates the back-and-forth the LLM would otherwise need to figure out which tool to call and how to call it.
Prerequisites
- Python 3.11+
- A Schwab Developer account with an approved app (you need the app key and secret)
Setup
# Clone and install
git clone <repo-url> && cd schwab-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# Add credentials
cp .env.example ~/.schwab-mcp/.env
# Edit ~/.schwab-mcp/.env with your Schwab app key and secret
# Authenticate (opens browser for OAuth)
schwab-mcp auth
# Start the server
schwab-mcp serve
The server listens on http://127.0.0.1:8099/mcp by default. Override with env vars SCHWAB_MCP_HOST and SCHWAB_MCP_PORT.
Using with Claude Code
Install the plugin directory so Claude Code picks up the MCP connection and skills:
claude plugin add ./plugin
This registers:
- The MCP server connection (via
plugin/.mcp.json) - Six skills that guide Claude on how to use each tool category
- A session-end hook that cleans up temp files
Once installed, ask Claude things like:
- "What are my account positions?"
- "Get me a quote for AAPL"
- "Place a limit order to buy 10 shares of MSFT at $400"
- "Show me today's top movers on the S&P 500"
- "Chart my filled orders for SPX today"
Example: Placing a Limit Order
You: Buy 100 shares of SPY with limit order at current median bid-ask spread.
This order should be canceled if it weren't filled before 3/30 12PM ET.
Claude: I need to get SPY's current bid-ask spread first, then build the order.
Let me fetch the quote.
[calls get_quotes for SPY]
Got the quote. Here's the current SPY pricing:
- Bid: $632.70
- Ask: $633.00
- Midpoint: $632.85
Regarding cancellation by 3/30 12PM ET — Schwab doesn't support
"cancel at a specific time." I'll use DAY duration (valid through
market close on 3/30). You'd need to manually cancel at noon if
unfilled.
[calls place_order with confirmed=False — dry run]
| Field | Value |
|------------|----------------------------|
| Action | BUY |
| Symbol | SPY |
| Quantity | 100 shares |
| Order Type | LIMIT |
| Price | $632.85 (bid-ask midpoint) |
| Duration | DAY |
| Session | NORMAL |
Shall I submit this order?
You: yes
Claude: [calls place_order with confirmed=True]
Order submitted successfully.
The skill guided Claude to:
- Fetch the quote to calculate the midpoint price
- Dry-run the order first (
confirmed=False) and show the summary - Only submit (
confirmed=True) after explicit user approval
Example: Charting Filled Orders
You: Plot my last week's credit spread trades
Claude: [fetches filled orders for Mar 22-28]
39 credit spread orders on SPXW last week — 30 vertical spreads
and 9 iron condors across 5 trading days.
[fetches 15-minute SPX candles for the same range]
[runs chart_orders.py with candles + orders data]
Candles: 130, Orders: 62 (12 buy, 11 sell, 39 spread)
Interactive chart saved to plugin/skills/chart-orders/chart.html

The skill guided Claude to:
- Fetch filled orders for the date range and identify the underlying (SPXW/SPX)
- Fetch 15-minute candles (appropriate for a multi-day range)
- Run the chart script to generate an interactive Plotly chart with order markers, day separators, and hover tooltips
Safety
Mutating operations (place_order, cancel_order, replace_order) use a two-step confirmation pattern. The first call is a dry run that shows what would happen; you must explicitly confirm to execute.
Project structure
src/schwab_mcp/
server.py # CLI entry point (serve / auth commands)
client.py # Schwab client init, OAuth tokens, state persistence
_mcp.py # FastMCP server instance
logging_config.py # Rotating log handler with credential redaction
tools/ # MCP tool implementations
session.py # Account listing and selection
market_data.py # Quotes, options, price history, movers
accounts.py # Account details, transactions, preferences
orders.py # Order CRUD with dry-run safety
instruments.py # Symbol/CUSIP lookup
plugin/
.mcp.json # MCP server connection config
.claude-plugin/plugin.json # Plugin metadata
hooks/hooks.json # Session cleanup hook
skills/ # Claude Code skill definitions
State and logs
All runtime state lives in ~/.schwab-mcp/:
| File | Purpose |
|---|---|
.env |
API credentials |
tokens.db |
OAuth tokens (auto-refreshed by schwabdev) |
state.json |
Active account selection |
schwab-mcp.log |
Rotating log (5 MB, 3 backups, credentials redacted) |
Large tool responses (option chains, long transaction lists) are written to /tmp/schwab-mcp/ and cleaned up automatically when the Claude Code session ends.
Development
# Run tests
pytest
# Run with debug logging
LOG_LEVEL=DEBUG schwab-mcp serve
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。