Meet Token Saver: An Open-Source MCP Extension Using Local Hybrid RAG to Cut Claude PDF Token Costs 90-99%


AI developers, researchers, and professionals frequently hit a frustrating wall when analyzing large documents with LLMs: the hidden, compounding cost of context windows. Pasting a 200-page PDF into a chat isn’t a one-time charge. Because the conversation history is re-sent to the model on every single turn, that massive document is paid for again with every follow-up question.

Marktechpost AI team just released Token Saver, an open-source Model Context Protocol (MCP) extension for Claude Desktop (MIT licensed, currently at v1.0). It was developed at Marktechpost AI Media Inc by Arnav Rai (CS student at Rochester Institute of Technology) during his internship at Marktechpost, supervised by Jean-marc Mommessin and Asif Razzaq. Token Saver fundamentally changes how Claude interacts with local documents. By implementing a Local Hybrid RAG (system directly on your machine, it allows you to ask questions about massive PDFs without ever uploading the actual file to the model.

Token consumption is slashed by 92% to 99%, privacy is guaranteed, and setup requires exactly zero Python environments or terminal configurations.

How it looks!

The Hidden Token Drain of Large PDFs

Most users assume that when they drop a PDF into Claude, it simply extracts the text. In reality, Claude’s default behavior converts each page into an image to preserve charts and layouts, while separately extracting text. Before a single image token is even counted, the text alone can run 1,500 to 3,000 tokens per page.

While Prompt Caching and Claude Projects help soften this blow, they don’t solve the core issue: the entire document still crosses the boundary to the provider’s servers. Furthermore, if you only need two relevant paragraphs from a 1,000-page textbook, forcing the LLM to search the entire 1,000 pages itself is both inefficient and prone to hallucination.

How Local Hybrid RAG Solves the Problem

Marktechpost’s Token Saver acts as a local MCP server : a lightweight background program on your machine that Claude can call as a tool. The PDF never leaves your hard drive.

When you ask a question, Token Saver utilizes Local Hybrid RAG to find the answer. Hybrid RAG is the gold standard for document retrieval because it combines two powerful search methods:

  1. Keyword Matching (BM25): Runs over SQLite’s built-in FTS5 search (weighted at 0.4) to find exact terminology.
  2. Semantic Search (Cosine Similarity): Uses a local all-MiniLM-L6-v2 embedding model (weighted at 0.6) to understand the meaning of your question, rather than just matching exact words.

By blending these two approaches locally, the server searches the file and hands Claude only the highly relevant passages. Claude then synthesizes the answer, citing the exact page numbers and providing a running tally of the tokens you just saved.

The 8-Stage Processing Pipeline

Token Saver runs entirely inside a single, long-running local process. Before any text reaches Claude, the local Hybrid RAG pipeline executes eight rapid steps:

  1. Extract: Uses pypdfium2 (with pypdf as a fallback) to pull text.
  2. Chunk: Splits text into 180-word passages, overlapping by 40 words so context is never blindly cut.
  3. Score (Hybrid RAG): Evaluates chunks using the blended BM25 and local embedding model.
  4. Gate: Enforces a quality threshold. Passages sharing no exact keywords must pass a semantic similarity floor of 0.25 to qualify.
  5. Deduplicate: Drops near-identical passages.
  6. Trim: Narrows the passage down strictly to the sentences that answer the user’s prompt.
  7. Budget: Caps the total payload sent to Claude at 8,000 characters.
  8. Envelope: Wraps the retrieved text in a document-chunk element containing the source file and precise page number.

(Note: The embedding model is optional but recommended. If it fails to load, the system gracefully falls back to keyword-only matching).

The Numbers: 99% Savings at Scale

Because the Hybrid RAG pipeline caps the returned text slice, the token savings grow exponentially with the size of the document. Here is how Token Saver performed in benchmarking (measured via tiktoken, assuming one question per document):

DocumentPagesWhole Doc TokensReturned TokensTokens Saved
FDA drug label3323,9591,02195.7%
GDPR (EU 2016/679)8870,26099698.6%
SFFA v. Harvard233133,34974099.4%

Disclaimer: Token counts use cl100k_base as a stand-in, and baselines assume the whole document is charged on every search.

For professionals working repeatedly with court opinions, technical standards, financial reports, or dense textbooks, Token Saver eliminates the repetitive token tax.

Security and Local Privacy

For enterprise users and legal professionals, data privacy is non-negotiable. Token Saver’s security model rests on three pillars:

  • Zero Uploads: The document never leaves your machine.
  • Folder Allowlisting: You configure a specific folder for Token Saver. The server will actively refuse to read files outside of this designated directory.
  • Network Isolation: The server communicates with Claude Desktop over standard I/O (stdio) only. There are no listening network ports, drastically reducing the attack surface.

Model Performance: Sonnet vs. Opus

Marktechpost’s Token Saver works across all three Claude 3.5 tiers, but testing revealed distinct behaviors:

  • Claude 3.5 Sonnet (Recommended): The sensible default. It handles loose file references perfectly, asks clarifying questions if two files have similar names, and correctly applies the retrieved page numbers.
  • Claude 3 Opus: Excels at complex documents with multiple voices (e.g., legal rulings with majority opinions and dissents). Opus is smart enough to flag when it infers an attribution based on context rather than explicit text.

Getting Started in Minutes

Unlike many open-source AI tools that require complex Python environments and JSON configurations, Token Saver is packaged as a single .mcpb bundle.

  1. Download token-saver-ccr.mcpb from the project’s GitHub Releases page.
  2. Open Claude Desktop -> Settings -> Extensions -> Install extension.
  3. Enable the extension, click Configure, and select a dedicated folder where you keep your reference PDFs.
  4. At the first prompt, choose Always allow.

The extension will not run until a folder is chosen, because that single choice serves three purposes at once.

That folder is worth a moment’s thought. It sets the boundary of what can be read, it is what lets you ask for a file by name instead of typing a path, and it is the list the server shows Claude when a conversation starts. A small folder holding only what you intend to ask about works considerably better than pointing it at all of Documents.

Key Takeaways

  • Massive Cost Reduction: By using Local Hybrid RAG to pass only relevant paragraphs to the LLM, token costs drop by up to 99%. The longer the chat, the more you save.
  • Verifiable Accuracy: Because Token Saver attaches exact page numbers to every retrieved chunk, you can instantly verify Claude’s claims by opening your local PDF.
  • Absolute Privacy: The boundary is your local machine. Your proprietary data is never uploaded to an AI provider’s server.
  • Frictionless Setup: No Python required. A simple .mcpb file install gets you running in Claude Desktop instantly.

Check out the GitHub Repo.

References: MCP Bundle format | all-MiniLM-L6-v2 | pdfkb-mcp | wesleygriffin/pdfrag | Corpora: Dobbs v. Jackson Women’s Health Organization; Berkshire Hathaway 2023 Annual Report


Arnav is currently a student at Rochester Institute of Technology pursuing a Bachelor’s degree in Computer Science and a minor in Economics with hands-on backend development experience, and is a contributor at Marktechpost, where he writes about AI/ML research.


Jean-marc is a successful AI business executive .He leads and accelerates growth for AI powered solutions and started a computer vision company in 2006. He is a recognized speaker at AI conferences and has an MBA from Stanford.


Asif Razzaq is the CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.





Source link

  • Related Posts

    Moonshot AI Open-Sources MoonEP: A Perfectly Balanced Expert Parallelism Library for MoE Training

    Moonshot AI has open-sourced MoonEP, an Expert Parallelism (EP) communication library for distributed Mixture-of-Experts (MoE) workloads. The team announced the release as a library built to make expert-parallel communication more…

    Prompt Engineering vs Loop Engineering vs Graph Engineering: What Changes at Each Layer

    Three terms now compete for the same line in AI engineering job descriptions. Prompt engineering is the established one. Loop engineering entered the AI vocabulary in late 2025 and dominated…

    Leave a Reply

    Your email address will not be published. Required fields are marked *