← Back to directory
C

Context Mode

Community
Optimize context windows for AI coding agents.
Category
Dev Tools #199 of 438
Stars
★ 30.8k Very popular
Transport
stdio (local process)
Runtime
Node.js 22.5+ · Bun
Credentials
No credential needed
License
Other / unspecified
Last commit
Tools
11
54FMRS · D

Context Mode is designed for context governance in AI coding agents. Isolation, output filtering, indexed retrieval, caching, and session tracking can reduce context consumption. It supports many clients, but installation complexity, automatic routing, and hook coverage vary; users should evaluate local code execution, credential inheritance, and persistent indexing before deployment.

Strongest · Documentation 14/20 Weakest · Security and permissions 8/20

Reliability
10/20
Security and permissions
8/20
Maintenance
10/20
Documentation
14/20
Setup experience
12/20
Why each score
Reliability 10/20
The README describes MCP initialization, 11 tools, many adapters, SQLite backends, runtime requirements, and several recovery paths, so the happy path appears plausible. However, the server manifest is not cached, and there is no verifiable tool schema, implementation code, CI, or committed test evidence. The many hook, runtime, and database branches make error handling and edge behavior unverifiable statically, so the score is capped below 12 and deducted accordingly.
Security and permissions 8/20
The README states that sandbox calls use separate subprocesses and expose only stdout to context, and it discloses credential passthrough for gh, aws, gcloud, kubectl, and docker. Those claims provide some evidence of data-boundary awareness. However, the server can execute multiple languages, access local files, fetch external URLs, and use credentialed CLIs; the precise permission and network scope is not documented, nor is dangerous-operation confirmation. ctx_purge permanently deletes indexed content, and ctx_upgrade fetches the latest version and rebuilds configuration. There is no evidence of malware or covert exfiltration, but least privilege and confirmation controls are incomplete.
Maintenance 10/20
The repository is not archived, and the README contains maintenance signals, issue-tracking references, and an upgrade command. Still, 104 open issues and README badges do not establish release cadence, response quality, dependency maintenance, or a security-response process. Repository metadata says NOASSERTION while the README badge claims ELv2, creating license evidence inconsistency. Clear maintainer identity, versioning policy, and security contact evidence are absent, so this merits only a middle score.
Documentation 14/20
The README covers installation, configuration, verification, tool purposes, runtime prerequisites, cache TTL, indexing behavior, throttling, platform limitations, and some troubleshooting for many clients, with concrete configuration examples. Deductions apply because the manifest is unavailable, tool parameters and schemas are incomplete, authentication and network data-flow boundaries are underexplained, cost and confirmation behavior are not sufficiently documented, and the supplied README material is truncated at the session-continuity section.
Setup experience 12/20
The README provides setup and verification examples for many mainstream clients, with plugin and automatic-hook paths on some platforms. The score is reduced because setup commonly requires Node.js >=22.5, global installation, manual edits to several configuration or rules files, and platform-specific trust or feature flags. Client behavior differs substantially; some platforms rely on manual routing with stated roughly 60% compliance, and there is no manifest or executable connection-test evidence.

Static review · not runListed 2026-07-29

Read the FMRS scoring method →

Fit and risk

What it can accessReads local filesWrites / deletes local filesRuns commands or codeUses the networkConnects to a database

Best for

  • Developers using one of the supported AI coding CLIs, IDEs, or agents
  • Teams working with large codebases, logs, web pages, or batch queries
  • Users who need work-state recovery after context compaction

Not for

  • Users requiring a dedicated GUI MCP integration not listed as supported
  • Users who only need a simple MCP tool and do not want hooks, plugins, or local indexing
  • Environments that prohibit local script execution or access to local files, credentials, and network resources

Required permissions

  • Requires Node.js, Bun, or another listed runtime to execute locally.
  • Sandboxed scripts can read and process local files and can use authenticated CLIs such as gh, aws, gcloud, kubectl, and docker through inherited environment variables and configuration paths.
  • ctx_fetch_and_index requires URL fetching; indexed content is stored in SQLite databases under the user's local data directory.
  • With hooks or plugins enabled, the server can intercept selected tool calls, record session events, and apply routing rules.

Risks and side effects

  • Tools such as ctx_execute run code supplied by the user or agent; that code may read local files, invoke commands, or use inherited credentials.
  • Session and indexed content persist in local SQLite databases; ctx_purge permanently deletes all indexed content.
  • Hooks may block or redirect selected tool calls, and routing capabilities vary by client.
  • The README's savings percentages are project-reported metrics; actual results depend on tool output and usage.

Setup

Before you start

Runtime:Node.js 22.5+ · Bun

