SuperAPIAI Directory

semantic-cache-mcp

github.com · AI developer platforms

Semantic Cache MCP is an MCP file cache service for AI coding agents, used to reduce the token consumption caused by repeatedly reading the same file. When an agent reads an unchanged file again, it only needs to send back the content hash, consuming about 40 tokens instead of the entire file; when the file has changed, it is returned as a diff. It provides grep, BM25 search, glob, atomic edits with dry_run, and batch reads with a token budget. The cache is stored in a local SQLite file, requires no API key or GPU, and can be used with clients such as Claude Code, Cursor, Codex, and VS Code.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux

About this tool

Semantic Cache MCP is an MCP file caching tool for AI coding agents, with the goal of preventing agents from repeatedly paying the token cost for the same file. Coding agents often read the same files repeatedly before editing, after editing, and after each context compaction, while the built-in Read sends the entire file every time. Semantic Cache MCP records the file contents the agent already holds, thereby reducing the overhead of repeated reads.

Key capabilities

  • Repeated read optimization: every file sent by the server carries a content_hash, which the agent passes back as known_hash on the next read. If the file is unchanged, the server returns only an unchanged status, consuming about 40 tokens; if the file has changed, it returns a diff.
  • Data consistency: every read first checks the file on disk, and returns unchanged only when the hash matches the current bytes, avoiding returning stale content. After context compaction, the agent can read again without a hash to obtain the full file.
  • Large file handling: files exceeding max_size are not truncated directly; instead, an outline of their definitions is returned.
  • Retrieval and editing: provides cached retrieval capabilities such as grep (exact match), search (BM25 keyword ranking), and glob, as well as tools including atomic edits with dry_run, batch edits, edit preview, delete, warm-up, statistics, and clear.
  • Batch reads: supports batch reads within a token budget.
  • Local operation: the cache is a local SQLite file, with one background daemon serving all clients on the machine; the only network request is a one-time download of the o200k tokenizer file, verified with SHA-256.

Usage uv must be installed first. It can be configured directly in Claude Code; other clients that support mcpServers JSON (such as Cursor and Claude Desktop) can also connect. For configuration methods for VS Code, Codex, and OpenCode, and for how to disable the built-in file tools to encourage agents to use the cache, see docs/clients.md. Tool parameters and examples are in docs/tools.md.

Use cases Suitable for users who use AI coding agents such as Claude Code, Cursor, Codex, and VS Code for multi-file project development, especially those who frequently editand repeatedly read the same set of files and care about token costs. The official claim is a 98.7% saving on repeated-read tokens in a 48-file project, with unchanged reads taking 0.17 ms.

Limitations and notes

  • The word "semantic" in the name does not refer to embedding-based semantic search: search is BM25 keyword ranking, grep is exact matching, and no model download, GPU, or API key is required.
  • Code is not sent externally; the cache is fully local.
  • Windows is supported; CI runs on Linux and macOS.
  • There are three runtime dependencies; for the specific installation commands and client configuration details, refer to the repository documentation.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools