ATR: Automation for Token Reduction

io.github.JacobBhatt12由 GitHub 账号 JacobBhatt12 发布v1.0.0更新于 Oct 29, 2026

MCP proxy that hides tool lists and shrinks tool results so your AI uses fewer tokens.

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

概览

AI 生成的概览

本地 MCP 代理,隐藏工具列表并压缩工具结果,让 AI 助手在调用工具时消耗更少 token。

可以做什么
  • 在所有已配置的 MCP 服务器工具中搜索,并运行最契合任务的那几个
  • 运行只读工具并压缩结果,或运行会改动数据的工具并先请求确认
  • 读取被截断结果的更多内容,例如某一页、某个字段或某次搜索
  • 处理代码:仓库结构图、代码搜索、按需读取文件片段、精简的 git diff、测试与构建输出
  • 查看 ATR 已节省的 token 数量
适用场景
当你使用的 MCP 服务器会返回大量结果(如 GitHub、浏览器、数据库、日志或网页),并希望降低 token 费用时值得加入。对没有 MCP 服务器的普通编码帮助很小,也无法减少聊天记录和助手自身回复的 token。
运行要求
需要 Python 3.11 或更新版本,并在本地安装 atr-mcp 包。安装流程会改写你所用 AI 应用的 MCP 配置,把现有服务器移到 ATR 之后。用于 claude.ai 或 ChatGPT 时需安装 http 附加组件,并提供带密钥的公网隧道链接。设置保存在本地配置文件中。
安装前请注意
安装流程会修改 AI 应用的 MCP 配置文件,但会先展示计划,支持试运行与撤销,并保留备份。通过互联网使用时,任何拿到连接链接的人都能使用你的工具,务必保密;远程默认关闭文件读取和 shell 命令,需显式开启。shell 命令执行前总会询问。需要 OAuth 登录的在线服务器目前无法置于 ATR 之后。

安装

在 SourceWeft 中

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

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

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ATR: Automation for Token Reduction

ATR makes your AI use fewer tokens when it works with tools. Fewer tokens means lower bills and fewer "usage limit reached" messages.

It works with Claude Code, Codex, Claude Desktop, Cursor, Windsurf, claude.ai and ChatGPT. It's free and runs on your own computer.

[ATR demo: 1,000 GitHub issues go from 329,732 tokens to 1,442, and the tool list from 12,376 to 1,438]

The problem

When an AI uses tools (GitHub, a browser, a database, your test runner), two things waste tokens:

  1. Every tool's instructions are sent on every message, even tools the AI never uses. Ten MCP servers can mean 10,000+ tokens before you've typed anything.
  2. Tool results are huge. A list of GitHub issues, a web page or a test run can be tens of thousands of tokens, and all of it goes into the chat.

What ATR does

ATR sits between your AI app and your tools:

  • It hides the tool list. The AI sees a few small ATR tools and searches for the tool it needs when it needs it.
  • It shrinks results. Before the AI sees a result, ATR removes the noise and keeps what matters. A failing test run keeps the failures and drops the passing tests. A web page keeps its text and links and drops the layout.
  • Nothing is lost. When ATR cuts something, it keeps the full result, and the AI can ask for any part of it.
  Your AI app (Claude Code, Codex, Claude Desktop, …)          │  sees a few small ATR tools instead of every tool          ▼        ATR  ← finds the right tool, runs it, shrinks the result          │          ▼  Your MCP servers (GitHub, Playwright, Postgres, Slack, …)

Get started

You need Python 3.11 or newer.

bash
pip install atr-mcpatr setup

atr setup finds the AI apps on your computer, shows you what it will change, and asks first. Then it:

  1. moves your MCP servers behind ATR, and
  2. adds ATR to each app.

Restart your apps and you're done.

CommandWhat it does
atr setup --dry-runShows the plan without changing anything
atr setup --undoPuts every app back exactly how it was
pip install --upgrade atr-mcpUpdates ATR

Every file atr setup changes also gets a backup copy (.atr-backup).

Just want to try it?

The demo connects a fake server with 50 tools (GitHub, Slack, logs, a database). Nothing leaves your computer.

bash
claude mcp add atr -- atr serve --demo        # Claude Codecodex mcp add atr -- atr serve --demo         # Codex

Ask your AI to "list the open GitHub issues", then "show ATR stats" to see how many tokens it saved.


How much it saves

Live tests

We gave AI agents the same browser task with and without ATR: open Hacker News, click "new", then open a GitHub issues page. Each setup ran 3 times, and every answer was correct.

AgentWithout ATRWith ATR
Claude Code$0.237 per task, 13 turns$0.110 per task, 10 turns (54% cheaper)
Codex84k tokens (33k at full price)134k tokens (18k at full price)

Codex is mixed: with ATR it sends about half as many full-price tokens, but more tokens overall.

Single results

What the AI receives, in tokens, measured with python -m benchmarks.bench_atr:

