Local code search MCP server for agents: natural-language queries return just the relevant snippets from a repo, on CPU with no API keys, using far fewer tokens than grep and file reads.
Context ModeMCP Server
Summary
MCP server and Claude Code plugin that keeps bulky tool output out of your context window, indexes it for search, and preserves session state across compaction.
Features
- Sandboxed script execution keeps raw tool output out of context
- Local SQLite FTS5 index for searching previously seen content
- Hooks preserve session state across context compaction
- Built-in stats and doctor commands plus optional status line
- Works with Claude Code, Gemini CLI, Cursor, Codex and more
Installation
Set up this MCP server in your favorite AI agent — copy a ready-made configuration below.
Description
Context Mode tackles the part of the context problem that bigger windows do not fix: every tool call dumps raw data into the conversation. A Playwright snapshot can cost tens of kilobytes, a page of GitHub issues even more, and after a long session the agent compacts and forgets which files it was editing. Context Mode sits between the agent and its tools to stop both leaks.
How it works
- Sandboxed execution. Instead of reading 47 files into context, the agent runs one script through
ctx_executeand only the printed result comes back. The project's own example turns a 700 KB read into about 3.6 KB. - Searchable knowledge base. Output and fetched pages are indexed into a local SQLite FTS5 store, so the agent can search what it already saw rather than re-reading it.
- Session continuity. Hooks record edits, tasks and your last requests so work resumes cleanly after the conversation is compacted.
- Savings you can see. Slash commands such as
ctx-statsandctx-doctorreport tokens saved and validate your setup, and an optional status line shows savings live.
It exposes 11 MCP tools (six sandbox tools plus meta-tools) and deliberately does not dictate how the model words its answers.
Install
On Claude Code, add the plugin from the marketplace for fully automatic routing, or register just the MCP tools with claude mcp add context-mode -- npx -y context-mode. It also supports Gemini CLI, Cursor, Codex, VS Code Copilot and other agent platforms, with hooks where the platform allows them. Requires Node.js. Licensed under Elastic License 2.0 (source-available, not OSI open source).
Related MCP Servers
See all Context Mode alternativesMCP: BashCut
by dongnguyenvie
MCP server and CLI for BashCut, a native macOS video editor: let Claude or Codex edit the open timeline, captions, color and exports through undoable commands.
Persistent memory for coding agents as a single Go binary — SQLite and FTS5 behind MCP, an HTTP API, a CLI and a TUI, with no Node, Python or Docker required.
Turso's hosted MCP server — manage Turso Cloud databases, branch them point-in-time and run SQL from a coding agent, authorised over OAuth with no API token to paste.