Ai Optimizer

io.github.shivam-app-developers由 GitHub 账号 shivam-app-developers 发布v0.1.0更新于 Oct 24, 2026

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

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

本地 MCP 服务器,用框架感知的读取方式替代 AI 编程助手的文件、搜索与诊断调用,以减少 token 消耗。

可以做什么
  • 按框架规则跳过生成文件与依赖目录,读取和列出项目文件,支持忽略规则、.gitignore 与行范围截取
  • 在忽略过滤下搜索文件内容,并通过 LSP 读取单个符号而非整份文件
  • 运行语言服务器诊断,只返回错误和一小段相关代码
  • 清理 shell 输出中的 ANSI 控制符、构建工具进度和 JVM 警告
  • 报告检测到的框架、已启用的包以及累计节省的 token
适用场景
当 AI 编程助手把上下文浪费在生成文件、依赖目录和构建产物上,或希望在大型、框架较多的代码库中做更省、更窄的读取时适用。面向支持 MCP 的助手,如 Claude Code、Cursor、Cline、Zed 等。
运行要求
以本地 stdio 进程运行,需通过 npm 安装 @ai-optimizer/core(Node.js)。可选的 AI_OPTIMIZER_LICENSE 密钥用于解锁 Pro/Team 包,免费版无需密钥。语言服务器诊断需要本机安装对应的 LSP。许可证校验是唯一的网络请求。
安装前请注意
Pro 与 Team 为付费订阅,许可证密钥通过 AI_OPTIMIZER_LICENSE 传入。会改变行为或共享数据的可选功能(调度器、work-stealing、通过 AI_OPTIMIZER_TELEMETRY 开启的遥测)默认关闭,需显式开启。该服务器会介入文件与 shell 读取,在敏感代码库中使用前应确认其返回内容。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Ai Optimizer,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

AI Token Optimizer

An MCP server that cuts AI coding-agent token usage by 60–80% via framework-aware context optimization.

[CI] [CodeQL] [npm] [License: MIT]

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

bash
npm install -g @ai-optimizer/core

Then point your agent at the ai-optimizer stdio server. For Claude Code, add to ~/.claude/settings.json:

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

Or scaffold the config and preview your savings automatically:

bash
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:

ToolWhat it saves
optimized_read_fileFramework-aware skip + optional line slice
optimized_list_filesWalks the tree applying ignore globs (+ .gitignore)
optimized_grepContent search scoped by ignore filters
optimized_diagnosticsSpawns the right LSP, returns errors + a narrow code window
read_symbolLSP workspace/symbol slice instead of a full-file read (Pro/LSP)
strip_bash_noiseStrips ANSI, npm/maven/gradle progress, JVM warnings
optimizer_statusDetected 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 packsPython, JS/TS+ React, Flutter, Java, Kotlin, Go, Rust, C#, Swift, Ruby, Elixir, PHP, Solidityall 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

PackagePurposePublished
packages/coreMCP server + free packsnpm (MIT)
packages/initnpx @ai-optimizer/init config + savings previewnpm
packages/sdkdefinePack plugin SDKnpm
packages/context-mode-importImport .contextmode configsnpm
packages/proPro/Team packs + scheduler + auditprivate
apps/landing, apps/dashboard, apps/vscode-extension, apps/license-serverSite, local dashboard, IDE widget, license issuanceprivate
tools/pack-benchPack quality benchmark harnessprivate

Architecture details: ARCHITECTURE.md.

Development

bash
npm install            # at repo root (workspaces)npm run build          # build all packagesnpm 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.

来源:README.md,提交 ef0a56a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。