ResultWithout ATRWith ATRSaved
1,000 GitHub issues429,20387999.8%
2,000-line server log61,07220899.7%
git diff with a lockfile change22,29420799.1%
Web page in a browser (Hacker News)12,0234,04666%
50 tools' instructions, on every message12,0561,50887.5%
pytest -v, 303 tests, 3 failing6,68567590%
pip install, 60 packages5,97769788%

In each case, the parts that matter are kept: errors, failing tests, changed code lines, page text and links.

When ATR helps, and when it doesn't

  • Helps most: you use MCP servers that return big results, like GitHub, browsers (Playwright), databases, logs or web pages.
  • Helps a little: plain coding in Claude Code or Codex with no MCP servers. Those apps already trim their own commands, so in our test ATR made no difference there.
  • Can't help: your chat history and the AI's own replies. An MCP server only sees tool calls, never the conversation.

ATR's tools

The AI uses these. You don't need to call them yourself.

For your MCP servers

ToolWhat it does
atr_find_toolsSearches all your servers' tools and returns the few that fit the task
atr_readRuns a tool that only reads, and shrinks the result
atr_callRuns a tool that changes something (your app can ask you first)
atr_queryReads more of a result that was cut, such as one page, one field or a search

For coding

ToolInstead of
atr_repo_mapOpening files one by one to learn a project
atr_search_codePages of search results
atr_read_fileReading a whole file to see one function. It also says "unchanged" if the AI reads the same part twice
atr_diffA git diff full of lockfiles
atr_runThousands of lines of test or build output
atr_statsShows how many tokens ATR has saved

Safety

  • Secrets are never read, searched or shown, including .env files, private keys, cloud credentials, and files named like api_keys.json. This also applies to tools behind ATR and to atr_diff.
  • Reading and changing are separate. Tools that only read go through atr_read. Anything that changes something goes through atr_call, so your app can ask you before it runs. atr_run (shell commands) always asks.
  • Files stay in allowed folders. File tools only see the folders listed in your settings.

Using ATR in claude.ai or ChatGPT

These apps can only reach servers on the internet, so ATR needs a public link.

bash
pip install "atr-mcp[http]"atr serve --http                               # prints a link with a secret in ittailscale funnel --bg 8789                     # a permanent public https link (or: cloudflared tunnel --url http://127.0.0.1:8789)

Add https://<your-link>/mcp/<secret> as a connector:

  • claude.ai: Settings → Connectors → Add custom connector (no sign-in)
  • ChatGPT: Settings → Apps & Connectors → developer mode → create a connector (no sign-in)

Keep the link private. Anyone who has it can use your tools. File reading and shell commands are off over the internet unless you turn them on with --read-files and --allow-run. To change the secret, delete ~/.atr/http_token.


Settings

atr setup writes these for you. You can also edit ~/.atr/config.json yourself:

jsonc
{  "servers": {                          // the MCP servers ATR runs for you    "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"] }  },  "budget": 1500,                       // most tokens one result may use  "level": 2,                           // 1 = keep almost everything, 3 = shrink hard  "pin": ["github__create_issue"],      // tools to always show (skips the search step)  "read_only": ["github__list_*"],      // tools that only read, if a server doesn't say so itself  "read_roots": ["~"]                   // folders the file tools may open}

More

No MCP at all? atr compress shrinks a file or your clipboard before you paste it into any chat:

bash
atr compress dump.json --copypbpaste | atr compress --copy

Set up by hand: atr init writes the settings file, and atr snippet prints the entry to add to your app's MCP config.

"No module named 'atr'" on macOS: run chflags nohidden .venv*/lib/python*/site-packages/*.pth, or use the entry from atr snippet.

Limits:

  • Online servers that need a sign-in (OAuth) can't go behind ATR yet, so atr setup leaves them in your app.
  • ATR lowers what each message costs. It doesn't change your plan's limits.

For developers

bash
git clone https://github.com/JacobBhatt12/atr && cd atrpip install -e ".[dev]"python -m pytest atr/tests -c /dev/null       # 44 testspython -m benchmarks.bench_atr                # the savings table above
FileWhat's in it
atr/server.pyThe MCP server your app talks to
atr/remote.pyThe same server over the internet (atr serve --http)
atr/downstream.pyTalks to the MCP servers behind ATR
atr/compress.pyShrinks results
atr/stash.pyKeeps full results for atr_query
atr/router.pyTool search
atr/code.pyCoding tools
atr/setup.pyatr setup

Next up: remembering repeated tool calls so the same result isn't sent twice, sign-in support for online servers, and a small local model that summarizes long text when cutting would lose meaning.

License: MIT

来源:README.md,提交 3a9847d

工具

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

版本历史

1
  1. v1.0.0最新Oct 29, 2026

评分

已满足适用检查项的 50%

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

  • 近 30 天内可连通25 分

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

  • 已声明认证方式10 分

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

  • 已列出工具15 分

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

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