# lcc — Local Context Compiler

> lcc — Local Context Compiler is a free MCP server for ai models and llm tooling. Trim old tool outputs from agent context while keeping the rest exactly as written. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI, Self-hosted, macOS, Linux, Windows
- **Repository:** https://github.com/lucasmartins-ai/lcc
- **MCP Registry name:** io.github.lucasmartins-ai/lcc
- **Categories:** [AI models and LLM tooling](https://ai-powered.com/categories/ai-and-llm), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-23

## About

lcc takes a different route from summary-based compaction. It removes tool outputs the model no longer needs, stores them in a local content-addressed stash, and leaves every user and assistant message byte for byte. A removed block is replaced by a placeholder giving its line count and size, and recall retrieves it by hash, re-checking the hash on read. Each run writes a JSON report, and explain gives the reason for each drop.

The README reports figures from its author's own sessions: one Claude Code session of 193 messages fell from 57,083 to 28,807 tokens with all 43 user and assistant messages intact, while across 299 long sessions the median cut was 21.8%. In a pre-registered test on 172 requests, an agent using the stashed context matched full-context performance on file recall with 36.6% fewer tokens. These are the author's measurements and the README invites readers to run measure-session on their own history.

Default judging runs on the CPU in plain Python with no API key or network. A remote jev provider is opt-in only and needs a TypeSafe key. It installs from PyPI as local-context-compiler (not lcc), also works as a Claude Code plugin that replaces the /compact summary, and serves seven tools over stdio.

## Features

- **Verbatim compaction:** Kept spans are byte-identical to the source.
- **Recallable stash:** Removed outputs live in a local store and return by hash.
- **Audit reports:** A JSON report per pass plus an explain command for each drop.
- **Offline by default:** Rules and local providers need no API key or network.
- **Session measurement:** measure-session prints counts only on your own sessions.
- **Claude Code plugin:** Replaces the /compact summary, with fallback to the built-in one on failure.

## Good for

- Shrink a long Claude Code session without losing exact error messages
- Compact a document against a stated question
- Measure how many tokens your sessions could save
- Review why each block of context was kept or dropped

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add lcc -- uvx local-context-compiler
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "lcc": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add lcc -- uvx local-context-compiler
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.lcc]
command = "uvx"
args = ["local-context-compiler"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user lcc uvx -- local-context-compiler

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "lcc": {
      "command": "uvx",
      "args": [
        "local-context-compiler"
      ]
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 2 of 7 tools read data; 5 names don't say. From the server's own tool labels and tool names; not verified by us.

- `compact`: Compact a document or transcript
- `compact_transcript`: Compact an agent transcript
- `recall`: Retrieve a removed output by hash
- `inspect` (name suggests: reads): Inspect compaction data
- `prepare`: Prepare context for compaction
- `explain` (name suggests: reads): Explain why blocks were kept or dropped
- `intake`: Intake of material for compaction

## FAQ

### How do I install lcc — Local Context Compiler?

pip install "local-context-compiler[tiktoken]"; the PyPI name is local-context-compiler, since pip install lcc gets an unrelated package.

### Does lcc — Local Context Compiler send my context anywhere?

Not by default. Only the opt-in jev provider contacts the TypeSafe API, and LCC_DISABLE_NETWORK=1 disables it.

### Can I get removed output back?

Yes, with recall on the hash shown in the placeholder.

### Does the plugin need special settings?

The README says it needs Claude Code 2.1.274 or later with CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1.

### Is lcc — Local Context Compiler free?

Yes. lcc — Local Context Compiler is free to use.

### How do I add lcc — Local Context Compiler to Claude Code?

Run this command in your terminal: claude mcp add lcc -- uvx local-context-compiler

### What are the best alternatives to lcc — Local Context Compiler?

The closest alternatives to lcc — Local Context Compiler are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

## Where this comes from

- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/lcc-local-context-compiler
