# Context Guardian

> Context Guardian is an open-source MCP server for ai models and llm tooling. Fail-open compaction proxy and MCP server that keeps long local-model sessions alive. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/luminarisoftwares/context-guardian
- **MCP Registry name:** io.github.LuminariSoftwares/context-guardian
- **Categories:** [AI models and LLM tooling](https://ai-powered.com/categories/ai-and-llm)
- **Listing updated:** 2026-11-18

## About

When a conversation is about to outgrow the model's context window, the proxy summarises older turns, keeps recent ones verbatim and forwards a request that fits. What it folds away is archived on disk, sealed in a hash chain you can verify, and indexed so a model can search it. The README's benchmark against a stub upstream shows a 40-turn session going from 1,130,722 tokens sent to 161,141, and notes that this is not a run against a real model.

It fails open: if a summary fails or anything in the proxy raises, the request goes upstream unchanged. It sits in front of OpenAI-compatible backends such as Ollama, LM Studio, vLLM and LiteLLM, and has a native engine for DeepSeek Harness. For Claude Code, hooks archive each session and this MCP server lets it search what was archived. The seal is described as tamper-evident, not tamper-proof.

It runs locally with no telemetry beyond one optional PyPI version check, and receipts record counts only, never message text. Only Ollama and DeepSeek Harness are marked as tested.

## Features

- **Compaction proxy:** Summarises old turns so requests fit the context window.
- **Fails open:** Any failure sends the original request upstream untouched.
- **Sealed archive:** Folded-away spans are stored in a verifiable hash chain.
- **Searchable recall:** Find archived originals with a recall command or MCP tools.
- **Savings receipts:** Count tokens kept out of the window without storing text.
- **Claude Code hooks:** Archive Claude Code sessions into the same searchable store.

## Good for

- Stop a local-model coding session dying at the context limit
- Search what was compacted earlier in a long session
- Verify an archive has not been tampered with
- Archive Claude Code sessions for later recall

## Install

### Claude Code (Terminal)

```sh
claude mcp add context-guardian -- uvx context-guardian
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "context-guardian": {
      "command": "uvx",
      "args": [
        "context-guardian"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "context-guardian": {
      "command": "uvx",
      "args": [
        "context-guardian"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "context-guardian": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "context-guardian"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "context-guardian": {
      "command": "uvx",
      "args": [
        "context-guardian"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "context-guardian": {
      "command": "uvx",
      "args": [
        "context-guardian"
      ]
    }
  }
}
```

## Tools

- `get_seal_status`: Check the archive's hash-chain seal from inside a client.

## FAQ

### Does it send data anywhere?

The README says nothing leaves the machine except your requests to your own backend and one optional PyPI version check.

### What happens if summarisation fails?

The request goes upstream exactly as the client sent it.

### Which backends are tested?

Ollama and DeepSeek Harness 0.1.2-alpha.2; others are configured from documentation and untested.

### How do I run the proxy?

Run pip install context-guardian then context-guardian, and point OPENAI_BASE_URL at http://localhost:8786/v1.

### Is Context Guardian free?

Yes. Context Guardian is open source, so you can use and self-host it for free.

### How do I add Context Guardian to Claude Code?

Run this command in your terminal: claude mcp add context-guardian -- uvx context-guardian

### What are the best alternatives to Context Guardian?

The closest alternatives to Context Guardian are headroom, omniget, next-ai-draw-io, mcp-for-blender and Claude Code Ultimate Guide.

## Where this comes from

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

## Alternatives

- [headroom](https://ai-powered.com/mcp/headroom-3): headroom is an open-source MCP server for ai models and llm tooling.
- [omniget](https://ai-powered.com/mcp/omniget): omniget is an open-source MCP server for ai models and llm tooling.
- [next-ai-draw-io](https://ai-powered.com/mcp/next-ai-draw-io-2): next-ai-draw-io is an open-source MCP server for ai models and llm tooling.
- [mcp-for-blender](https://ai-powered.com/mcp/mcp-for-blender): mcp-for-blender is an open-source MCP server for design and media.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [unity-mcp](https://ai-powered.com/mcp/unity-mcp-2): unity-mcp is an open-source MCP server for ai models and llm tooling.
- [fastapi_mcp](https://ai-powered.com/mcp/fastapi-mcp): fastapi_mcp is an open-source MCP server for ai models and llm tooling.
- [tyk](https://ai-powered.com/mcp/tyk): tyk is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/context-guardian
