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

@ai-optimizer/core

v0.1.0

Published

MCP server that cuts AI coding agent token usage via framework-aware context optimization

Readme

@ai-optimizer/core

MCP server that cuts AI coding agent token usage via framework-aware context optimization.

Works with any MCP-compatible AI agent: Claude Code, Cursor, Cline, Continue, Zed, JetBrains AI, GitHub Copilot agent mode, Antigravity, Windsurf, OpenAI Codex CLI.

What it does

Registers tools the agent uses instead of its built-in file/dir/error reads:

  • optimized_read_file(path, startLine?, endLine?) — framework-aware skip + optional slice.
  • optimized_list_files(directory, pattern?) — walks the tree applying ignore globs (and .gitignore when present).
  • optimized_grep(pattern, directory?, flags?, filePattern?) — content search scoped by ignore filters; caps at 100 matches; skips files >2 MB.
  • optimized_diagnostics(path, contextLines?) — spawns the right LSP (pyright / typescript-language-server) and returns errors + a narrow code window around each one. Use this before reading a whole file when fixing an error.
  • strip_bash_noise(output) — strips ANSI codes, npm/maven/gradle progress lines, JVM reflective-access warnings, and collapses carriage-return progress bars from shell output.
  • optimizer_status() — detected frameworks, active packs, gitignore + LSP status, cumulative tokens saved.

When a project type is detected (e.g. Python via pyproject.toml), the matching pack's ignore rules become active automatically. .gitignore is respected on top.

Install

npm install -g @ai-optimizer/core

This installs the ai-optimizer command (stdio MCP server).

For the LSP-backed optimized_diagnostics tool, install whichever language servers you want active:

npm install -g pyright typescript-language-server typescript

LSP is auto-detected per file extension. If the binary isn't on PATH, the tool simply returns no diagnostics — the rest of the server keeps working. Set AI_OPTIMIZER_LSP=0 to disable LSP entirely.

Configure your agent

Claude Code

Add to ~/.claude/settings.json (or .claude/settings.local.json in your project):

{
  "mcpServers": {
    "ai-optimizer": {
      "command": "ai-optimizer"
    }
  }
}

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "ai-optimizer": {
      "command": "ai-optimizer"
    }
  }
}

Other agents

Anything that speaks MCP and supports command-based stdio servers — point it at ai-optimizer and you're done.

Verify it's working

In your agent, ask:

Use the optimizer_status tool.

You should see something like:

Project root: /path/to/your/project
Detected frameworks: python
Active packs: Python
.gitignore: active
LSP bridge: enabled

Tokens saved this session: 0
Operations: 0

Then ask the agent to use optimized_list_files on your project. It should skip __pycache__/, .venv/, node_modules/, dist/, etc., and report tokens saved.

Supported frameworks (free tier)

  • Pythonpyproject.toml, requirements.txt, setup.py, Pipfile, poetry.lock, uv.lock
    • Ignores: __pycache__/, *.pyc, .venv/, venv/, .pytest_cache/, .mypy_cache/, .ruff_cache/, dist/, build/, *.egg-info/, htmlcov/, .ipynb_checkpoints/
    • Generated patterns: *_pb2.py, *_pb2_grpc.py, *.generated.py
  • JavaScript / TypeScriptpackage.json
    • Ignores: node_modules/, dist/, build/, out/, .next/, .nuxt/, .turbo/, .svelte-kit/, .astro/, .vite/, .parcel-cache/, .cache/, .docusaurus/, storybook-static/, coverage/, .yarn/cache/, .pnpm-store/, *.min.js, *.min.css, *.tsbuildinfo, *.map
    • Generated patterns: *.gen.{ts,tsx,js,jsx}, *.generated.{ts,tsx,js,jsx}

More frameworks (React, Flutter, Java, Kotlin, Go, Rust, etc.) are part of Pro — see the project root's PRICING.md.

Development

npm install                                    # at repo root
npm run build --workspace=@ai-optimizer/core
npm test --workspace=@ai-optimizer/core
npm run start --workspace=@ai-optimizer/core

Smoke test (raw JSON-RPC over stdio):

echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.0.1"}}}' \
  | node packages/core/bin/ai-optimizer.js

License

MIT — see LICENSE.