AgentStack
MCP verified MIT Self-run

Mcp Token Tracker

mcp-forbiddenlink-mcp-token-tracker · by forbiddenlink

Track MCP server token usage and costs for AI coding tools

No reviews yet
0 installs
10 views
0.0% view→install

Install

$ agentstack add mcp-forbiddenlink-mcp-token-tracker

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Mcp Token Tracker? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

MCP Token Cost Tracker

> Track token usage and costs for MCP servers in AI coding tools

What It Does

Scans your MCP (Model Context Protocol) configurations and estimates how many tokens are being loaded into your AI coding tool's context window. Helps you:

  • See which MCP servers are consuming the most tokens
  • Estimate monthly costs based on usage
  • Get recommendations for optimization

Supported Tools

  • Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json)
  • Claude Code (~/.claude.json)
  • Cursor (~/.cursor/mcp_config.json)
  • Windsurf (~/.windsurf/mcp.json)

Installation

# Clone or download
cd mcp-token-tracker

# Install dependencies
pnpm install

# Run
pnpm dev

Usage

# Scan for MCP configs and analyze token usage (fast estimates)
pnpm dev

# Connect to servers for real token counts (slower but accurate)
npx tsx src/cli.ts scan --live

# Or after building:
pnpm build
pnpm start scan
pnpm start scan --live

Example Output

🔍 MCP Token Cost Tracker

Scanning for MCP configurations...
✓ Found 1 configuration(s)

📁 Claude Desktop
   /Users/you/Library/Application Support/Claude/claude_desktop_config.json

Servers:
  ✓ playwright                      1,232 tokens ($0.0025/session)
  ✓ context7                        1,278 tokens ($0.0026/session)
  ✓ servicecurator                  1,236 tokens ($0.0025/session)

────────────────────────────────────────────────────────────
  Total: 3,746 tokens (~3.7k)
  Est. Monthly Cost: $0.22

✓ Token usage looks good!

How It Works

  1. Scans known MCP config file locations
  2. Estimates token usage based on server configuration
  3. Calculates approximate monthly costs
  4. Recommends optimizations if usage is high

Why This Matters

Every MCP server you load adds tool definitions to your AI's context window. With 5-10 servers, you could be burning 4,000+ tokens on tools you're not even using. This tool helps you:

  • Identify which servers are worth keeping loaded
  • Unload unused servers to save tokens (and money)
  • Optimize your MCP configuration

Tech Stack

  • TypeScript - Type-safe CLI
  • Commander.js - CLI framework
  • Chalk - Terminal colors
  • Tiktoken - Token counting (OpenAI's official library)

Usage Tracking (Claude Code)

When used in a Claude Code project, MCP tool calls are automatically logged. The scan output shows which servers you actually use:

Servers:
  ✓ playwright         (22 tools)     3,769 tokens    12 calls (2h ago)
  ✓ context7           (2 tools)        995 tokens     8 calls (1d ago)
  ⚠ MCP_DOCKER         (43 tools)    10,220 tokens     0 calls (never)

Servers with 0 calls get a warning icon, making it easy to identify candidates for removal.

Setup: Copy .claude/settings.json and .claude/hooks/ to your Claude Code project to enable tracking.

Roadmap

  • [x] Connect to actual MCP servers via JSON-RPC (--live flag)
  • [x] Track real tool usage via Claude Code hooks
  • [ ] Historical tracking (see usage over time)
  • [ ] Auto-optimize config files
  • [ ] Web dashboard

License

MIT

Author

Elizabeth Stein

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.