ATR (Automation for Token Reduction)
This server lets an AI discover and invoke MCP tools through ATR, compress large tool/file outputs, query stashed details, and work efficiently in codebases while tracking token savings.
Search connected MCP servers for task-relevant tools and return compact signatures, optionally with schemas (
atr_find_tools).Run read-only tools through compression (
atr_read) or run mutating tools with explicit destructive/open-world signaling (atr_call).Retrieve parts of stashed/compressed results by reference using paths, fields, filters, offset/limit, regex search, and grouping (
atr_query).Read local files selectively by line range, regex search, or context; large code files can return outlines, and repeat reads can be detected (
atr_read_file).Inspect project layout with top-level functions/classes (
atr_repo_map).Search code with regex, grouped by file, with optional surrounding context (
atr_search_code).View compact git diffs while hiding lockfiles, generated files, and binary noise (
atr_diff).Run shell commands such as tests, builds, or lint and receive compressed output that keeps failures (
atr_run).Show how many tokens ATR has saved in the session (
atr_stats).
Enables AI apps to use GitHub MCP tools through ATR, including finding relevant GitHub tools and shrinking large GitHub results such as long issue lists before they reach the model.
Enables AI apps to use Slack MCP tools through ATR, routing tool calls and reducing the token size of Slack results returned to the model.
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. Run it on your own computer, or add the hosted connector to a chatbot in a minute, with no install: https://atr-mcp.vercel.app (connector link: https://atr-mcp.vercel.app/mcp).

