context-mode
Installation

Zed

Install context-mode in Zed, an MCP-only editor that registers context-mode through context_servers with advisory AGENTS.md routing.

Zed is a code editor with first-class MCP support but no hook pipeline. context-mode runs purely as an MCP server registered in Zed's context_servers configuration, so routing the data-heavy work into the sandbox is driven by the AGENTS.md instruction file rather than enforced by hooks.

Zed is MCP-only. There is no hook adapter, so context-mode cannot intercept tool calls automatically. The model follows the AGENTS.md routing rules voluntarily, which lands at roughly 60% adherence. See Tool selection for how routing decisions are made.

Install

Install the package globally first, then register the server and add the routing file.

Check the prerequisites

You need Node.js 22.5+ (or Bun) on your PATH, and Zed installed. The MCP server and sandbox run on this runtime.

Check the runtime
node --version

Install the package

This installs the MCP server and the context-mode command line.

Global install
npm install -g context-mode

Register the MCP server

Add context-mode to the context_servers object in Zed's settings file at ~/.config/zed/settings.json (on Windows, %APPDATA%\Zed\settings.json). Zed uses context_servers instead of mcpServers. The args and env fields are optional for context-mode, but are shown here to match Zed's custom MCP server shape.

~/.config/zed/settings.json
{
  "context_servers": {
    "context-mode": {
      "command": "context-mode",
      "args": [],
      "env": {}
    }
  }
}

context-mode detects Zed from any of:

  • the MCP clientInfo handshake
  • the ZED_SESSION_ID or ZED_TERM environment variables
  • the presence of ~/.config/zed/

Force it with CONTEXT_MODE_PLATFORM=zed if needed.

Add the routing instructions

Zed has no hook support, so routing is enforced only by AGENTS.md. Copy it to your project root — context-mode does not auto-write it into your git tree.

Copy the routing instructions
cp node_modules/context-mode/configs/zed/AGENTS.md ./AGENTS.md

Zed reads AGENTS.md natively, and the rules in it tell the model to send analysis, parsing, and large command output through the ctx_execute and ctx_search sandbox tools instead of into the context window. Tool names appear as mcp:context-mode:ctx_batch_execute, mcp:context-mode:ctx_search, and so on.

Restart Zed

Restart Zed, or just save settings.json — Zed auto-restarts context servers on config change.

Verify your savings

Confirm context-mode is actually saving you tokens, not just that the tools respond.

Check the server is active

Open the Agent Panel (Cmd+Shift+A), go to settings, and check the indicator dot next to "context-mode" — green means active.

Check the savings in chat

In the agent chat, type ctx stats to see the tokens saved and the context-window savings ratio for the session. Run a few data-heavy operations, then re-check.

ctx stats is an in-chat command that invokes the ctx_stats MCP tool (per AGENTS.md), not the standalone CLI below. Because Zed has no hooks, routing is enforced only by AGENTS.md (~60% compliance), so ctx stats is the primary way to confirm savings are real.

Confirm the install

Run context-mode doctor (the standalone CLI, distinct from the in-chat ctx doctor MCP tool) to confirm context-mode is registered under context_servers in ~/.config/zed/settings.json. It checks the language runtimes, the FTS5 knowledge base, and MCP registration.

Confirm the install
context-mode doctor

Two doctor lines are expected on this MCP-only host and are not failures:

Doctor outputWhy it appears
warn that Zed is MCP-only (no hooks)Zed has no hook adapter; routing rides on AGENTS.md.
Zed: not installed — using standalone MCP modeZed has no marketplace plugin to version-check.
CommandTypeUse it to
ctx statsIn-chat MCP tool (ctx_stats, per AGENTS.md)See tokens saved and the savings ratio for the session.
ctx doctorIn-chat MCP toolDiagnose from inside the agent chat.
context-mode doctorStandalone CLIConfirm context_servers registration and runtimes.

On Windows, context-mode doctor checks ~/.config/zed/settings.json even if you edited %APPDATA%\Zed\settings.json — the MCP server still works, but the doctor cannot verify it. The CLI also resolves the platform from environment variables and the config directory rather than the MCP handshake, so on Windows — where neither the ZED_* variables nor ~/.config/zed/ are present — it may not detect the Zed adapter at all. Set CONTEXT_MODE_PLATFORM=zed to force it.

A clean doctor run plus a climbing ctx stats savings ratio means the MCP server is reachable and the model is honoring the AGENTS.md routing.

On this page