CodeCompress 0.1.0-preview

This is a prerelease version of CodeCompress.
There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global CodeCompress --version 0.1.0-preview
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local CodeCompress --version 0.1.0-preview
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=CodeCompress&version=0.1.0-preview&prerelease
                    
nuke :add-package CodeCompress --version 0.1.0-preview
                    

<div align="center">

{ CodeCompress }

Persistent code index for AI agents. Ask for exactly what you need.

CI Release NuGet NuGet Downloads License: MIT .NET 10

</div>


What is CodeCompress?

CodeCompress is an MCP server that gives AI coding agents instant memory of your codebase.

Instead of scanning every file at the start of each conversation, agents query a persistent SQLite index to get exactly the symbols, types, and dependencies they need — in a fraction of the tokens.

Without CodeCompress With CodeCompress
Agent reads 50+ files to understand your project Agent calls project_outline — gets the full API surface in ~3–8k tokens
30–150k+ tokens wasted per session on context 80–90% reduction in context-loading tokens
Sub-agents each scan the same files independently All agents share one persistent index
Bigger codebase = longer wait, every time Index time is constant after first run (incremental)

Quick Start

Prerequisites

1. Add to your AI coding tool

Pick your tool and run one command — that's it.

<details> <summary><strong>Claude Code</strong></summary>

claude mcp add --transport stdio codecompress -- dnx CodeCompress.Server --yes

Windows (not WSL)? Use cmd /c wrapper:

claude mcp add --transport stdio codecompress -- cmd /c dnx CodeCompress.Server --yes

</details>

<details> <summary><strong>VS Code / GitHub Copilot</strong></summary>

Create .vscode/mcp.json in your project:

{
  "servers": {
    "codecompress": {
      "type": "stdio",
      "command": "dnx",
      "args": ["CodeCompress.Server", "--yes"]
    }
  }
}

Windows (not WSL)? Change "command" to "cmd" and "args" to ["/c", "dnx", "CodeCompress.Server", "--yes"].

</details>

<details> <summary><strong>Claude Desktop</strong></summary>

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "codecompress": {
      "command": "dnx",
      "args": ["CodeCompress.Server", "--yes"]
    }
  }
}

</details>

<details> <summary><strong>Cursor / Windsurf / any MCP client</strong></summary>

CodeCompress uses stdio transport. Point your client at:

dnx CodeCompress.Server --yes

Or if you prefer a persistent global install:

dotnet tool install -g CodeCompress.Server
codecompress-server

</details>

<details> <summary><strong>Share with your team (.mcp.json)</strong></summary>

Commit this file at the root of your repo. Claude Code and VS Code pick it up automatically — every team member gets CodeCompress with zero setup:

{
  "mcpServers": {
    "codecompress": {
      "type": "stdio",
      "command": "dnx",
      "args": ["CodeCompress.Server", "--yes"]
    }
  }
}

</details>

2. Index your project

Your AI agent will call index_project automatically when it needs codebase context. You can also trigger it explicitly:

index_project(path: "/path/to/your/project")

First run does a full index — parses every source file and stores symbols in SQLite. Subsequent runs are incremental — only files whose SHA-256 hash changed get re-parsed.

3. Start coding

That's it. Your agent now has instant access to your codebase structure. It will automatically use tools like project_outline, get_symbol, and search_symbols instead of reading raw files.

How It Works

AI Agent  <── MCP (stdio) ──>  CodeCompress Server
                                      |
                                 Index Engine
                                   /      \
                          Language       SQLite Store
                          Parsers        ~/.codecompress/
                        (Luau, C#)      {project-hash}.db
  1. Index — CodeCompress walks your source files, hashes each one (SHA-256), and extracts symbols (functions, classes, types, constants) and dependencies (imports/requires) using language-specific parsers.

  2. Store — Everything goes into a local SQLite database at ~/.codecompress/. Each project gets its own .db file, keyed by a hash of the project path. The database uses FTS5 virtual tables for fast full-text search.

  3. Query — Agents call MCP tools to get compressed outlines, look up specific symbols by name, search across the codebase, or check what changed since a snapshot.

  4. Stay current — Re-indexing is incremental. Only files whose content hash changed are re-parsed. Call index_project at the start of any session, or after making changes, and it completes in seconds.

Keeping the Index Up to Date

CodeCompress is designed to stay current with minimal effort:

Scenario What to do
Starting a new agent session Call index_project — takes seconds if nothing changed
After editing files Call index_project again — only changed files are re-parsed
Tracking changes across sessions Use snapshot_create before work, then changes_since to see what's different
Force a clean re-index Call invalidate_cache then index_project

Tip for CLAUDE.md / system prompts: Add an instruction like "At the start of each session, call index_project to refresh the codebase index, then use project_outline to understand the project structure." This ensures your agent always has a fresh index.

Available MCP Tools

Indexing

Tool What it does
index_project Index a project directory (incremental by default)
snapshot_create Create a named snapshot for tracking changes over time
invalidate_cache Force a full re-index on next index_project call

Querying

Tool What it does
project_outline Compressed API surface of the entire project — types, functions, signatures
get_symbol Retrieve the full source code of a single symbol by name
get_symbols Batch retrieve multiple symbols in one call
get_module_api Complete public API of a single file/module
search_symbols Full-text search across symbol names, signatures, and docs
search_text Raw text search across file contents (with glob filtering)

Change Tracking & Navigation

Tool What it does
changes_since Delta report — what files/symbols changed since a snapshot
file_tree Annotated project file tree
dependency_graph Import/require dependency graph for a file

Supported Languages

Language Status Parser
Luau (Roblox) Available Regex/pattern-based
C# / .NET Available Regex/pattern-based
Python, TypeScript, Go, Rust Planned

Adding a new language requires implementing a single ILanguageParser interface — no changes to storage, indexing, or MCP tools.

Where is my data stored?

All index data is stored locally at:

~/.codecompress/{project-hash}.db
  • One SQLite database per project
  • The project hash is derived from the canonical project path
  • Contains: file metadata, parsed symbols, dependencies, FTS5 search indexes, snapshots
  • No data leaves your machine — no network calls, no telemetry

To clear the index for a project, delete the corresponding .db file. To clear everything, delete the ~/.codecompress/ directory.

Security

  • Read-only — never modifies your source files
  • Path traversal prevention — all file paths canonicalized and validated against the project root
  • SQL injection prevention — all queries use parameterized statements
  • Prompt injection safeguards — tool outputs are structured data; raw input is never echoed into freeform text
  • Local only — no network calls, no telemetry, your code stays on your machine

Building from Source

git clone https://github.com/MCrank/code-compress.git
cd code-compress
dotnet build CodeCompress.slnx
dotnet test --solution CodeCompress.slnx

To run the MCP server locally:

dotnet run --project src/CodeCompress.Server

To configure a client to use your local build:

claude mcp add --transport stdio codecompress -- dotnet run --project /absolute/path/to/src/CodeCompress.Server

CLI Tool (Optional)

A standalone CLI is available for testing and debugging outside of MCP:

dotnet tool install -g CodeCompress
codecompress index /path/to/project
codecompress outline /path/to/project

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.6.0 16 3/14/2026
0.5.0 35 3/13/2026
0.4.0 38 3/12/2026
0.3.0 35 3/12/2026
0.2.0 38 3/10/2026
0.1.0-preview 35 3/10/2026