MCP server that slashes context usage by up to 98%: sandbox execution, SQLite session continuity, and automatic routing keep raw data out of your conversation.
Before you start
Claude Code with MCP support. Node.js 18+ or Python 3.10+. Install via npm: npm install -g context-mode-mcp then add the server to your Claude Code settings.json.
Install Context Mode globally and add it to your Claude Code settings.json as an MCP server. Restart Claude Code after adding. You should see context-mode tools appear in your session. The server stores everything locally with no cloud sync.
Without hooks, Context Mode saves ~60% of context by redirecting data to sandbox. With routing hooks enabled, savings reach 98%. Hooks intercept every tool call and automatically route data-heavy operations away from the conversation. Add the hooks to your Claude Code settings.json after verifying the MCP server is working.
Instead of letting large outputs enter conversation history, route them through the sandbox. The sandbox executes code in an isolated subprocess across 11 language runtimes and returns only the relevant portion to context. A full Playwright snapshot (56 KB) becomes a 299-byte extract.
Context Mode indexes your project files into an SQLite FTS5 knowledge base. Instead of reading large files into context, ask Claude to search the knowledge base for relevant snippets. BM25 scoring with Porter stemming returns the most relevant passages, not the whole file.
Context Mode tracks every file edit, git operation, task, and decision in SQLite. When Claude Code compacts or you start a new session, ask Context Mode to restore the session snapshot. It reconstructs the working state without re-reading every file.
Core Context Mode MCP capabilities for reducing context bloat.
| Command / Skill | What it does | When to use it |
|---|---|---|
Sandbox execution | Run code in isolated subprocesses across 11 language runtimes, only stdout enters context | Any tool call with large output: web scraping, test runs, log analysis, file parsing |
FTS5 knowledge base search | BM25 full-text search over indexed project files, returns relevant passages, not full files | Finding specific code patterns, config values, or decisions without reading entire files |
Session snapshot recoveryadvanced | SQLite-tracked session state (file edits, git ops, tasks, decisions) survives compaction | Starting a new session or after context compaction, restores working state instantly |
Routing hooksadvanced | PreToolUse hooks that automatically redirect data-heavy operations to sandbox (~98% context savings) | Enable after verifying MCP server works, provides maximum context reduction automatically |
15 platform integrationsadvanced | Works with Claude Code, Antigravity CLI, VS Code Copilot, Cursor, JetBrains, and 10+ others | Switching AI tools, the same MCP server and knowledge base work across platforms |