mcp-injector is a local MCP daemon used to compress a codebase before sending it to AI coding assistants such as Claude. By pre-indexing the entire codebase into a local SQLite catalog, combined with AST function body folding and deterministic output, it converts large codebases into lightweight, cache-friendly payloads, thereby reducing token consumption by 41-89%, lowering API costs by up to 90%, and avoiding context window overflow. All processing is done locally, with no cloud and no telemetry.
Main Capabilities
- Code Compression and Indexing: Uses a single-pass AST parser to scan the repository, identify interfaces, classes, and function signatures, build a symbol graph and dependency graph, and persist them to a local SQLite FTS5 catalog. The index is incrementally updated when files change, with zero overhead during AI prompts.
- MCP Toolset: Provides multiple tools for AI agents to call, including:
get_project_map: Returns a compressed workspace structure overview, with function bodies folded and replaced by placeholders. Supports compression levels, specifying unfolded files, path prefix scoping, and always includes Git context and secret redaction counts.injector_retrieve: Retrieves the full uncompressed source code of a file from the local cache, supports retrieval by line range and expansion of cross-file dependencies.injector_search: BM25-based full-text symbol search, supports FTS5 Boolean logic.injector_diagram: Generates a Mermaid sequence diagram for a given symbol, traversing outbound dependencies.injector_regex_search: Exact literal or regex search fallback for file contents.injector_write_file: Writes the complete file to disk, and intercepts payloads containing compression folding markers to prevent data loss.injector_blast_radius: Analyzes the architectural impact of changed symbols, supports inbound and outbound direction traversal.injector_git_context: Integrates local Git history, providing commit context, authors, and code evolution information.injector_inspect_table: Database introspection, currently supports PostgreSQL and MySQL, requires setting theFOLDWORK_DB_DSNenvironment variable.injector_clear_cache: Clears the SQLite index cache and triggers a cold-start full reindex.injector_stats: Returns index status, compression ratio, total number of indexed files, and cache hit rate.injector_sync(deprecated): Read tools automatically wait for pending indexing, so manual invocation is not needed.
- Security and Redaction: Built-in Shannon entropy filter analyzes all AST strings and comments in real time, automatically redacting high-entropy strings (such as AWS access keys, SSH private keys, database passwords), JWT tokens, private key headers, etc. Redaction occurs locally before compression, is always enabled, and cannot be disabled. Pro license verification uses offline Ed25519 encryption, and the daemon never makes outbound network requests.
- Branch Awareness and Determinism: When switching branches, incremental reindexing is automatically triggered via git hooks. Guarantees byte-identical output across runs to maximize Claude's KV prompt cache hit rate.
- Supported Languages: Go, Python, TypeScript, JavaScript, Java, C++, C, C#, Rust.
Usage
- Check Free Eligibility: Run the benchmark CLI on the project to see token savings and lines of code. If the project is fewer than 50,000 lines, mcp-injector is completely free.
- Install the Daemon: The installer automatically detects Claude Desktop, Cursor, VS Code, Devin Desktop, and Antigravity, and automatically writes the MCP configuration.
- Restart the IDE: The MCP server runs automatically when the IDE starts, with no need to manage the daemon separately.
- Verify: In Claude Code or Cursor, ask Claude to use
get_project_mapDisplay the project structure. - Get the complete source code: When Claude needs to view the complete implementation of a compressed function, it will automatically call
injector_retrieve, and it can also be triggered explicitly. - Edit code: You must use the
injector_write_filetool to edit code, to prevent collapsed placeholders from being written back to the source code. - View savings: Run
mcp-injector statusor ask Claude to callinjector_stats.
When configuring MCP manually, you can add the configuration to the MCP configuration file of the corresponding IDE. Note that VS Code supports ${workspaceFolder}, but Claude Desktop, Cursor, and Devin Desktop require hardcoded absolute paths.
Use cases
- Reduce AI context window overflow and API costs in large codebases or enterprise-level monorepos.
- Trace authentication flows, find dead code, generate architecture diagrams, understand dependency graphs, locate implementations, perform safe refactoring, review pull requests, and navigate large monorepos.
- Use an AI programming assistant without leaking sensitive credentials.
Limitations
- The free tier is only available for workspaces with fewer than 50,000 total source lines of code.
- The Pro tier ($12/month or $99/year) unlocks unlimited workspace size and high-speed incremental diff indexing.
- The source code is not public; it is commercial software.
- The supported languages are limited; see the list above for details.
- Database introspection tools currently only support PostgreSQL and MySQL.
- Some tools require specific environment variables or configuration.
Support contact: foldwork@proton.me