The Schwab MCP Server is a bridge that allows AI assistants like Claude to securely interact with Charles Schwab accounts and market data through the official Schwab API. It enables you to check balances, get real-time quotes, view market movers, access options chains, retrieve transaction history, and more.
Before setting up the Schwab MCP Server, you'll need:
git clone <repository-url>
cd schwab-mcp
npm install
# Authenticate with Cloudflare (first time only)
npx wrangler login
# Create KV namespace for OAuth token storage
npx wrangler kv:namespace create "OAUTH_KV"
# Note the ID from the output - you'll need it for configuration
# Set up your personal configuration
cp wrangler.example.jsonc wrangler.jsonc
# Edit wrangler.jsonc to:
# 1. Replace YOUR_KV_NAMESPACE_ID_HERE with the ID from above
# 2. Change the name to something unique (e.g., "schwab-mcp-yourname")
# Set your secrets
npx wrangler secret put SCHWAB_CLIENT_ID # Your Schwab App Key
npx wrangler secret put SCHWAB_CLIENT_SECRET # Your Schwab App Secret
npx wrangler secret put SCHWAB_REDIRECT_URI # https://your-worker-name.workers.dev/callback
npx wrangler secret put COOKIE_ENCRYPTION_KEY # Generate with: openssl rand -hex 32
# Deploy
npm run deploy
https://schwab-mcp.<your-subdomain>.workers.dev/callback
Use the same secrets from Quick Setup (see above).
You can test your deployment using the MCP Inspector:
npx @modelcontextprotocol/inspector@latest
Enter https://schwab-mcp.<your-subdomain>.workers.dev/sse
and connect. You'll be prompted to authenticate with Schwab.
https://schwab-mcp.<your-subdomain>.workers.dev/sse
Add the following to your Claude Desktop configuration file:
{
"mcpServers": {
"schwab": {
"command": "npx",
"args": [
"mcp-remote",
"https://schwab-mcp.<your-subdomain>.workers.dev/sse"
]
}
}
}
Restart Claude Desktop. When you first use a Schwab tool, a browser window will open for authentication.
Once connected, you can ask Claude to:
"KV namespace not found" error
wrangler.jsonc
npx wrangler kv:namespace list
Authentication failures
npx wrangler secret list
"Durable Objects not available" error
Token refresh issues
npx wrangler kv:key list --namespace-id=<your-id>
For local development, create a .dev.vars
file:
SCHWAB_CLIENT_ID=your_development_app_key
SCHWAB_CLIENT_SECRET=your_development_app_secret
SCHWAB_REDIRECT_URI=http://localhost:8788/callback
COOKIE_ENCRYPTION_KEY=your_random_key_here
LOG_LEVEL=DEBUG # Optional: Enable debug logging
Then run:
npm run dev
The server will be available at http://localhost:8788. Connect to http://localhost:8788/sse using the MCP Inspector for testing.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.