snaptrade-mcp-ts
v0.1.0
Published
Read-only MCP server for brokerage data via SnapTrade
Downloads
87
Maintainers
Readme
SnapTrade MCP Server (TypeScript)
A read-only MCP (Model Context Protocol) server that connects AI agents to brokerage data via SnapTrade. Works with Claude Code, Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.
10 tools. Read-only. No trading. No SDK dependency. Safe by design.
This is the TypeScript version — no SnapTrade SDK required. It talks directly to the SnapTrade REST API using built-in Node.js crypto for HMAC signing.
Looking for the Python version? See snaptrade-mcp-server.
What You Can Do
| Tool | Description |
|------|-------------|
| snaptrade_list_accounts | List all connected brokerage accounts |
| snaptrade_get_balance | Cash balances for an account |
| snaptrade_get_positions | Current holdings (stocks, ETFs) |
| snaptrade_get_orders | Order history with filters |
| snaptrade_get_activities | Transaction log (dividends, fees) |
| snaptrade_portfolio_summary | All accounts + balances + positions in one call |
| snaptrade_search_symbols | Look up stocks/ETFs by name or ticker |
| snaptrade_list_brokerages | Supported brokerages |
| snaptrade_check_status | API health check |
| snaptrade_setup | Generate URL to connect a new brokerage |
Prerequisites
- SnapTrade API credentials — a
clientIdandconsumerKeyfrom snaptrade.com. Sign up for a developer account and find your keys in the dashboard. - Node.js 18+
Where do my API keys go?
Your SnapTrade credentials never leave your machine. Here's what happens:
- Your
clientIdandconsumerKeyare stored in a local config file on your computer (or in environment variables you set yourself). - The MCP server reads them at startup to authenticate with SnapTrade's API.
- They are never sent to your AI client, never included in tool responses, and never logged.
- The server is read-only — it cannot trade, modify accounts, or delete anything.
Your keys stay on your machine, period.
Installation
Option A: npx (no install needed)
npx snaptrade-mcp-tsThis downloads and runs it automatically. No permanent install.
Option B: npm install
npm install -g snaptrade-mcp-tsThis installs the snaptrade-mcp-ts command globally.
Option C: Install from source
git clone https://github.com/micah63/snaptrade-mcp-server-ts.git
cd snaptrade-mcp-server-ts
npm install
npm run buildAdd the MCP server to your AI client
Claude Code
The -s user flag stores your credentials in your personal Claude config (~/.claude/), not in the project — so they never end up in git.
claude mcp add snaptrade -s user \
-e SNAPTRADE_CLIENT_ID=your_client_id \
-e SNAPTRADE_CONSUMER_KEY=your_consumer_key \
-- npx snaptrade-mcp-tsThen restart Claude Code and run /mcp to verify the server appears with all 10 tools.
Alternative: If you prefer to set credentials as environment variables in your shell (add to ~/.zshrc or ~/.bashrc), you can skip the -e flags:
# In your ~/.zshrc or ~/.bashrc:
export SNAPTRADE_CLIENT_ID="your_client_id"
export SNAPTRADE_CONSUMER_KEY="your_consumer_key"
# Then register without -e flags:
claude mcp add snaptrade -s user -- npx snaptrade-mcp-tsClaude Desktop
Add to your claude_desktop_config.json (Settings > Developer > Edit Config):
{
"mcpServers": {
"snaptrade": {
"command": "npx",
"args": ["snaptrade-mcp-ts"],
"env": {
"SNAPTRADE_CLIENT_ID": "your_client_id",
"SNAPTRADE_CONSUMER_KEY": "your_consumer_key"
}
}
}
}Restart Claude Desktop. The SnapTrade tools will appear in the tools menu.
Cursor
Add to .cursor/mcp.json in your project root. Add .cursor/mcp.json to your .gitignore so credentials don't get committed.
{
"mcpServers": {
"snaptrade": {
"command": "npx",
"args": ["snaptrade-mcp-ts"],
"env": {
"SNAPTRADE_CLIENT_ID": "your_client_id",
"SNAPTRADE_CONSUMER_KEY": "your_consumer_key"
}
}
}
}First-Time Setup
After installing, ask your AI agent:
"Set up my SnapTrade connection"
This calls snaptrade_setup, which generates a URL where you authorize your brokerage. You only need to do this once. Your user credentials are saved locally at ~/.snaptrade/config.json.
Example Prompts
- "What brokerage accounts do I have?"
- "Show me my full portfolio summary"
- "What's my cash balance across all accounts?"
- "Analyze my portfolio for diversification risk"
- "What trades have I made recently?"
- "Search for Apple stock"
- "Which brokerages does SnapTrade support?"
Troubleshooting
Server fails to connect / "Failed to reconnect"
- Make sure Node.js 18+ is installed:
node --version - If using npx, try clearing the cache:
npx --yes snaptrade-mcp-ts
"Missing credentials" error
- Check that
SNAPTRADE_CLIENT_IDandSNAPTRADE_CONSUMER_KEYare set in the-eflags (Claude Code) orenvblock (Claude Desktop / Cursor).
"No config found" error
- Run
snaptrade_setupthrough the MCP server first to connect a brokerage and create~/.snaptrade/config.json.
Security
- Read-only — no trading, no account modification, no deletes
- No SDK dependency — talks directly to the SnapTrade REST API, nothing hidden
- Credentials isolated — API keys loaded from env vars, user secrets stored at
~/.snaptrade/config.json(chmod 600). Neither appears in tool responses. - Zero unnecessary dependencies — only the MCP SDK and zod for schema validation
Python vs TypeScript
| | Python | TypeScript (this repo) |
|---|---|---|
| Install | pip install snaptrade-mcp | npx snaptrade-mcp-ts |
| Runtime | Python 3.10+ | Node.js 18+ |
| SnapTrade SDK | Yes (Python SDK) | No (raw HTTP + HMAC) |
| Dependencies | mcp + snaptrade-python-sdk | @modelcontextprotocol/sdk + zod |
| Tools | 10 (identical) | 10 (identical) |
Both servers are functionally identical. Pick whichever runtime you already have installed.
Architecture
src/
index.ts # MCP server — 10 tools, 2 resources, 2 prompts
snaptrade-client.ts # HTTP client with HMAC-SHA256 signingThe server runs over STDIO (the default MCP transport). Each tool function makes signed HTTP requests to the SnapTrade API, parses the JSON response, and returns it to the AI agent.
