
Context Mode
MCP server that cuts coding agents' context-window use by sandboxing tool output.
About
Context Mode is a TypeScript MCP server for AI coding agents that keeps raw tool output out of the context window: large outputs are captured into a local sandbox and the agent receives compact summaries instead, with the author reporting up to 98% reduction in context consumed. It also persists session memory, tracking every edit, git operation, task, error, and user decision in a local SQLite database with FTS5 full-text search, retrieved via BM25, so sessions survive /compact and resume without relearning the codebase. It works across 17 platforms (Claude Code, Cursor, Codex, Gemini CLI, VS Code Copilot, JetBrains, Zed, and others) through MCP plus hooks, with zero telemetry. The project is source-available under the Elastic License v2.
What it can do
- Sandbox execution tools (ctx_execute, ctx_batch_execute, ctx_execute_file): only what you console.log() enters the conversation — raw stdout, file contents, and HTTP bodies stay out
- Session memory: edits, git operations, tasks, errors, and decisions persisted in local SQLite with FTS5 indexing, retrieved via BM25 search
- Multi-strategy knowledge search: BM25 plus Reciprocal Rank Fusion, Porter stemming, trigram substring tokenizers, proximity rerank, and typo correction
- TTL-aware web indexing (ctx_fetch_and_index): repeat lookups skip the network with per-call TTL
- Utility tools: ctx_stats (savings breakdown), ctx_doctor (diagnostics), ctx_upgrade, ctx_purge, ctx_insight (org analytics dashboard)
- Hooks on supported platforms automatically route tool output through the sandbox
- Routing across 17 platforms: Claude Code, Gemini CLI, VS Code Copilot, JetBrains Copilot, GitHub Copilot CLI, Cursor, OpenCode, KiloCode, OpenClaw, Codex CLI, Antigravity, Kiro, Zed, and more
- Fully local with zero telemetry: no cloud, no account, no data leaving the machine
Setup
- On Claude Code (v1.0.33+): run
/plugin marketplace add mksglu/context-mode, then/plugin install context-mode@context-mode. Restart Claude Code (or/reload-plugins). - Verify with
/context-mode:ctx-doctor— every check should pass. - For an MCP-only trial without hooks:
claude mcp add context-mode -- npx -y context-mode. - On other platforms (Gemini CLI, VS Code Copilot, JetBrains, and more):
npm install -g context-mode, then register the MCP server and hooks using the per-platform configs in the repository README.
Prerequisites
Node.js 22.5+ (or Bun); a supported agent client (Claude Code v1.0.33+ for the one-line plugin install).
Use cases
Works with
Trust score — 8/10
30K stars, 2,235 commits, and 195 releases show unusually active maintenance, and the local-only, no-telemetry architecture is fully auditable. The Elastic License v2 is source-available rather than OSI open source, which limits the openness score, and the 98% reduction figures are the author's own benchmarks rather than independently verified tests.
★ 30,066 GitHub stars
How the trust score is built
Full methodology →- Adoption · stars/downloads, log-scaled vs peers
- 9.0/10
- Maintenance · recency, releases, issue load
- 9.0/10
- Openness · license + docs
- 6.0/10
- Manual review · sanity read + red-flag check
- 8.0/10
- · 30,066 stars, 2,114 forks; on GitHub Trending repeatedly through Sep-Oct 2026
- · ELv2 license — source-available, free to use, not OSI open source
- · 2,235 commits, 195 releases; efficiency claims are author-reported benchmarks
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.