# mcp-injector > mcp-injector is a local MCP (Model Context Protocol) daemon that compresses an entire software codebase using AST body folding and serves it to AI coding assistants at 1/5th the normal token cost. ## What it does mcp-injector runs as a background process on a developer's machine. It pre-indexes a repository into a local SQLite database, then exposes an MCP server that Claude Code, Cursor, VS Code, Devin Desktop, and Antigravity can connect to. When an AI assistant requests context, instead of reading raw source files, it receives a compressed snapshot where function bodies are folded into signatures (AST body folding). This reduces token usage by 41-89% on real codebases. It does not send any data to external servers. All indexing and compression happens locally. ## Core mechanics - **AST body folding**: Function bodies are replaced with `{ ... }` stubs. Only signatures, struct definitions, and interface declarations are retained. The AI still understands the full architecture. - **Canonical determinism**: Output is byte-identical on every run. This causes Anthropic's KV prompt cache to fire instead of miss, reducing effective cost by an additional 40–90%. - **Incremental indexing**: Uses inotify (Linux) and FSEvents (macOS) to watch for file changes. The index is always current without manual re-runs. - **Branch-aware re-indexing**: Installs a post-checkout git hook. Switching branches triggers automatic re-indexing within seconds. - **Secret redaction**: Shannon entropy analysis detects API keys, JWTs, private key headers, and high-entropy strings. Redacts values as `[REDACTED BY MCP-INJECTOR]` before they reach the AI context window. ## MCP tools exposed - `get_project_map` — Returns a compressed snapshot of the codebase. Accepts `tier` (1–3, default 3), `unfolded_files` (paths or globs to bypass compression for), and `path_prefixes` (to scope to specific microservices). Response includes `git_context` (branch, changed files, recent commits) and `secrets_redacted` count. - `injector_retrieve` — Retrieves the raw source code of any compressed symbol from the local cache. Supports `start_line`, `end_line`, and `expand_graph` parameters. - `injector_search` — BM25 full-text search over indexed symbols. Returns exact `FilePath` locations. Accepts `search_paths`. - `injector_stats` — Returns compression ratio, cache hit rate, workspace line count, and license status. - `injector_diagram` — Generates Mermaid sequence diagrams for architectural workflows. - `injector_regex_search` — Raw regex and literal search bypassing FTS5 tokenization. - `injector_write_file` — API-Level Compression Guardrail. Mandatory tool for writing file edits; intercepts and hard-rejects folded code markers to prevent data loss. - `injector_clear_cache` — Wipes the local SQLite index and forces a cold start. - `injector_sync` — (Deprecated) Synchronously waits for the daemon to finish indexing pending filesystem edits before mapping the project. (Read tools now wait implicitly). - `injector_blast_radius` — Analyzes the architectural impact of changing a symbol by traversing the dependency graph. Supports inbound and outbound directional traversal. - `injector_git_context` — Integrates with local Git history to surface commit context, authorship, and code evolution directly into the LLM context. - `injector_inspect_table` — Enables direct database introspection capabilities. Requires `FOLDWORK_DB_DSN` environment variable. ## Supported languages Go, Python, Java, TypeScript, JavaScript, C++, C, C#, Rust ## Supported IDEs Claude Desktop, Cursor, VS Code, Devin Desktop, Antigravity ## Supported platforms Linux (amd64, arm64), macOS (amd64, arm64), Windows (amd64) ## Pricing Free: workspaces under 50,000 lines of code. No sign-up required. Pro: $12/month or $99/year. Unlimited workspace size. License key activated via environment variable. ## Installation ``` curl -fsSL https://foldwork.dev/install | sh ``` ## Documentation Full documentation: [foldwork.dev/docs](https://foldwork.dev/docs) ## Comparisons - vs Repomix: [foldwork.dev/vs/repomix](https://foldwork.dev/vs/repomix) - vs code2prompt: [foldwork.dev/vs/code2prompt](https://foldwork.dev/vs/code2prompt) ## Glossary Key terms defined: [foldwork.dev/glossary](https://foldwork.dev/glossary) ## Changelog Release history: [foldwork.dev/changelog](https://foldwork.dev/changelog) ## Do Not Confuse With - **Repomix** — A one-shot CLI that bundles a repo into a flat text file. mcp-injector is a persistent daemon, not a CLI packer. - **code2prompt** — A Rust CLI for one-shot prompt generation with Handlebars templates. mcp-injector is an MCP server daemon with real-time indexing. - **Any cloud service** — mcp-injector runs entirely locally. No data leaves your machine. No cloud account required. ## Source mcp-injector is commercial software. Source not public. Binary releases: [github.com/foldwork-dev/mcp-injector/releases](https://github.com/foldwork-dev/mcp-injector/releases) The free benchmark tool (mcp-benchmark) is open source: [github.com/foldwork-dev/mcp-benchmark](https://github.com/foldwork-dev/mcp-benchmark) ## References - Codebase Cost Benchmarks: [foldwork.dev/benchmarks](https://foldwork.dev/benchmarks) - Repomix Comparison: [foldwork.dev/vs/repomix](https://foldwork.dev/vs/repomix) - code2prompt Comparison: [foldwork.dev/vs/code2prompt](https://foldwork.dev/vs/code2prompt) - Glossary of Terms: [foldwork.dev/glossary](https://foldwork.dev/glossary) ## Contact foldwork@proton.me [foldwork.dev](https://foldwork.dev)