← all posts
// rag · rag

Token Saver: a local hybrid-RAG MCP server that cuts PDF token spend by 92-99%

On July 30 Marktechpost covered Token Saver v1.0, an MIT-licensed MCP server that sits between Claude Desktop and a folder of PDFs. Instead of pasting a 200-page document into the context window, you point Claude at the server, ask a question, and the server returns only the passages that matter, with page citations. The project reports 92-99% token savings versus sending whole documents. The PDFs never leave your disk. The mechanism is not novel; the packaging is, and the packaging is what makes people actually use it.

How it works

Token Saver is a hybrid retriever with two legs. The lexical leg is BM25 implemented on SQLite FTS5, weighted 0.4. The semantic leg is all-MiniLM-L6-v2 embeddings compared by cosine similarity, weighted 0.6. Scores are combined, top passages are returned to Claude through the MCP tool response, and each passage carries its page number so the model can cite it. The whole thing runs locally: SQLite for the index, a small sentence-transformer for the vectors, no external API for either.

  • BM25 on FTS5 catches exact identifiers, part numbers, error codes and names that embeddings blur.
  • MiniLM embeddings catch paraphrase, so a question phrased differently from the source text still lands.
  • The 0.4/0.6 split favours semantic recall but keeps exact-match hits from disappearing.
  • Page citations turn a fuzzy answer into a checkable one, which for contracts and specs is the whole point.

If you want the reasoning behind the two-leg design, I wrote it up in hybrid search for local RAG; Token Saver is essentially that architecture wrapped in an MCP tool.

Why the savings number is plausible

A 200-page PDF is somewhere around 100k to 150k tokens. A typical question needs three to eight passages of a few hundred tokens each. Send only those and you are at one or two thousand tokens, which is where a 92-99% reduction comes from. Nothing clever is required; you just stop paying to ship pages the model will ignore. On a per-token price this is a straight cost cut, and on long sessions it compounds, because every follow-up question no longer re-sends the full document. Compare it to prompt caching, which makes repeated context cheaper but still requires the context to be there; retrieval removes it entirely.

Retrieval is not a quality feature. It is a cost feature that happens to improve quality when the retriever is good.

What to measure on your own corpus

The reported savings come from the author's documents. Your PDFs are different: scanned, tabular, multi-column, or written in a domain where MiniLM's general-purpose embeddings are weak. Before trusting the number:

  • Build a set of 30 to 50 real questions with known answers and pages. Measure recall at 5 and at 10 for the hybrid retriever, then for each leg alone.
  • Log tokens sent per question and compare to full-document baselines on the same questions. That is your actual savings figure.
  • Try a stronger local embedding model. MiniLM is small and fast; a larger model served through Ollama's embedding endpoint may lift recall on technical text at modest cost.
  • Test tables and figures explicitly. PDF text extraction is where most RAG pipelines quietly fail.
  • Check chunk boundaries. A passage cut mid-sentence loses the exact identifier BM25 was supposed to catch.

The honest limit

Two things. First, all the numbers are the project's own; there is no independent benchmark yet, and 92-99% is a range wide enough to hide a lot of variance in question type. Second, and more important for anything you run on a work machine: it is an MCP server. The same day Token Saver was covered, Noma Labs disclosed RufRoot, CVE-2026-59726, a CVSS 10.0 unauthenticated remote code execution in another MCP bridge that shipped listening on the network without authentication. Token Saver is a simpler, read-oriented tool, but the lesson transfers: check what interface it binds to, keep it on loopback, and treat any MCP endpoint as untrusted network surface until you have read the code that says otherwise.

#rag#mcp#cost#local