
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.
概览
面向 AI 编程代理的本地文件缓存,用哈希、差异或大纲代替整份文件,让重复读取大幅减少 token 消耗。
- 可以做什么
- 读取文件并返回内容哈希,未变更的文件可低成本重读,变更文件返回差异行
- 在 token 预算内批量读取文件,超大文件以定义大纲形式返回
- 用 BM25 关键词排序搜索缓存,并提供精确 grep 与 glob
- 写入、编辑和删除文件,支持原子编辑与 dry_run 预览
- 预热缓存、查看统计信息并清空缓存
- 适用场景
- 适合在编辑前后或上下文压缩后反复读取同一批项目文件的编程代理,用于降低重复读取的 token 成本。它更像是内置文件工具的替代品,而不是附加工具。
- 运行要求
- 通过 uvx 从 PyPI 包 semantic-cache-mcp 以 stdio 方式在本机运行,需要先安装 uv。无需 API 密钥、GPU,也未声明环境变量。唯一的网络请求是一次性下载分词器文件。
安装
在 SourceWeft 中
- 打开 控制台中的 Semantic Cache MCP,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
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:
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:
Any other client (Cursor, Claude Desktop, and others that take mcpServers JSON):
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:
- No stale content. Every read checks the file on disk first.
unchangedonly 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_sizereturns 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
Contributing
See CONTRIBUTING.md. Issues and pull requests are welcome.
License
MIT.
来源:README.md,提交 d6a780b
工具
0版本历史
1- v0.7.0最新Oct 23, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分