Context Mode
by mksglu
Context Mode is a privacy-first MCP server that acts as a virtualization layer for context, solving the two biggest problems AI coding assistants face: context window bloat and session discontinuity. It sandboxes tool execution so raw data output never enters the LLM context window, reducing context consumption by approximately 98 percent — a 315 KB output becomes just 5.4 KB in context. The server provides six core sandbox tools: ctx_execute for running code in 11 programming language runtimes, ctx_batch_execute for multiple commands in one call, ctx_execute_file for processing files without raw export, ctx_index for chunking markdown into an FTS5 database with BM25 ranking, ctx_search for querying indexed content with fuzzy matching, and ctx_fetch_and_index for fetching URLs and indexing their content. Session continuity is maintained through SQLite-backed tracking of file edits, git operations, tasks, errors, and user decisions, which are automatically injected when conversations compact or resume. The search system features a three-tier fuzzy fallback: Porter stemming, trigram tokenization, and Levenshtein distance correction. All data stays local with no cloud sync, telemetry, or account requirements.
Installation
Key Features
- ✓98% context savings — sandboxed execution keeps raw data out of context windows
- ✓Session continuity via SQLite-backed tracking that persists across context compaction
- ✓FTS5 knowledge base with BM25 ranking, Porter stemming, and Levenshtein fuzzy matching
- ✓11 programming language runtimes available in isolated sandboxes
- ✓Multi-platform support — works with Claude Code, Gemini CLI, Cursor, Codex CLI, and 5 more
- ✓Privacy-first architecture — no cloud sync, no telemetry, all databases local
Use Cases
- →Maintaining full session context during extended coding sessions across context compaction events
- →Indexing and searching large codebases or documentation without consuming context window tokens
- →Executing batch operations across many files while keeping raw diffs out of context
- →Fetching and indexing external documentation or web pages with BM25-ranked retrieval
- →Running polyglot code in 11 different runtimes within sandboxed environments