# LatentGate

Local MCP server that trims logs and JSON payloads before sending them to LLM context. Runs offline without API keys to cut token usage.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 25
- Author: KathanModh259
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/KathanModh259/latent-gate
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/latentgate

## What it does

LatentGate filters heavy error logs and structured data dumps before they reach the model. It operates deterministically. Web links and raw code snippets stay untouched byte for byte.

The default optimization folds repetitive logs into summary ranges showing first and last items. Because of this, unique identifiers inside folded blocks are dropped. You have to switch to `level="lossless"` if you need every line preserved.

Running the tool requires Python 3.10+ and the `uvx` runner. Initial dependency fetching takes extra time before later starts stabilize at two seconds. It also integrates with Ollama for vision tasks and exports metrics to Prometheus.

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

## Install

### Claude Code (native platform)

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

### Codex

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

### Cursor

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

### GitHub Copilot

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

### Gemini CLI

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

## When to use it
- shrink repetitive application logs before feeding them to the agent
- reduce context token consumption on heavy JSON payloads
- clean long documents without losing code blocks or URLs
- process bulky prompt context locally without external API keys

## Example prompts
- Inspect `app.log` through LatentGate and identify why checkout failed
- Compress `data.json` and summarize the error payload
- Parse repetitive log lines in `service.log` using lossless mode

## 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
