cctx-optimizer

A local tool that helps an AI coding assistant use less conversation context across sessions. It indexes the codebase, shortens tool results, summarizes turns, and combines older session information; it runs through Ollama without API calls.

In plain words
What is it for?
Use it when working on large codebases or across many coding sessions where context size and repeated tool output are a concern.
Why use it?
Long coding sessions can consume a large amount of context and repeat information. This tool reduces that repeated context and keeps useful information available between sessions.

MCP server for Claude CodeCodexCursorGemini CLIOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add mcp/anil7948/cctx/cctx-optimizer
Clone the repo
git clone --depth 1 https://github.com/anil7948/cctx

Made for: Claude Code, Codex, Cursor, Gemini CLI, OpenCode.

Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

cctx-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

listed in the official MCP registry · 9 lines

What it actually says

{ "cctx-optimizer": { "command": "npx", "args": [ "-y", "cctx-optimizer" ] } }

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 9 lines scan A dbf9ef0ba9ab

Subscribe to this mod's changes

cctx-optimizer is an MCP server published in the GitHub repository anil7948/cctx (3 stars, last pushed 2mo ago), licensed MIT. Its token cost is not measured: an MCP server costs its tool schemas, not its config file. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other mcp servers, from other repositories

tokensaver-mcp

MCP server "tokensaver-mcp" as configured in pozii/tokensaver. Runs locally from the tokensaver-mcp Python package.

pozii/tokensaver · not measured

m3-memory

Give your AI agent a memory — local-first, private, easy to install. Guided setup wizard; works out of the box on your own machine, no cloud. For everyday agent users, homelabs, and developers alike · 99.2% LongMemEval-S retrieval @ k=10 · Works with Claude · Gemini · Antigravity · OpenCode · OpenClaw · Hermes · any…

skynetcmd/m3-memory · not measured

tooltrim

Drop-in compression for LLM agent tool outputs. Shrink bloated HTML/JSON/log results before they re-enter context — cut tokens, stay on-task, keep full output retrievable. Runs locally from the tooltrim Python package.

nac7/tooltrim · not measured

session-migrator

MCP server "session-migrator" as configured in liangyuan0219/session-migrator. Runs locally from the session-migrator Python package.

liangyuan0219/session-migrator · not measured

mcp-ollama

MCP server "mcp-ollama" as configured in true-alter/mcp-ollama. Runs locally from the @truealter/mcp-ollama npm package.

true-alter/mcp-ollama · not measured

ai-guardian

Governed observability + governance for on-endpoint local LLMs (Ollama): model inventory/provenance, a deterministic secrets/PII/jailbreak prompt scanner, allow/deny policy, and route-through guarding — the complement to IGEL AI Armor, with a built-in governance harness (audit, budget, undo, risk tiers). Runs locally…

AIops-tools/AI-Guardian · not measured