Context Mode logo

Context Mode

Keeps coding-agent tool output out of context by sandboxing commands and searching locally indexed results.

Install Context Mode

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "context-mode": {
      "command": "npx",
      "args": [
        "-y",
        "@context-mode/cli"
      ]
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Claude Code command
claude mcp add --transport stdio context-mode -- npx -y @context-mode/cli

Run in your terminal. Add --scope project to share it with your team through .mcp.json.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y @context-mode/cli

Process exited before answering initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

context-mode MCP server runs commands and data collection in a local sandbox, storing full results in a per-project SQLite database while returning only requested output to the agent. Its MCP tools support code execution, batch processing, indexing, search, session resumption, diagnostics, upgrades, statistics, and cleanup. Hooks integrate the workflow with 11 coding agents, and local operation keeps indexed data and usage information on the machine. Reach for context-mode when command output, file contents, or long sessions consume too much agent context.

Use cases

  • Run shell commands without returning full output to the agent
  • Index project files and search only relevant sections
  • Resume long sessions after context compaction
  • Batch commands and query their combined results
  • Diagnose, upgrade, or remove the local installation

Key features

  • Local sandboxed command execution
  • SQLite indexing for files, text, URLs, and command output
  • Searchable session state and compact resume blocks
  • Hooks for supported coding agents
  • Installation diagnostics and lifecycle management
  • Local-only operation with offline search and indexing

Tools9

What Context Mode lets your agent do. Expand a tool for its parameters.

Self-reported~157 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

59/59 checks healthy over the last 45d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 11d ago via OSV.dev · @context-mode/cli (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars34kStargazers on the source repository.
npm downloads1.5kPackage downloads in the last 30 days.
Last commit4d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed9Callable tools this server registers over MCP.
Directory activity20 viewsConfig copies, upvotes, and views on AllMCPs.

How Context Mode works

What context-mode does

context-mode reduces the amount of tool output inserted into a coding agent's context window. Commands, scripts, file contents, and URLs can be processed locally, with the full results stored in a SQLite index rather than returned wholesale. The agent receives the output a command prints or the matching portions requested through search.

The plugin stores one context.db per project beneath ~/.context-mode. It is designed for local use and can continue working offline after installation for sandbox execution, file indexing, and search. Indexed data and usage information remain on the machine.

A code-oriented workflow lets an agent write a short script to process data and return only the script's printed output. Batch execution can also collect results from many commands, index them, and search them through one MCP call.

How it works

The MCP tools provide the agent-facing interface, while hooks connect the workflow to supported coding agents. Tool output is handled in the local sandbox and persisted to the project's SQLite database. Search then retrieves relevant sections instead of requiring the agent to load an entire command result or document.

Session state can be resumed through a compact state block of up to 2,048 bytes, or by retrieving a complete row using its sequence identifier. This supports continuing work after context compaction without placing the full stored transcript back into the context window.

The plugin makes local processes and uses the runtimes available on the machine. After installation, sandbox execution, indexing, and search do not require a network connection.

Setup and configuration

The package requires Node.js 24.15.0 or later. On Windows, Git for Windows is also required because shell tools run through Git Bash.

Installation is agent-specific. The supported installation paths include:

  • Claude Code: add the mksglu/context-mode marketplace and install context-mode@context-mode.
  • Codex: add the marketplace, install the plugin, then run npm i -g context-mode and context-mode setup --agents codex to trust the hooks.
  • Gemini CLI: install the extension from the GitHub repository.
  • Qwen Code: install the context-mode extension from GitHub.
  • Pi: install npm:context-mode.
  • OMP: install the context-mode plugin.

The repository also lists installation paths for OpenCode, Copilot CLI, Kiro, VS Code, and ZCode. Each agent's installation block includes corresponding update, check, and removal commands. The ctx_doctor tool reports installation checks as PASS or prints a remediation command.

Tools and capabilities

  • ctx_execute runs code or a shell command in the sandbox and returns what it prints.
  • ctx_batch executes multiple commands, indexes their output, and searches the results in one request.
  • ctx_index adds a file, text, or URL to the local project database.
  • ctx_search searches indexed content and returns matching sections.
  • ctx_resume returns the local state block or one complete stored row by sequence number.
  • ctx_stats reports how much output remained outside the agent's context.
  • ctx_doctor checks the installation and provides fixes for failed checks.
  • ctx_upgrade installs, upgrades, or uninstalls the plugin and replaces older context-mode entries.
  • ctx_purge removes indexed data by session, source, or project.

Limitations and notes

The plugin is source-available under the Elastic License 2.0. It is separate from Context Mode Gateway, a hosted service with its own account and subscription; the local plugin does not require that service. The local database is project-scoped, and deleting indexed data requires using the purge capability or managing the local data directly.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Context Mode

context-mode is an MCP server that connects coding agents to a local sandbox and SQLite project index. Its main tools execute commands, batch and search output, index files or URLs, resume session state, report context savings, diagnose installations, manage upgrades, and purge stored data without returning all results to the agent.

Install it through the package or extension workflow for your coding agent. Claude Code, Codex, Gemini CLI, Qwen Code, Pi, OMP, OpenCode, Copilot CLI, Kiro, VS Code, and ZCode have agent-specific installation paths; Node.js 24.15.0 or later is required.

context-mode lists support for Claude Code, Codex, Gemini CLI, Qwen Code, Pi, OMP, OpenCode, Copilot CLI, Kiro, VS Code, and ZCode. The integration can include MCP tools, hooks, and skills depending on the agent.

Yes, local sandbox execution, file indexing, and search work offline after installation. The plugin stores project indexes and usage data on the machine under `~/.context-mode`; network access is not required for those local operations.

context-mode requires Node.js 24.15.0 or later. Windows users also need Git for Windows because the plugin runs shell tools in Git Bash.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewContext Mode AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/context-mode?style=directory)](https://allmcps.com/mcp/context-mode)
HTML Embed
<a href="https://allmcps.com/mcp/context-mode"><img src="https://allmcps.com/api/badge/context-mode?style=directory" alt="Context Mode on AllMCPs" /></a>