Skip to content
Context Mode

Context ModeMCP Server

Released
v1.0.169
Elastic-2.0

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.

Any MCP-compatible agent

Most agents (Claude, Cursor, Windsurf, VS Code, and more) read a standard mcpServers configuration.

  1. Open your agent's MCP configuration file.
  2. Merge the snippet below into it.
  3. Restart the agent — the "Context Mode" tools will be available.
{
  "mcpServers": {
    "context-mode": {
      "command": "npx",
      "args": [
        "-y",
        "context-mode"
      ]
    }
  }
}

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_execute and 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-stats and ctx-doctor report 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).

MCP: Semble

by MinishLab

New

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.

MCP: 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.

MCP: Engram

by Gentleman Programming

Featured

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.

Browse all MCP servers →