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

@agentmeter/cli

v1.1.1

Published

Track local AI coding agent session costs — Claude Code, Cursor, Codex

Readme

@agentmeter/cli

Track what your AI coding sessions cost. Reads the session data that Claude Code and Cursor already write to your machine — token counts, model, duration, project — and exposes it as an MCP server your AI agent can query directly.

No account required. No setup beyond two lines of JSON.


MCP server (no account needed)

Add to your MCP client config and start asking questions. The server scans your local Claude Code and Cursor data on demand — no prior sync, no background service, nothing to install first.

Claude Code — add to ~/.claude.json:

{
  "mcpServers": {
    "agentmeter": {
      "command": "npx",
      "args": ["@agentmeter/cli", "mcp"]
    }
  }
}

Cursor — add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):

{
  "mcpServers": {
    "agentmeter": {
      "command": "npx",
      "args": ["@agentmeter/cli", "mcp"]
    }
  }
}

The first call scans your local data (takes a moment). Subsequent calls within 60 seconds return instantly from the in-memory cache.

Claude Code CLI only: if you use the claude terminal app (not the VS Code extension), the server also registers two slash commands — /mcp__agentmeter__sessions and /mcp__agentmeter__spend — that inject live data directly into your conversation. These are not available in the VS Code extension or Cursor.

Available tools (no account needed)

| Tool | Description | |------|-------------| | list_recent_sessions | Sessions from the last 12 months, sorted newest first. Includes token counts (input/output/cache), duration, model, engine, and repo. costCents is populated if you have an AgentMeter account (see below). | | get_session | Look up a session by ID from local data. Same fields as above. Falls back to the AgentMeter API if not found locally (requires account). |

Example questions your agent can answer with no account:

"Show me my last 10 Claude Code sessions." "Which session used the most tokens this week?" "What's my total token usage across the last 20 sessions?" "Show me my recent Cursor sessions on the my-app repo."


Unlock cost data, dashboards, and team visibility

Connecting to AgentMeter gives you cost-per-session in dollars (not just tokens), a web dashboard, spend trends over time, and team-level visibility.

What you get

  • costCents per session — calculated by the API and returned to your local cache, so list_recent_sessions starts showing dollar costs too
  • Web dashboard — session history, per-repo breakdowns, model-level spend
  • Spend trends — daily and weekly charts queryable via MCP
  • Team visibility — connected engineers, session counts, and spend (Pro)

Connect in 30 seconds

Sign in at agentmeter.app with GitHub, generate a personal API key under Settings → API Keys, then:

npx @agentmeter/cli init
npx @agentmeter/cli sync      # submit your sessions and get cost data back
npx @agentmeter/cli install   # keep it syncing automatically every 5 minutes

Or pass the key via your MCP config without running init:

{
  "mcpServers": {
    "agentmeter": {
      "command": "npx",
      "args": ["@agentmeter/cli", "mcp"],
      "env": {
        "AGENTMETER_API_KEY": "am_sk_your_key_here"
      }
    }
  }
}

Additional MCP tools with an account

| Tool | Description | |------|-------------| | get_session (API fallback) | Fetches a session from the API when not in local data. | | get_my_spend | Spend summary + daily time series for the last N days. Returns totalCostCents, totalRuns, avgCostPerRunCents, and a per-day breakdown. | | get_team_spend | Per-contributor breakdown — login, totalCostCents, totalRuns, connectionStatus. Pro plan. |

Example questions unlocked with an account:

"How much have I spent on Claude Code this week?" "What's my average cost per session this month?" "Show me my team's AI spend for the last 30 days."


Updating

Using npx (default config): npx caches the package. To always resolve the latest version, use @latest in your config args:

{
  "mcpServers": {
    "agentmeter": {
      "command": "npx",
      "args": ["@agentmeter/cli@latest", "mcp"]
    }
  }
}

Using a global install (faster startup, explicit updates):

npm install -g @agentmeter/cli

Then use agentmeter as the command directly:

{
  "mcpServers": {
    "agentmeter": {
      "command": "agentmeter",
      "args": ["mcp"]
    }
  }
}

To update: npm install -g @agentmeter/cli@latest

After updating: restart your MCP client (Claude Code, Cursor) — MCP servers are not hot-reloaded.


CLI reference

The CLI is optional for MCP usage but required for background auto-sync and for submitting sessions to AgentMeter.

Requirements

  • Node.js 22.5+ — the Cursor scanner uses node:sqlite, built in as of 22.5
  • macOS or Linux — full support. On Windows, sync works manually but install/uninstall do not

Commands

| Command | Description | | ----------- | -------------------------------------------------- | | mcp | Start MCP stdio server | | sync | Scan local sessions and submit to AgentMeter | | install | Install as a system service (macOS/Linux) | | uninstall | Remove the system service | | watch | Run the sync loop in the foreground | | upgrade | Reinstall the service from the current binary | | status | Show service health and session counts | | init | Configure an AgentMeter API key |

sync flags

| Flag | Description | |---|---| | --verbose | Show each session's status, cost, and duration | | --dry-run | Preview what would be submitted without sending anything | | --since <date> | Only include sessions after this date (ISO 8601) | | --engine <name> | Only run a specific scanner (claude, cursor) |

Background service

install sets up the CLI to sync every 5 minutes, survive reboots, and start on login.

  • macOS — installs a launchd agent (~/Library/LaunchAgents/)
  • Linux — installs a systemd user service
npx @agentmeter/cli status    # check it's running
npx @agentmeter/cli uninstall # remove it (config and data are preserved)

Upgrading

npx @agentmeter/cli@latest upgrade   # npx — no global install
npm install -g @agentmeter/cli@latest && agentmeter upgrade  # global install

upgrade stops the service, reinstalls pointing at the new binary, and restarts. Config and sync state are preserved.


Environment variables

| Variable | Description | |---|---| | AGENTMETER_API_KEY | API key — overrides the value in ~/.agentmeter/config.json | | AGENTMETER_API_URL | Override the API base URL (useful for self-hosting or local dev) |

Privacy

AgentMeter stores session metadata and token counts — never your code, prompts, or conversation content. The CLI extracts: token counts, model, timestamps, duration, project path, and the first line of the session as a title. Nothing else leaves your machine.

Supported agents

| Agent | Token data | | ----------- | ----------------------------------- | | Claude Code | Exact (from Anthropic API response) | | Cursor | Approximate (subscription-based) |

Links