Context Mode
An MCP server that optimizes AI coding agent context windows by sandboxing tool output, achieving up to 98% context reduction across 14 platforms.
At a Glance
Fully free and open source under Elastic License 2.0. Install via npm, use on all 14 supported platforms with no account required.
Engagement
Available On
Alternatives
Listed May 2026
About Context Mode
Context Mode is an MCP server that solves the context window problem for AI coding agents by sandboxing raw tool output, maintaining session continuity across compactions, and compressing LLM output tokens. It supports 14 platforms including Claude Code, Cursor, VS Code Copilot, Gemini CLI, and more, delivering up to 98% context savings on tool outputs like Playwright snapshots, GitHub issues, and log files. The tool operates entirely locally with no telemetry, no cloud sync, and no account required.
- Context Saving via Sandbox Tools — Install globally with
npm install -g context-mode, then add the MCP server to your platform config. Raw tool output (e.g., 56 KB Playwright snapshots) is processed in an isolated subprocess; only stdout enters the context window, achieving up to 99% reduction. - Session Continuity — Hooks (PreToolUse, PostToolUse, PreCompact, SessionStart) capture every file edit, git operation, task, error, and user decision into a local SQLite database. After context compaction, the model resumes from your last prompt with full working state restored.
- Think in Code Paradigm — Instead of reading 50 files into context, the agent writes a script that processes them and logs only the result. One
ctx_executecall replaces dozens of Read/Bash calls, saving 100x context. - Output Compression — Enforces terse, caveman-style responses from the LLM — dropping filler, pleasantries, and hedging — achieving 65–75% output token reduction while preserving full technical accuracy.
- 11 Sandbox Runtimes —
ctx_executesupports JavaScript, TypeScript, Python, Shell, Ruby, Go, Rust, PHP, Perl, R, and Elixir. Bun is auto-detected for 3–5x faster JS/TS execution. - FTS5 Knowledge Base —
ctx_indexandctx_fetch_and_indexchunk and store content in SQLite FTS5 with BM25 ranking, Porter stemming, trigram search, Reciprocal Rank Fusion, and a 24-hour TTL cache for fetched URLs. - Personal Analytics Dashboard —
ctx_insightopens a local web UI with 90 metrics, 37 insight patterns, and 4 composite scores (productivity, quality, delegation, context health) across 23 event categories. - Security & Permission Enforcement — Inherits Claude Code's
permissions.deny/allowrules and extends them into the MCP sandbox. Network fetch hardening blocks cloud metadata endpoints, dangerous URL schemes, and optionally RFC1918 ranges viaCTX_FETCH_STRICT=1. - 14-Platform Support — Works with Claude Code (plugin marketplace), Cursor, VS Code Copilot, JetBrains Copilot, Gemini CLI, OpenCode, KiloCode, OpenClaw, Codex CLI, Qwen Code, Antigravity, Kiro, Zed, and Pi Coding Agent.
Community Discussions
Be the first to start a conversation about Context Mode
Share your experience with Context Mode, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open source under Elastic License 2.0. Install via npm, use on all 14 supported platforms with no account required.
- All 11 MCP tools (ctx_execute, ctx_batch_execute, ctx_execute_file, ctx_index, ctx_search, ctx_fetch_and_index, ctx_stats, ctx_doctor, ctx_upgrade, ctx_purge, ctx_insight)
- 14-platform support
- Session continuity via SQLite
- FTS5 knowledge base with BM25 ranking
- Personal analytics dashboard
Capabilities
Key Features
- Context window sandboxing with up to 99% output reduction
- Session continuity across context compactions via SQLite event tracking
- Think in Code paradigm — agent writes scripts instead of reading files
- 65–75% output token compression via terse response enforcement
- 11 sandbox language runtimes (JS, TS, Python, Shell, Ruby, Go, Rust, PHP, Perl, R, Elixir)
- FTS5 knowledge base with BM25 ranking, Porter stemming, and trigram search
- Reciprocal Rank Fusion for multi-strategy search merging
- 24-hour TTL cache for fetched and indexed URLs
- Personal analytics dashboard with 90 metrics and 4 composite scores
- Security permission enforcement inherited from Claude Code settings
- Network fetch hardening blocking cloud metadata and dangerous URL schemes
- 14-platform support including Claude Code, Cursor, VS Code Copilot, Gemini CLI, and more
- Automatic Bun detection for 3–5x faster JS/TS sandbox execution
- No telemetry, no cloud sync, fully local SQLite storage
Integrations
Demo Video

