# Context Engine

Prepares dense, noise-free context from logs, RAG chunks, and code for LLMs. It trims boilerplate repetitions and sorts key evidence within a token budget.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 326
- Author: melonelish
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/melonelish/context-engine
- Updated: 2026-07-11
- HTML: https://affpapa.org/en/nevibecode/mcp/context-engine

## What it does

This server sits between raw application data and language models. Rather than sending raw text dumps, it discards duplicated noise and prioritizes signals. It provides three dedicated operational modes: logs for traceback filtering, rag for re-ranking retrieved knowledge, and code for pinning down bug hotspots.

The pipeline standardizes entries, validates schemas, and crops payload to fit small, medium, or large budgets. The server registers a single tool called `compress_context`. When input validation fails, it replies with a structured error payload containing an error code and a corrective hint.

Running it requires Python between 3.11 and 3.13. Built-in size guards reject text blocks over 200000 characters and structured lists exceeding 64 items. Payloads above 2000000 bytes fail validation immediately.

## Requirements
- Needs: Python and uv (commands run via uvx)

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add context-engine -- uvx melonelish-context-engine
```
uvx runs the command named after the package; if the README names another one, use uvx --from melonelish-context-engine <command>

### Codex

**Platform CLI**
```bash
codex mcp add context-engine -- uvx melonelish-context-engine
```
uvx runs the command named after the package; if the README names another one, use uvx --from melonelish-context-engine <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "context-engine": {
            "command": "uvx",
            "args": [
                "melonelish-context-engine"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from melonelish-context-engine <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "context-engine": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "melonelish-context-engine"
            ]
        }
    }
}
```
uvx runs the command named after the package; if the README names another one, use uvx --from melonelish-context-engine <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add context-engine uvx melonelish-context-engine
```
uvx runs the command named after the package; if the README names another one, use uvx --from melonelish-context-engine <command>

## When to use it
- clean repetitive error logs down to the root cause
- prioritize RAG chunks based on question relevance
- extract relevant repository files for targeted bug fixing
- compress prompt context to match token budget limits

## Example prompts
- Compress this crash traceback using context-engine to pinpoint the root cause
- Rank retrieved knowledge chunks via `compress_context` for a query about payment failures
- Filter candidate repository files down to the minimal context needed for this issue

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 386989
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33918
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81115
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119160
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47392
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43872

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
