Semantic Cache MCP

io.github.CoderDayton由 GitHub 帳號 CoderDayton 發布v0.7.0更新於 Oct 30, 2026

File cache for coding agents: re-reads cost ~40 tokens, changed files return diffs.

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

給 AI 編碼代理用的本機檔案快取,以雜湊、差異或大綱取代整份檔案,讓重複讀取大幅減少 token 用量。

可以做什麼
  • 讀取檔案並回傳內容雜湊,未變更的檔案可低成本重讀,變更的檔案回傳差異行
  • 在 token 預算內批次讀取檔案,過大的檔案以定義大綱形式回傳
  • 以 BM25 關鍵字排序搜尋快取,並提供精確 grep 與 glob
  • 寫入、編輯與刪除檔案,支援原子編輯與 dry_run 預覽
  • 預熱快取、檢視統計資料並清空快取
適用情境
適合在編輯前後或上下文壓縮後反覆讀取同一批專案檔案的編碼代理,用來降低重複讀取的 token 成本。它更像是內建檔案工具的替代品,而非附加工具。
執行需求
透過 uvx 從 PyPI 套件 semantic-cache-mcp 以 stdio 方式在本機執行,需先安裝 uv。不需要 API 金鑰、GPU,也未宣告環境變數。唯一的網路請求是一次性下載分詞器檔案。
安裝前請注意
它可以寫入、編輯與刪除專案中的檔案,套用前應檢查變更並使用 dry_run 預覽。快取是一個 SQLite 檔案,由本機背景常駐程式供多個用戶端共用。README 建議關閉內建檔案工具,讓代理改用此快取。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

[Semantic Cache MCP Logo]

Semantic Cache MCP

Stop paying for the same file twice.
An MCP file cache for AI coding agents: a re-read costs ~40 tokens instead of the whole file.

[PyPI version] [PyPI downloads] [Python 3.12+] [License: MIT]

[Semantic Cache MCP on Glama]   [Support on Ko-fi]


Coding agents read the same files over and over: before an edit, after an edit, after every context compaction. A built-in Read sends the whole file each time. Semantic Cache MCP knows what your agent already holds. Measured on one 7,891-token file:

ReadBuilt-in ReadSemantic Cache MCP
First read7,891 tokensfull file, plus a hash
Re-read, file unchanged7,891 tokens77 tokens
Re-read after a one-line edit7,891 tokens137 tokens (a diff)

Across a 48-file project it saves 98.7% of re-read tokens, and an unchanged read takes 0.17 ms. It also gives your agent grep, BM25 search and glob over the cache, atomic edits with dry_run, and token-budgeted batch reads. Three runtime dependencies, no API keys, no GPU.

Quick start

You need uv. In Claude Code:

bash
claude mcp add semantic-cache --scope user -- uvx semantic-cache-mcp

Any other client (Cursor, Claude Desktop, and others that take mcpServers JSON):

json
{  "mcpServers": {    "semantic-cache": {      "command": "uvx",      "args": ["semantic-cache-mcp"]    }  }}

Configs for VS Code, Codex and OpenCode, and how to turn off the built-in file tools so the agent uses the cache: docs/clients.md.

How it works

Every file the server sends comes with a content_hash. The agent passes it back as known_hash on the next read:

mermaid
flowchart LR    R["read(path, known_hash)"] --> M{"hash matches<br/>the file now?"}    M -- yes --> U["unchanged<br/>~40 tokens"]    M -- "no, older version" --> D["diff of changed lines"]    M -- "no hash" --> F["full file + content_hash"]
  • No stale content. Every read checks the file on disk first. unchanged only answers when the hash matches the current bytes.
  • Forgetting is safe. After a compaction, the agent reads without the hash and gets the full file back.
  • Large files become maps. A file over max_size returns an outline of its definitions, not a blind cut.
  • Everything stays local. The cache is a SQLite file. One background daemon serves every client on your machine.

Tools

read · batch_read · read_image · write · edit · batch_edit · edit_preview · delete · warm · grep · search · glob · stats · clear

Parameters and examples: docs/tools.md.

FAQ

Is the search "semantic" in the embeddings sense? No. search is BM25 keyword ranking and grep is exact. No model to download, no GPU, no API key.

Does it send my code anywhere? No. The only network request is a one-time download of the o200k tokenizer file, checked against a SHA-256 hash.

Does it work on Windows? Yes. CI runs on Linux and macOS.

Documentation

GuideCovers
ClientsSetup for each client, turning off built-in file tools
ToolsEvery tool, with parameters and examples
Environment VariablesEvery setting, with defaults
PerformanceBenchmarks and methodology
ArchitectureStorage, algorithms, the shared daemon
SecurityThreat model, size limits, path handling
TroubleshootingCommon issues, debug logging
Advanced UsagePython API

Contributing

bash
git clone https://github.com/CoderDayton/semantic-cache-mcp.gitcd semantic-cache-mcpuv sync --extra devuv run pytest

See CONTRIBUTING.md. Issues and pull requests are welcome.

License

MIT.

來源:README.md,提交 d6a780b

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:軟體包安裝失敗。

版本歷史

1
  1. v0.7.0最新Oct 23, 2026

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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