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

llm-cost-estimator-mcp

v0.3.1

Published

MCP server for LLM token counting and multi-model cost estimation (GPT-4o, Claude, Gemini, and 25+ models). Local-first, no API key.

Readme

llm-cost-estimator-mcp

An MCP (Model Context Protocol) server that gives Claude, Cursor, or any MCP client the ability to count tokens and estimate LLM costs across GPT-4o, Claude, Gemini, DeepSeek, Mistral, Llama, Grok, and 25+ models — locally, with no API key.

It reuses the exact same tokenizer + pricing + estimator core as the LLM Cost & Token Estimator VS Code extension in this repo.

Tools

| Tool | Description | | --- | --- | | estimate_cost | Token count + cost across multiple models for a piece of text. Returns a Markdown table and structured JSON. Args: text, models?, outputTokens?, currency?. | | count_tokens | Token count for one model. Args: text, model?. OpenAI is exact (tiktoken); others are flagged estimates. | | list_models | All model keys with provider, prices (USD/1M), and context window. |

⚠️ Prices are representative placeholders — verify against each provider's official pricing page. OpenAI counts are exact; all other providers are approximated via an OpenAI encoding and flagged as estimates.

Build (from source)

The server reuses the extension's core in ../src (whose files import js-tiktoken), so install the repo-root dependencies first:

npm install            # at the repo ROOT, once (provides the reused core's deps)
cd mcp-server
npm install
npm run build          # -> dist/index.js
npm test               # builds, then runs a real stdio MCP handshake

End users don't need this — they just npx -y llm-cost-estimator-mcp once it's published (the published dist/index.js is fully self-contained).

Connect it

The server speaks MCP over stdio, so any client launches it as a subprocess. Use the absolute path to mcp-server/dist/index.js.

Claude Desktop

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

{
  "mcpServers": {
    "llm-cost-estimator": {
      "command": "node",
      "args": ["C:/path/to/llm-cost-estimator/mcp-server/dist/index.js"]
    }
  }
}

Restart Claude Desktop, then ask: "Estimate the cost of this prompt on GPT-4o vs Claude Sonnet vs Gemini."

Claude Code (CLI)

claude mcp add llm-cost-estimator -- node /abs/path/to/mcp-server/dist/index.js

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (per-project):

{
  "mcpServers": {
    "llm-cost-estimator": {
      "command": "node",
      "args": ["/abs/path/to/mcp-server/dist/index.js"]
    }
  }
}

After publishing to npm (optional)

Once this package is published, clients can launch it without a local build:

{
  "mcpServers": {
    "llm-cost-estimator": { "command": "npx", "args": ["-y", "llm-cost-estimator-mcp"] }
  }
}

License

MIT — see ../LICENSE.