TokenSaver

io.github.Byggarepop由 GitHub 帳號 Byggarepop 發布v1.15.5更新於 Oct 24, 2026

Structural warm start for AI coding agents in .NET: cheap Roslyn signature maps of C#/.NET files.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

TokenSaver 為 AI 程式助理提供以 Roslyn 為基礎的 C#/.NET 檔案簽章速覽,讓模型只讀取所需的程式碼片段。

可以做什麼
  • 以簽章形式列出 C# 檔案中所有型別與成員及其行號範圍,不含方法主體
  • 無損壓縮整個檔案,移除註解與空白,自動辨識 C#、Razor、JS/TS、Python、HTML、CSS、JSON、YAML、XML、C、C++、X++、VB.NET
  • 在專案目錄或 .csproj 中追蹤相依性注入註冊,回傳服務型別對應實作型別的 file:line 精簡表格
適用情境
適合在 .NET 程式庫中工作的助理,尤其是大型檔案或使用較小、較便宜模型(容易整份讀取)的情境;頂級模型獲益很小。它減少多餘的讀取,並不會提升程式碼品質。
執行需求
以 stdio 在本機執行,透過 NuGet 套件 TokenSaver.Mcp 安裝並以 dnx 啟動,需要 .NET 工具鏈。選用環境變數 TOKENSAVER_API_URL(報表儀表板網址,預設為 tokensavermcp.com)與 TOKENSAVER_NO_TELEMETRY。
安裝前請注意
每次呼叫都會在 tokensavermcp.com 儀表板上計數;除非將 TOKENSAVER_NO_TELEMETRY 設為 1,否則會傳送匿名使用遙測。此工具會讀取磁碟上的專案檔案,TOKENSAVER_API_URL 會把回報導向外部服務。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 TokenSaver,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

TokenSaver

A structural warm start for AI coding agents in .NET. Instead of loading whole files into your assistant, TokenSaver hands it a cheap map of your code — every type and member as a signature, each tagged with its line range — so the model reads only the slice it needs instead of slurping the file. Built on the Roslyn compiler platform.

Where it pays off: outlining a file costs 70–95% fewer tokens than reading it — up to 90% on a large file. The end-to-end win is biggest on smaller / cheaper models (which over-read the most) and on large codebases: on real tasks it trims a Haiku-class model's token use by ~8%, and the savings climb with file size. A top-tier model already reads tightly, so it sees less benefit — the leaner the model, the more a warm start helps.

Works with Visual Studio 2026 (GitHub Copilot Chat), Claude Code, VS Code Copilot, Claude Desktop, and any other MCP client that speaks stdio.

→ Full docs and setup guide: mcp/README.md
→ Changelog: CHANGELOG.md


Install

See tokensavermcp.com/install for one-click install buttons, per-client config snippets, upgrade/uninstall instructions, and troubleshooting.


What the tools do

Single-file tools

ToolWhat it doesReduction
OutlineCSharpFileSignatures of every type and member — no bodies. Best for "what's in this file?"70–95%
MinifyFileLossless minify of an entire file — strips comments and whitespace, logic unchanged. Auto-dispatches by extension (C#, Razor, JS/TS, Python, HTML, CSS, JSON, YAML, XML, C, C++, X++, VB.NET).20–50%

* Reductions are measured against reading the whole file — the real alternative when you'd otherwise load it. The end-to-end saving on a task is smaller, because a capable model already reads somewhat selectively; it is largest on smaller/cheaper models and large files (see Token savings in practice below).

Cross-file traversal tools

These scan an entire project directory in one call — no need to know which file to look in first.

ToolWhat it does
TraceDiRegistrationsFinds every Dependency-Injection registration referencing a type (interface or concrete) and returns a compact table of file:line, method, ServiceType -> ImplType, and key. Answers "where is IFoo wired, and to what?"

Both accept a directory path or .csproj file — obj/ and bin/ are excluded automatically.


Token savings in practice

Measured against this project's own FocusedEmitter.cs (9,261 tokens raw):

Question typeToolTokens sentReduction
"What's in this file?"OutlineCSharpFile1,03989%
"Read one method body"OutlineCSharpFile + narrow Read of the // L.. range~300~95%
"Audit the whole file"MinifyFile5,52540%

Those are per-read figures versus loading the whole file. The end-to-end saving on a real task is smaller, because a capable model already reads somewhat selectively — and that's the honest part of the story:

Model running the agentReal-task token saving vs no tool
Top-tier (reads tightly already)~1% — negligible
Mid-tier (Sonnet-class)~5–7%
Smaller / cheaper (Haiku-class)~8%

The leaner the model, the more it over-reads on its own — and the more a warm start saves. TokenSaver is most worth it for agents running on small/cheap models, large files, or any workflow that would otherwise read whole files. It won't make a top model meaningfully cheaper, and it won't make a model write better code — it curbs wasteful reading, which is where cheap-model token budgets actually leak.


Collective impact

Every invocation is counted at tokensavermcp.com — a live dashboard showing total tokens saved by the community. Fewer tokens processed means less GPU compute and a smaller carbon footprint for AI-assisted development.


Language support

TierLanguages
Primary (Roslyn, full support)C# .cs, Razor .razor, VB.NET .vb, .NET project files .csproj .props .config .xml
Basic (comment-strip + whitespace collapse)JavaScript, TypeScript, Python, HTML, CSS/SCSS/LESS, JSON/JSONC, YAML, C, C++, X++

OutlineCSharpFile and TraceDiRegistrations are C# only; MinifyFile works across every supported language.

來源:README.md,提交 d5dd52e

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.15.5最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分