- Home
- MCP servers
- Schwab
Schwab
- typescript
24
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can use this MCP server to securely connect Claude or other agents to Charles Schwab data and market information through the Schwab API. It provides safe authentication, trading and market data tools, and safeguards for privacy and token management so you can automate tasks like checking balances, getting quotes, and viewing transaction history.
How to use
Connect your MCP client to the Schwab MCP Server to enable real-time access to accounts, quotes, market data, and transactions. After you connect, you can ask your assistant to retrieve balances and positions, fetch real-time quotes, explore market movers, view options chains, obtain recent transactions, search for ETFs, and check market hours. Use the MCP server as an intermediary that handles authentication, data access, and state management so you can focus on analysis and workflows.
How to install
Prerequisites you need before installing: Node.js version 22.x or higher, a Cloudflare account for deployment (Durable Objects require a paid plan), and a Schwab developer account for API access.
# 1) Clone the project
git clone <repository-url>
cd schwab-mcp
# 2) Install dependencies
npm install
# 3) Authenticate with Cloudflare (first time only)
npx wrangler login
# 4) Create a KV namespace for OAuth token storage
npx wrangler kv:namespace create "OAUTH_KV"
# Note the ID from the output
# 5) Copy and customize configuration
cp wrangler.example.jsonc wrangler.jsonc
# Edit wrangler.jsonc to replace YOUR_KV_NAMESPACE_ID_HERE with the ID from the previous step
# and rename the project if desired (e.g., "schwab-mcp-yourname")
# 6) Set up secrets
npx wrangler secret put SCHWAB_CLIENT_ID
npx wrangler secret put SCHWAB_CLIENT_SECRET
npx wrangler secret put SCHWAB_REDIRECT_URI
npx wrangler secret put COOKIE_ENCRYPTION_KEY
# 7) Deploy to Cloudflare Workers
npm run deploy
If you prefer local development, you can run the server locally and test with the MCP Inspector.
npm run dev
# Server will be available at http://localhost:8788
Connect to the MCP Inspector at http://localhost:8788/sse for testing.
## Additional sections
Configuration and runtime details are designed to keep sensitive data protected and tokens refreshed automatically. You’ll set up an OAuth 2.0 with PKCE flow for secure authentication, and the server uses a KV store for token persistence with automatic migration and a 31-day TTL. Account identifiers are scrubbed to protect privacy, and state data is protected with HMAC-SHA256 signatures. Secrets are encrypted in transit and at rest, and sensitive data is masked in logs.
MCP connection options
- HTTP (remote) MCP URL: https://schwab-mcp.<your-subdomain>.workers.dev/sse
- Local stdio MCP command (for clients): use the provided npx command that points to the remote MCP endpoint
- Example for Claude integration: the CLI command uses
npxwith the remote MCP URL.
- Example for Claude integration: the CLI command uses
Important environment variables you’ll configure:
- SCHWAB\_CLIENT\_ID: your Schwab App Key
- SCHWAB\_CLIENT\_SECRET: your Schwab App Secret
- SCHWAB\_REDIRECT\_URI: the OAuth redirect URI configured in Schwab
- COOKIE\_ENCRYPTION\_KEY: key used to encrypt client approval state
You can test locally by creating a .dev.vars file with these keys and running the dev server.
Troubleshooting tips
- If you see KV namespace not found, verify you created the KV namespace and updated wrangler.jsonc with the correct namespace ID.
- If authentication fails, ensure the redirect URI exactly matches Schwab app settings and that all secrets are correctly set.
- If you encounter Durable Objects not available, confirm you are on a paid Cloudflare Workers plan.
- Token refresh happens automatically 5 minutes before expiration; check KV storage if you suspect token issues.
Testing commands and paths you’ll use:
- Start development server: npm run dev
- Deploy to Cloudflare: npm run deploy
- Inspect logs: use the Cloudflare dashboard or local debug level if you set LOG_LEVEL=DEBUG
- Test with MCP Inspector at http://localhost:8788/sse or your deployed endpoint /sse.
## Supported usage patterns and examples
Example commands you can ask the assistant once connected:
- Show me my Schwab account balances
- Get a quote for AAPL
- What are today's market movers in the $SPX?
- Show me the options chain for TSLA
- Get my recent transactions from the last week
- Search for ETFs related to technology
- Check if the markets are open right now
## Available tools
### getAccounts
Retrieve all account information with positions and balances.
### getAccountNumbers
Get a list of account identifiers.
### getOrder
Get a specific order by ID.
### getOrders
Fetch orders with optional filtering by status, time range, and symbol.
### getOrdersByAccountNumber
Get orders for a specific account number.
### cancelOrder
Cancel an order (experimental).
### placeOrder
Place a new order (experimental).
### replaceOrder
Replace an existing order (experimental).
### getQuotes
Get real-time quotes for multiple symbols.
### getQuoteBySymbolId
Get detailed quote information for a single symbol.
### getTransactions
Retrieve transaction history across all linked accounts.
### getUserPreference
Retrieve user trading preferences and settings.
### searchInstruments
Search for securities by symbol with fundamental/reference data.
### getPriceHistory
Retrieve historical price data with customizable periods and frequencies.
### getMarketHours
Check market operating hours by date.
### getMarketHoursByMarketId
Get specific market information by market ID.
### getMovers
Find top market movers by index such as $SPX, $COMPX, $DJI.
### getOptionChain
Retrieve full options chain data with Greeks.
### getOptionExpirationChain
Get option expiration dates.