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

@modelstat/mcp

v0.3.0

Published

MCP server for modelstat — ask any MCP-compatible AI tool about your token spend.

Readme

@modelstat/mcp

Ask any MCP-compatible AI tool — Claude Desktop, Claude Code, Cursor, Cline, Continue, Zed — about your token spend directly in the chat. The same numbers you see on the modelstat dashboard, answered inline:

  • "How much did I spend on Cursor this week?"
  • "Total $ I spent debugging the acme project."
  • "Show me recent sessions over $5."
  • "What's this session costing so far?"

Where the data comes from — the MCP queries the right-hand box; the rest runs on your machine:

    your AI coding tools                     on YOUR machine                     modelstat cloud
┌──────────────────────────┐           ┌─────────────────────────┐           ┌──────────────────────┐
│   Claude Code · Codex    │           │    modelstat daemon     │           │ analytics dashboard  │
│ Cursor · Cline · Aider   │  session  │ • parse + price turns   │ redacted  │ spend & ROI grouped  │
│ Windsurf · Zed · Copilot │ ───────▶  │ • redact (PII / keys)   │ ───────▶  │ by activity · repo · │
│ Claude Desktop · …       │   logs    │ • summarize (local LLM) │   HTTPS   │ model · person —     │
│ (logs already on disk)   │           │ → tokens + abstract     │           │ the charts above     │
└──────────────────────────┘           └─────────────────────────┘           └──────────────────────┘

                      ↑ raw prompts, code & secrets never leave your machine ↑

No daemon required. If the modelstat daemon is installed, the MCP reuses its device token automatically (fast path). If not, the first tool call opens a browser tab to connect this MCP to your account (one-time), then remembers it in ~/.modelstat/mcp-auth.json.

Install

# Works inline — no global install needed.
npx -y @modelstat/mcp --help

# Or pin globally:
npm install -g @modelstat/mcp
modelstat-mcp

Wire it up

One command wires every tool you have — Claude Code, Claude Desktop, Cursor, VS Code (+ Insiders / VSCodium), Windsurf, Zed, Codex, Gemini CLI:

npx -y @modelstat/mcp wire

It writes the modelstat server into each detected tool's config — non-destructive (your other servers are untouched) and safe to re-run. Restart any open tool afterwards. (The modelstat installer runs this for you.) Prefer to configure one tool by hand? The recipes are below.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS), ~/.config/Claude/claude_desktop_config.json (Linux), or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "modelstat": {
      "command": "npx",
      "args": ["-y", "@modelstat/mcp"]
    }
  }
}

Restart Claude Desktop. You'll see a 🔌 for the modelstat tools.

Claude Code

claude mcp add modelstat -- npx -y @modelstat/mcp

Cursor

Settings → Cursor Settings → MCP → Add new MCP server:

  • Name: modelstat
  • Command: npx
  • Args: -y @modelstat/mcp

Cline / Roo

Settings → MCP Servers → Edit JSON:

{
  "mcpServers": {
    "modelstat": { "command": "npx", "args": ["-y", "@modelstat/mcp"] }
  }
}

Continue.dev

In ~/.continue/config.yaml:

mcpServers:
  - name: modelstat
    command: npx
    args: ["-y", "@modelstat/mcp"]

Tools

The pattern: resolve names → ids with the find_* tools, then pass the ids as filters to explore/sessions. All tools are read-only except assign_session.

| Tool | Purpose | |---|---| | overview | Spend/usage headline: effective cost, list price, savings, tokens, sessions, taxonomy roots. | | explore | The analytics workhorse — group/stack by day, hour, model, tool, provider, session, identity, taxonomy; metrics from cost to per-class tokens; filter by providers/models/tools/identities/session_ids and a taxonomy AND-of-OR filter ([[projId],[debugId]] = tagged BOTH). | | sessions | Search/list sessions — filter by taxonomy groups, identity, device, free-text q, range (cursor-paginated). | | session_insights | Live per-session insights for the CURRENT session: tokens, effective $, taxonomy detected, + a ready/analyzing/not_ingested status. eager:true force-scans the session locally first; then re-poll while analyzing. | | find_taxonomy | Resolve taxonomy node names → ids (optional root_key). | | find_projects | List/search projects (the workstreams root) → node ids, with spend. | | find_people | Search identities → ids for the identities filter. | | assign_session | MUTATING: reassign a session's owner. |

range accepts: today, 7d, 30d, 90d, mtd, ytd — or pass explicit RFC3339 from/to. Omit both for all-time.

Prefer remote? The same tools are served over streamable HTTP at https://mcp.modelstat.ai — auth with Authorization: Bearer $(npx -y modelstat@latest token). Claude Code users: the modelstat plugin bundles this server and adds the /stat charts command.

Your MCP client may see additional tools beyond the ones listed above — the live catalog comes from the modelstat backend, and the bridge forwards it verbatim. Ask your client to list available tools to see what's actually exposed for your account.

Auth & privacy

Auth resolution, most-trusted first: (1) MODELSTAT_TOKEN env, (2) a running daemon's token (modelstat token), (3) the daemon identity at ~/.modelstat/identity.json, (4) our own ~/.modelstat/mcp-auth.json written by the browser claim. With none of those, the first tool call runs the browser claim. The bearer is sent only to the modelstat API (default https://modelstat.ai); prompts, responses, and file contents never touch this process.

Override the API endpoint with MODELSTAT_API_URL (self-hosted / dev), the bearer with MODELSTAT_TOKEN, or the daemon home with MODELSTAT_HOME. Set MODELSTAT_MCP_BROWSER_AUTH=0 to disable the browser claim (or =1 to force it in a non-TTY context).

Troubleshooting

  • modelstat isn't connected yet — claim it via the browser tab the first tool call opens, or install the daemon with npx modelstat@latest.
  • 401 responses — the token expired. Re-run npx modelstat@latest, or just retry to re-claim.
  • No data yet — usage uploads within a few seconds of your first AI-tool session. Check npx modelstat@latest status.
  • No browser opened in a headless host — set MODELSTAT_TOKEN=$(modelstat token) (or MODELSTAT_MCP_BROWSER_AUTH=1 to force the prompt).

License

MIT.