npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

snaptrade-mcp-ts

v0.1.0

Published

Read-only MCP server for brokerage data via SnapTrade

Downloads

87

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

  1. SnapTrade API credentials — a clientId and consumerKey from snaptrade.com. Sign up for a developer account and find your keys in the dashboard.
  2. Node.js 18+

Where do my API keys go?

Your SnapTrade credentials never leave your machine. Here's what happens:

  • Your clientId and consumerKey are 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-ts

This downloads and runs it automatically. No permanent install.

Option B: npm install

npm install -g snaptrade-mcp-ts

This 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 build

Add 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-ts

Then 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-ts

Claude 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_ID and SNAPTRADE_CONSUMER_KEY are set in the -e flags (Claude Code) or env block (Claude Desktop / Cursor).

"No config found" error

  • Run snaptrade_setup through 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 signing

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