Other optional settings (4)
CONTEXT_MODE_PLATFORM optional Manually pins the platform identity (e.g. copilot-cli, antigravity-cli, codex) to override auto-detection; only needed for special install paths.
CONTEXT_MODE_DIR optional Set to an absolute writable root when Codex cannot write the default storage directory; sessions and indexed content live under it.
OPENCLAW_STATE_DIR optional State directory for the OpenClaw plugin installer, default /openclaw; only used when installing into OpenClaw.
COPILOT_HOME optional Set first if you use an isolated Copilot home, so the Copilot CLI finds the right hooks config.

Choose the configuration for the target client. The general MCP-only approach is to run npm install -g context-mode and configure the server command as context-mode; the README also provides the Claude Code command claude mcp add context-mode -- npx -y context-mode. For automatic routing and session tracking, configure the target client's hooks, plugin, or rules file as documented in the README.

.mcp.json
{"mcpServers":{"context-mode":{"command":"npx","args":["-y","context-mode"]}}}

Shown for Claude Code. Other clients may use a different file or key (VS Code uses "servers") — the configurator below converts it.

.vscode/mcp.json
{
  "servers": {
    "context-mode": {
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  }
}

Goes in your project's .vscode/mcp.json (VS Code uses a "servers" key).

Terminal
claude mcp add context-mode -- npx -y context-mode

Run it in a terminal; replace any <…> placeholders with your own values first.

Check that it works

Type `ctx stats` in your client session (or run /context-mode:ctx-doctor); if the ctx_* tools appear and return stats/diagnostics, the MCP server is connected.

Troubleshooting

  1. Confirm that the Node.js version meets the target client's requirements; many configurations require Node.js >= 22.5.
  2. Run context-mode doctor or the client's ctx doctor command to inspect runtimes, hooks, FTS5, versions, and MCP registration.
  3. Use ctx stats to verify that MCP tools are reachable and inspect savings statistics.
  4. Check configuration paths, command PATH, plugin trust state, and duplicate registration of MCP and plugin integrations.
  5. For Linux, older glibc, Windows, or native SQLite binding problems, follow the README's build prerequisites and self-healing guidance.

Things to try

Once connected, you can ask your AI assistant things like:

  • Run a JavaScript script via ctx_execute that counts lines of every TypeScript file in src and prints only the totals.
  • Fetch this documentation page with ctx_fetch_and_index, then use ctx_search to find its caching configuration section.
  • Show me ctx_stats and tell me how much context this session has saved.
  • Use ctx_batch_execute to run these git commands in one call and give me the summarized output.

Tools 11

ctx_batch_execute writes
Runs multiple commands and multiple searches in one call, with optional concurrency.
ctx_execute writes
Runs code in 12 languages in an isolated subprocess and returns only stdout to context.
ctx_execute_file read-only
Processes files in a sandbox without exposing raw file contents.
ctx_index writes
Chunks Markdown by headings and indexes it in SQLite FTS5.
ctx_search read-only
Searches indexed content and returns relevant snippets.
ctx_fetch_and_index writes
Fetches URLs, converts them to Markdown, and indexes them with TTL caching and batch-request support.
ctx_stats read-only
Shows context savings, call counts, and session statistics.
ctx_doctor read-only
Diagnoses runtimes, hooks, FTS5, versions, and registration state.
Show 3 more tools
ctx_upgrade writes
Upgrades from GitHub, rebuilds, and reconfigures hooks.
ctx_purge destructive
Permanently deletes all indexed content from the knowledge base.
ctx_insight read-only
Opens the hosted Insight dashboard in a browser.

Use cases

Reduce context usage from large command, log, web, and code-analysis outputs
Build persistent searchable indexes of local files or web pages
Preserve edits, git operations, tasks, errors, and user decisions across sessions
Use scripts for batch file analysis instead of loading large raw datasets into context

Supported clients

Claude Code
Gemini CLI
VS Code
JetBrains Copilot
GitHub Copilot CLI
Cursor
OpenCode
KiloCode
OpenClaw / Pi Agent
Codex
Kimi Code
Qwen Code
Antigravity IDEPartial support
Antigravity CLI
Kiro
ZedPartial support
Pi Coding Agent
OMP

Listed from the project's documentation, not tested by this site.

Overview

Context Mode is an MCP server for optimizing AI coding-agent context usage through MCP and hooks. It runs tool work in isolated subprocesses and returns only stdout to the context, while providing session memory, SQLite FTS5/BM25 indexing, targeted retrieval, batch execution, and routing support across many coding clients. The README claims roughly 98% reduction for typical tool output.

Similar servers

Context7 80 · B

Upstash's official server providing up-to-date third-party library docs for AI coding assistants

★ 63.3k · Tools 2 Compare with this →

Source revision 6006a3511ea2 Data synced 2026-10-19 Read the FMRS scoring method