context-mode
Installation

Other MCP clients (unofficial)

A generic, best-effort guide to running context-mode in any MCP-capable client that is not officially supported yet: register the MCP server and steer routing with an AGENTS.md file.

context-mode is a standard MCP server, so any client that speaks the Model Context Protocol can run it. This page is a generic, best-effort setup for hosts context-mode does not officially support yet. Those clients are unverified, so treat everything here as a starting point: register context-mode as an MCP server, then steer the agent toward the ctx_* tools with a routing instruction file the host reads.

This is an unofficial, generic MCP setup. It has not been verified on your specific client and may have bugs. Routing is advisory only — unsupported clients expose no hooks, so the agent is never forced to send large output through the sandbox. If you hit a problem, please report it so the team can add first-class support.

Install

context-mode runs as an MCP server in any compatible client. The only required work is adding it to the client's MCP configuration; a global install is optional.

(Optional) Install the global binary

Skip this step to run context-mode with npx and no global install. Install it globally only if you prefer a fixed binary on your PATH.

Optional global install
npm install -g context-mode

Register the MCP server

Add context-mode to your client's MCP server configuration. Most MCP clients use a standard mcpServers block; consult your client's docs for the exact file path. Use the npx form for no global install, or the context-mode command if you installed it globally.

Standard mcpServers entry (npx, no global install)
{
  "mcpServers": {
    "context-mode": {
      "command": "npx",
      "args": ["-y", "context-mode"]
    }
  }
}
When context-mode is installed globally
{
  "mcpServers": {
    "context-mode": {
      "command": "context-mode",
      "args": []
    }
  }
}

The npx form needs Node 22.5+ or Bun available on your PATH.

Add a routing instruction file

Unsupported clients expose no hooks, so the only way to steer the agent toward the ctx_* tools is an instruction file the host reads. Drop an AGENTS.md at your project root telling the model to route data-heavy work through the sandbox. Most MCP clients read AGENTS.md natively; if yours uses a different convention, use that filename instead.

AGENTS.md
# Routing rules for context-mode

Use the context-mode MCP tools instead of dumping raw output into context:

- Analyze, count, filter, parse, or transform data → write code with
  `ctx_execute` and `console.log` only the answer.
- Gather lots of state at once → `ctx_batch_execute`.
- Follow-up questions over indexed data → `ctx_search`.
- Fetch a URL → `ctx_fetch_and_index`, then `ctx_search`.

Do not read large files or raw command output into context to analyze them.

See tool selection for the full routing hierarchy this file is summarizing.

What you get on this host

The ctx_* tools are fully available once the server is registered: the agent can run code with ctx_execute, gather state with ctx_batch_execute, search prior results with ctx_search, and index content with ctx_index. What differs from a supported host is enforcement. On a hooked host, routing of large output is mandatory; here it is advisory, carried only by the AGENTS.md file. Savings depend on how closely the agent follows that file, so they vary by client and by session.

Verify

If your client exposes a terminal, confirm the install with the doctor. It checks language runtimes, the FTS5 knowledge base, and MCP server registration, then reports anything that needs attention.

If you skipped the optional global install, run the doctor through npx — there is no context-mode binary on your PATH without it:

Verify the setup (no global install)
npx -y context-mode doctor

If you did install globally in step 1, the binary is on your PATH:

Verify the setup (global install)
context-mode doctor

A clean run means the MCP server is reachable. If your client supports slash commands, you can also try a ctx_* tool directly to confirm the agent can reach them.

On this page