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

@indiekitai/llm-context

v0.1.0

Published

Calculate token budget for LLM context windows - know what fits before you paste

Readme

llm-context

📊 Calculate token budget for LLM context windows - know what fits before you paste.

MCP

Ever wondered how much of your codebase will fit in Claude's 200K context window? Or whether that massive log file will blow your GPT-4 budget? llm-context tells you instantly.

Install

npm install -g llm-context

Usage

# Scan current directory
llm-context

# Scan specific paths
llm-context src/ lib/ README.md

# Compare against a specific model
llm-context --model gpt-4

# Show top 20 largest files
llm-context --top 20

# Filter by extensions
llm-context --ext ts,js,json

# Output as JSON
llm-context --json

Example Output

📊 LLM Context Analysis
──────────────────────────────────────────────────

Summary:
  Files scanned:  142
  Total size:     847.3 KB
  Total tokens:   198,432

Context usage (claude-3.5-sonnet):
  [████████████████████████░░░░░░] 79.4%
  198,432 / 200,000 tokens
  ✓ 1,568 tokens remaining

Top 10 largest files:
  src/parser.ts                    42,156 tokens (21.2%)
  src/analyzer.ts                  28,934 tokens (14.6%)
  tests/fixtures/large.json        15,221 tokens (7.7%)
  ...

By file type:
  .ts           142,156 tokens (89 files, 71.6%)
  .json          32,144 tokens (23 files, 16.2%)
  .md            24,132 tokens (30 files, 12.2%)

Supported Models

| Model | Context Window | |-------|----------------| | claude-3.5-sonnet | 200,000 | | claude-3-opus | 200,000 | | claude-3-haiku | 200,000 | | gpt-4-turbo | 128,000 | | gpt-4o | 128,000 | | gpt-4 | 8,192 | | gpt-3.5-turbo | 16,385 |

Features

  • 🚀 Fast - Scans thousands of files in seconds
  • 🎯 Accurate - Uses GPT tokenizer (similar to Claude's tokenization)
  • 📁 Smart - Respects .gitignore, skips binary files
  • 📊 Insightful - Shows breakdown by file type, largest files
  • 🎨 Pretty - Color-coded output with progress bars

Why?

When working with AI coding assistants, context is everything. But context windows are limited. This tool helps you:

  1. Plan before pasting - Know if your files will fit
  2. Optimize context - Find the biggest token hogs
  3. Budget wisely - Track token usage across models

MCP Server (for AI Agents)

llm-context includes a Python MCP server for integration with Claude, Cursor, and other AI tools.

Setup

pip install fastmcp tiktoken

Add to Claude Desktop

{
  "mcpServers": {
    "llm-context": {
      "command": "python",
      "args": ["/path/to/llm-context/mcp_server.py"]
    }
  }
}

Available Tools

| Tool | Description | |------|-------------| | llm_context_scan | Scan files/dirs and show token usage vs model context | | llm_context_check | Check if text fits in a model's context window | | llm_context_estimate | Simple token count for a string | | llm_context_models | List available models and their context sizes |

Example Usage

> How many tokens is my src/ folder?
[uses llm_context_scan]

> Will this log file fit in GPT-4's context?
[uses llm_context_check with model="gpt-4"]

> List supported models
[uses llm_context_models]

License

MIT