home / mcp / schwab mcp server

Schwab MCP Server

Provides access to Schwab portfolio data, quotes, options, price history, and account information via a read-only MCP interface.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "acidsolution-schwab-mcp-server": {
      "command": "python",
      "args": [
        "-m",
        "schwab_mcp.server"
      ],
      "env": {
        "LOG_LEVEL": "INFO",
        "PYTHONPATH": "/path/to/schwab-mcp-server/src",
        "SCHWAB_CLIENT_ID": "your_app_key_here",
        "SCHWAB_TOKEN_PATH": "/path/to/.schwab-mcp/token.json",
        "SCHWAB_CALLBACK_URL": "https://127.0.0.1:8182/callback",
        "SCHWAB_CLIENT_SECRET": "your_app_secret_here"
      }
    }
  }
}

You can access Schwab account data and market information through a read-only MCP server that exposes endpoints for portfolio data, real-time quotes, options data, price history, and account information. This enables AI assistants to securely retrieve your Schwab data for analysis and insights without performing any trades or modifications.

How to use

You connect your MCP client to the Schwab MCP server using a local subprocess that runs the server Python module. Start the server with the provided command, then ask your AI assistant questions like “What are my current positions?” or “Show me the real-time quote for AAPL.” You can request detailed data such as cost basis, market value, and options Greeks, or historical price history for technical analysis.

How to install

Prerequisites: Python 3.10 or higher. A Schwab Developer account with a client key, secret, a valid refresh token, and a configured callback URL.

1. Create a Python virtual environment and activate it. 2. Install the MCP server package in editable mode.

Configuration, security, and testing

Store credentials and tokens in a token file and reference them via environment variables when starting the server. The server is strictly read-only, ensuring no trading or account modification operations are possible.

Test the server locally to verify authentication and data access. Exercise can include loading the token from the configured path and requesting basic data like account info or quotes.

Testing

Use MCP Inspector to verify the server is reachable and responding. You can also perform a manual check by loading the token from the configured path and ensuring the token can be refreshed as needed.

Troubleshooting

If token refresh fails, ensure the refresh token is valid and the client ID/secret are correct. If the server won’t start, confirm Python 3.10+ is installed and dependencies are installed. If no data is returned, check permissions on your Schwab account and that markets are open.

Notes

Environment variables carry sensitive values. Do not hardcode credentials in code. Use the provided token file to load client_id, client_secret, and refresh_token, and override via environment variables if necessary.

Tools and endpoints exposed by the Schwab MCP server

The server provides the following capabilities:

Available tools

get_account

Retrieve account information including type and balances.

get_positions

Get all positions with cost basis and market value.

get_quote

Get a real-time quote for a single symbol.

get_quotes

Get real-time quotes for multiple symbols.

get_option_chain

Get options chain data with Greeks for a symbol.

get_price_history

Retrieve historical OHLCV price data for analysis.