The problem
When an AI uses tools (GitHub, a browser, a database, your test runner), two things waste tokens:
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.
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.
Related MCP server: Refract
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.
Get started
You need Python 3.11 or newer.
pip install atr-mcp
atr setupatr setup finds the AI apps on your computer, shows you what it will change, and asks first. Then it:
moves your MCP servers behind ATR, and
adds ATR to each app.
Restart your apps and you're done.
Command | What it does |
| Shows the plan without changing anything |
| Puts every app back exactly how it was |
| Updates 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.
claude mcp add atr -- atr serve --demo # Claude Code
codex mcp add atr -- atr serve --demo # CodexAsk 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.
Agent | Without ATR | With ATR |
Claude Code | $0.237 per task, 13 turns | $0.110 per task, 10 turns (54% cheaper) |
Codex | 84k 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:
Result | Without ATR | With ATR | Saved |
1,000 GitHub issues | 429,203 | 879 | 99.8% |
2,000-line server log | 61,072 | 208 | 99.7% |
| 22,294 | 207 | 99.1% |
Web page in a browser (Hacker News) | 12,023 | 4,046 | 66% |
50 tools' instructions, on every message | 12,056 | 1,508 | 87.5% |
| 6,685 | 675 | 90% |
| 5,977 | 697 | 88% |
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.
In the free hosted connector
Tool | What it does |
| Reads live web pages, PDFs, Office documents and JSON as compact text |
| Searches the web with DuckDuckGo, Bing and Brave at once and returns one short merged list (about 60 tokens a result); no API key needed |
| Finds local businesses and places with free OpenStreetMap data; no API key needed |
| Inspects a website or searches its public sitemap and navigation |
| Gets current weather and up to seven forecast days; no API key needed |
| Retrieves more from a large result ATR kept |
| Shows how many tokens ATR has saved |
For your MCP servers
Tool | What it does |
| Searches all your servers' tools and returns the few that fit the task |
| Runs a tool that only reads, and shrinks the result |
| Runs a tool that changes something (your app can ask you first) |
| Reads more of a result that was cut, such as one page, one field or a search |
For coding
Tool | Instead of |
| Opening files one by one to learn a project |
| Pages of search results |
| Reading a whole file to see one function. It also says "unchanged" if the AI reads the same part twice |
| A |
| Thousands of lines of test or build output |
| Shows how many tokens ATR has saved |
Safety
Secrets are never read, searched or shown, including
.envfiles, private keys, cloud credentials, and files named likeapi_keys.json. This also applies to tools behind ATR and toatr_diff.Reading and changing are separate. Tools that only read go through
atr_read. Anything that changes something goes throughatr_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
No install: add the hosted connector https://atr-mcp.vercel.app/mcp the same way (Settings → Connectors → Add custom connector, no sign-in). Then do the one-time step below.
Tell your chatbot to use it. Chatbots pick their own built-in web tools first, and in tests Claude never chose ATR by itself. Add this once under Settings → Profile → personal preferences (or in a Project's instructions):
When I ask you to search the web or read a link, use atr_search and atr_fetch instead of the built-in web tools.
Or skip the setup and ask your question and add "use atr", like "What is the latest on the MCP spec? Use atr." (or "use atr_search", "use atr_fetch"). This is only needed for the web tools. Tools you put behind ATR (GitHub, for example) are found by name.
For your own tools behind ATR, you need a link of your own:
These apps can only reach servers on the internet, so ATR needs a public link.
pip install "atr-mcp[http]"
atr serve --http # prints a link with a secret in it
tailscale 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:
{
"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:
atr compress dump.json --copy
pbpaste | atr compress --copySet 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 setupleaves them in your app.ATR lowers what each message costs. It doesn't change your plan's limits.
For developers
git clone https://github.com/JacobBhatt12/atr && cd atr
pip install -e ".[dev]"
python -m pytest atr/tests -c /dev/null # 44 tests
python -m benchmarks.bench_atr # the savings table aboveFile | What's in it |
| The MCP server your app talks to |
| The same server over the internet ( |
| Talks to the MCP servers behind ATR |
| Shrinks results |
| Keeps full results for |
| Tool search |
| Coding tools |
|
|
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
Available Tools
10 toolsatr_callCDestructive
Run a tool that changes something ([w] in atr_find_tools). Result is compressed.
Inputs: tool (required), budget, arguments.
atr_diffARead-only
What changed, compactly: git diff with 1 line of context, lockfiles/generated/binary files listed but not shown. Default: uncommitted changes. Use instead of git diff.
Inputs: ref, file, path, budget, +1 more.
atr_find_toolsARead-only
Find tools on the connected servers for a task. Returns compact signatures (* = required).
Inputs: query (required), k, detail.
atr_queryBRead-only
Read part of a stashed result by ref. Data: path/where/fields/group_by. Text: search (regex).
Inputs: ref (required), path, limit, where, +4 more.
atr_readBRead-only
Run a read-only tool ([r] in atr_find_tools). Result is compressed; big ones are stashed.
Inputs: tool (required), budget, arguments.
atr_read_fileARead-only
Read part of a local file. Pass lines= (e.g. from a search hit) or search= to get only what you need; with just a path, big code files return an outline instead of the whole file.
Inputs: path (required), fresh, lines, budget, +2 more.
atr_repo_mapARead-only
Project layout with each code file's top-level functions/classes. Start here in a codebase.
Inputs: path, budget.
atr_runBDestructive
Run a shell command (tests, build, lint) and get compressed output: failures kept, noise cut.
Inputs: command (required), cwd, budget, timeout.
atr_search_codeARead-only
Find where something is defined or used, before reading any file. Regex, grouped by file (path:line: text); context=3 shows the lines around each hit, often enough to answer.
Inputs: pattern (required), glob, path, budget, +1 more.
atr_statsBRead-only
Tokens ATR has saved in this session.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have clearly distinct purposes: discovery, read-only execution, write execution, stashed-result querying, local file reading, code search, repo mapping, diffing, shell running, and stats. There is some potential confusion between atr_read and atr_read_file, and between atr_call and atr_run, but the descriptions mostly clarify the boundaries.
All tools use a consistent atr_ prefix and snake_case naming, which makes the set easy to scan. The only minor deviation is that a few names like atr_repo_map and atr_stats are noun-oriented rather than strict verb_noun forms, but the overall convention is predictable.
Ten tools is well within the appropriate range for this server. Each tool covers a distinct part of the token-reduction workflow, and none appear redundant or trivial.
The set covers tool discovery, read/write execution, stashed result querying, file reading, code search, repo mapping, diff inspection, shell execution, and savings stats, which is strong lifecycle coverage for the stated purpose. Minor gaps exist around explicit stash management or direct local file editing, though agents can likely work around these via shell or connected tools.
Maintenance
Related MCP Connectors
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
LLM cost optimization gateway, repo token-waste auditor & model arbitrage MCP server.
Free, no-key MCP server: token estimates, JSON Schema conversion, MCP configs, tool search.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA proxy server that wraps existing MCP servers to significantly reduce token consumption by compressing tool descriptions into a two-step interface. It enables users to integrate extensive toolsets without exceeding context limits or incurring high API costs.143Apache 2.0
- AlicenseAqualityCmaintenanceMCP proxy that compresses tool schemas on the fly. Up to 98% token reduction, 100% signal preserved verified after every compression. Zero LLM calls, fully deterministic.53MIT
- AlicenseNot gradedqualityCmaintenanceIntelligent MCP proxy server that reduces context bloat by serving only the tools your AI actually needs through semantic search and a fixed two-tool surface.34 PyPI14MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP-compatible developer environments to shrink verbose tool outputs—test logs, git diffs, directory listings, and file dumps—before they reach the context window, preserving compiler errors, failure signatures, and decisive anchors. It runs either as direct callable tools or as a transparent proxy wrapping other MCP servers such as filesystem, git, or terminal providers.1MIT