Reduces AI coding agent token usage by stripping framework noise and optimizing file context before it reaches the model.
Also known as shivam-app-developers/ai-optimizer, @ai-optimizer/core
- Stars
- 0
- Tools
- —
- Downloads, 30 days
- 153
- Latest version
- 0.1.0
- Last commit
- Aug 31, 2026
- License
- —
What is ai-optimizer MCP?
ai-optimizer reduces AI coding agent token usage by stripping framework noise and optimizing file context before it reaches the model.
Summary generated from the project's README
About ai-optimizer MCP server
Reducing AI coding agent token usage by stripping framework noise is the primary function of this MCP server. It intercepts standard tool calls to prevent models from reading unnecessary files like node_modules, dist, or generated dart files. By applying framework-aware context optimization, it can reduce token consumption by 60% to 80% for developers using coding agents.
Users can integrate this server with any MCP-compatible client including Claude Code, Cursor, Cline, Zed, and GitHub Copilot agent mode. The setup involves installing the core package via npm and configuring the stdio server in your agent settings. It works locally and respects your existing .gitignore files to ensure relevant files are prioritized.
The server provides specialized tools such as optimized_read_file, optimized_list_files, and optimized_grep to replace standard file operations. It also includes strip_bash_noise to clean up terminal output and optimized_diagnostics to provide narrow code windows from LSP errors. While the core engine is MIT licensed with Python and JS/TS support, additional framework packs for languages like Rust, Go, and Flutter are available through paid tiers.
What you can do with it
- 1Minimize token costsA developer can reduce the number of tokens sent to a model like Sonnet to save money on every session.
- 2Clean terminal outputAn engineer can strip away ANSI codes and build tool progress messages from terminal logs before the AI reads them.
- 3Efficient file searchingA user can perform a grep search that automatically ignores irrelevant framework directories.
- 4Precise error analysisA developer can request diagnostic information that only includes a narrow window of relevant code rather than entire files.
Written from the project's README. Every use case is checked against a quote from it.
How to install ai-optimizer MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall ai-optimizer MCP in Claude Code
$ claude mcp add --env 'AI_OPTIMIZER_LICENSE=<YOUR_AI_OPTIMIZER_LICENSE>' ai-optimizer -- npx -y @ai-optimizer/coreInstall ai-optimizer MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"ai-optimizer": {
"command": "npx",
"args": [
"-y",
"@ai-optimizer/core"
],
"env": {
"AI_OPTIMIZER_LICENSE": "<YOUR_AI_OPTIMIZER_LICENSE>"
}
}
}
}Install ai-optimizer MCP in VS Code
.vscode/mcp.json
{
"servers": {
"ai-optimizer": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@ai-optimizer/core"
],
"env": {
"AI_OPTIMIZER_LICENSE": "<YOUR_AI_OPTIMIZER_LICENSE>"
}
}
}
}Install ai-optimizer MCP in VS Code CLI
$ code --add-mcp '{"name":"ai-optimizer","type":"stdio","command":"npx","args":["-y","@ai-optimizer/core"],"env":{"AI_OPTIMIZER_LICENSE":"<YOUR_AI_OPTIMIZER_LICENSE>"}}'Install ai-optimizer MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"ai-optimizer": {
"command": "npx",
"args": [
"-y",
"@ai-optimizer/core"
],
"env": {
"AI_OPTIMIZER_LICENSE": "<YOUR_AI_OPTIMIZER_LICENSE>"
}
}
}
}Install ai-optimizer MCP in Codex
$ codex mcp add ai-optimizer --env 'AI_OPTIMIZER_LICENSE=<YOUR_AI_OPTIMIZER_LICENSE>' -- npx -y @ai-optimizer/coreInstall ai-optimizer MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.ai-optimizer] command = "npx" args = ["-y", "@ai-optimizer/core"] [mcp_servers.ai-optimizer.env] AI_OPTIMIZER_LICENSE = "<YOUR_AI_OPTIMIZER_LICENSE>"
Install ai-optimizer MCP in Gemini CLI
$ gemini mcp add -s user -e 'AI_OPTIMIZER_LICENSE=<YOUR_AI_OPTIMIZER_LICENSE>' ai-optimizer npx -- -y @ai-optimizer/coreInstall ai-optimizer MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"ai-optimizer": {
"command": "npx",
"args": [
"-y",
"@ai-optimizer/core"
],
"env": {
"AI_OPTIMIZER_LICENSE": "<YOUR_AI_OPTIMIZER_LICENSE>"
}
}
}
}Configuration
AI_OPTIMIZER_LICENSESecretEd25519 JWT license key. Unlocks Pro/Team packs; free tier needs no key.
AI_OPTIMIZER_LSPSet to 0 to disable the LSP bridge (optimized_diagnostics).
AI_OPTIMIZER_TELEMETRYSet to 'on' to enable anonymous opt-in telemetry. Off by default.
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work · What to fix for more points
- Source repository linked and reachableshivam-app-developers/ai-optimizer is public and reachablegithub.com/shivam-app-developers/ai-optimizer ↗Pass
- Package names this repository as its source@ai-optimizer/core names shivam-app-developers/ai-optimizer as sourcenpmjs.com/package/@ai-optimizer/core ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for @ai-optimizer/corenpmjs.com/package/@ai-optimizer/core/v/0.1.0#provenance ↗Pass
- Open source license (OSI)No licenseFinding
- Commit or release in the last yearLast commit or release 2026-08-31github.com/shivam-app-developers/ai-optimizer ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from @ai-optimizer/corePass
- No critical advisory in the package or its dependencies101 resolved dependencies checked; no critical advisoryosv.dev ↗Pass
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubAI Token Optimizer
An MCP server that cuts AI coding-agent token usage by 60–80% via framework-aware context optimization.
AI coding agents read whole files when they need 15 lines. They load *.g.dart,
R.java, node_modules/, and dist/ into context — then do it again next turn.
AI Token Optimizer is a Model Context Protocol
server that intercepts those tool calls and strips framework noise before it
reaches the model.
Works with anything that speaks MCP: Claude Code, Cursor, Cline, Continue, Zed, JetBrains AI, GitHub Copilot agent mode, Antigravity, Windsurf, OpenAI Codex CLI.
Quickstart
npm install -g @ai-optimizer/core
Then point your agent at the ai-optimizer stdio server. For Claude Code, add to
~/.claude/settings.json:
{
"mcpServers": {
"ai-optimizer": {
"command": "ai-optimizer"
}
}
}
Or scaffold the config and preview your savings automatically:
npx @ai-optimizer/init
# "we'd skip 47 files, ~14K tokens/session, ~$0.42/session at Sonnet pricing"
Full per-agent setup (Cursor, others), LSP install, and verification steps live in
packages/core/README.md.
What it does
It registers tools the agent uses instead of its built-in file/dir/error reads:
| Tool | What it saves |
|---|---|
optimized_read_file |
Framework-aware skip + optional line slice |
optimized_list_files |
Walks the tree applying ignore globs (+ .gitignore) |
optimized_grep |
Content search scoped by ignore filters |
optimized_diagnostics |
Spawns the right LSP, returns errors + a narrow code window |
read_symbol |
LSP workspace/symbol slice instead of a full-file read (Pro/LSP) |
strip_bash_noise |
Strips ANSI, npm/maven/gradle progress, JVM warnings |
optimizer_status |
Detected frameworks, active packs, cumulative tokens saved |
When a project type is detected (e.g. Python via pyproject.toml), the matching
pack's ignore rules activate automatically. .gitignore is respected on top.
Tiers
| Free (MIT core) | Pro ($9/mo) | Team ($29/seat) | |
|---|---|---|---|
| Framework packs | Python, JS/TS | + React, Flutter, Java, Kotlin, Go, Rust, C#, Swift, Ruby, Elixir, PHP, Solidity | all Pro packs |
| History compaction | — | ✓ | ✓ |
Scheduler (claude -p cron) |
— | ✓ | + work-stealing across providers |
| Audit log + secret redaction + policy | — | — | ✓ |
See PRICING.md. Behavior-changing or data-sharing features
(scheduler, work-stealing, telemetry) are off by default and require explicit
opt-in. Display-only features (dollar-value savings) default on.
Monorepo layout
| Package | Purpose | Published |
|---|---|---|
packages/core |
MCP server + free packs | npm (MIT) |
packages/init |
npx @ai-optimizer/init config + savings preview |
npm |
packages/sdk |
definePack plugin SDK |
npm |
packages/context-mode-import |
Import .contextmode configs |
npm |
packages/pro |
Pro/Team packs + scheduler + audit | private |
apps/landing, apps/dashboard, apps/vscode-extension, apps/license-server |
Site, local dashboard, IDE widget, license issuance | private |
tools/pack-bench |
Pack quality benchmark harness | private |
Architecture details: ARCHITECTURE.md.
Development
npm install # at repo root (workspaces)
npm run build # build all packages
npm test # run all test suites
Security
Local-only by design — license validation is the only network call. Report
vulnerabilities per SECURITY.md.
License
Core engine is MIT — see LICENSE. Pro/Team packs are proprietary.
ai-optimizer MCP questions
How do I add ai-optimizer MCP to Claude Code?
Run claude mcp add --env 'AI_OPTIMIZER_LICENSE=<YOUR_AI_OPTIMIZER_LICENSE>' ai-optimizer -- npx -y @ai-optimizer/core in your terminal. Add --scope user to make it available in every project.
How do I add ai-optimizer MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
How much can I save on tokens?
The server can cut AI coding-agent token usage by 60–80%.
Which AI agents are compatible?
It works with any MCP-compatible client including Claude Code, Cursor, Cline, Continue, Zed, JetBrains AI, GitHub Copilot, and Windsurf.
Does it respect my .gitignore files?
Yes, the tool respects .gitignore files and applies additional ignore globs when walking the file tree.
Is my data secure?
The server is designed to be local-only, with license validation being the only network call made.