Skip to main content
Glama
schwab-mcp

schwab-mcp

by psonhoang

schwab-mcp

A local MCP server exposing the Charles Schwab Individual Trader API (accounts, quotes, orders, transactions) as MCP tools, built on schwabdev.

See CLAUDE.md for architecture/conventions.

Setup

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).

Related MCP server: Schwab MCP Server

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:

{
  "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.

Available Tools

10 tools
cancel_orderA

Cancel a live (working/pending) order in one Schwab account.

SAFETY CRITICAL / two-step confirmation flow. This tool NEVER cancels an order on the first call:

  • With confirm=False (the default, and how this must always be called the first time), the current order's details are fetched from Schwab (NOT cancelled) so the user can see exactly what they're about to cancel. You MUST show these details to the user in full and obtain their explicit confirmation before calling this tool again.

  • Only after the user has explicitly confirmed should this tool be called again with the same order_id and confirm=True. Only then is the order actually cancelled with Schwab.

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). order_id: The Schwab order id to cancel. confirm: Must be False (default) for the initial lookup call, and True only on a follow-up call after the user has explicitly confirmed. Never default this to True.

Returns: If confirm is False: the current order's details, not cancelled. If confirm is True: confirmation that the order was cancelled.

Inputs: order_id (required), account_number (required), confirm.

get_accountA

Get one Schwab account's details (balances, and optionally positions).

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). include_positions: If True, also include the account's current positions.

Returns: A single account detail object.

Inputs: account_number (required), include_positions.

get_orderA

Get the full details of one order in one Schwab account.

Read-only; does not place, modify, or cancel anything.

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). order_id: The Schwab order id to look up.

Returns: A single order object.

Inputs: order_id (required), account_number (required).

get_quoteA

Get a real-time quote for a single symbol.

Args: symbol: The ticker symbol to quote (e.g. "AAPL").

Returns: A dict with a single key (the requested symbol) mapping to that symbol's quote data.

Inputs: symbol (required).

get_quotesA

Get real-time quotes for multiple symbols in a single call.

Args: symbols: List of ticker symbols to quote (e.g. ["AAPL", "MSFT"]).

Returns: A dict keyed by each requested symbol, mapping to that symbol's quote data.

Inputs: symbols (required).

get_transactionA

Get full details for a single transaction on one Schwab account.

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). transaction_id: The Schwab transaction id to fetch.

Returns: A single transaction object.

Inputs: account_number (required), transaction_id (required).

list_accountsA

List every Schwab account linked to this API app, with balances.

Args: include_positions: If True, each account also includes its current positions (symbol, quantity, market value, cost basis, etc.) in addition to balances.

Returns: A list of per-account detail objects, one per linked account.

Inputs: include_positions. Returns: result

list_ordersA

List orders entered for one Schwab account within a time window.

Read-only; does not place, modify, or cancel anything.

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). from_entered_time: Start of the entered-time window (ISO-8601 datetime string). to_entered_time: End of the entered-time window (ISO-8601 datetime string). max_results: Optional cap on the number of orders returned. status: Optional order status filter (e.g. "FILLED", "CANCELED", "WORKING").

Returns: A list of order objects, most recent first.

Inputs: account_number (required), to_entered_time (required), from_entered_time (required), status, +1 more. Returns: result

list_transactionsA

List transactions for one Schwab account within a date range.

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). start_date: Start of the date range, inclusive (ISO-8601 date or datetime string). end_date: End of the date range, inclusive (ISO-8601 date or datetime string). types: Required Schwab transaction-type filter, e.g. "TRADE", "DIVIDEND_OR_INTEREST". symbol: Optional ticker symbol to further filter transactions.

Returns: A list of transaction objects.

Inputs: types (required), end_date (required), start_date (required), account_number (required), +1 more. Returns: result

place_orderA

Preview or place a live order in one Schwab account.

SAFETY CRITICAL / two-step confirmation flow. This tool NEVER submits a live order on the first call:

  • With confirm=False (the default, and how this must always be called the first time for any new order), the order is only sent to Schwab's preview/dry-run endpoint, which validates and prices it WITHOUT submitting it to the market. The response contains the proposed order and Schwab's preview details. You MUST show these details to the user in full and obtain their explicit confirmation before calling this tool again.

  • Only after the user has explicitly confirmed should this tool be called again with the exact same order and confirm=True. Only then is the live order actually submitted to Schwab.

Args: account_number: The plain Schwab account number as shown to the user (not the internal account hash). order: The order object per Schwab's order schema (orderType, session, duration, orderStrategyType, price, orderLegCollection with instruction/quantity/instrument, etc.). confirm: Must be False (default) for the initial preview call, and True only on a follow-up call after the user has explicitly confirmed. Never default this to True.

Returns: If confirm is False: preview details and no order placed. If confirm is True: the submitted order's id and status.

Inputs: order (required), account_number (required), confirm.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 10 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI assistants like Claude to securely interact with Charles Schwab accounts and market data through the official Schwab API.
      87
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A read-only MCP server that provides access to Charles Schwab account data and market information, including portfolio positions, real-time quotes, options chains, price history, and account balances through AI assistants.
      9
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for the tastytrade brokerage API, providing tools for account management, market data, and order execution.
      18
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Read-only MCP server for Interactive Brokers that exposes market data, positions, and account info as MCP tools.
      8
      MIT