Skip to content
Context Mode

Context ModeMCP Server

Released
1 views
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).

Related MCP Servers

New

Official MCP server for the Mux video API, built on a code-execution scheme: the agent writes TypeScript against the SDK and runs it in a Deno sandbox.

MCP: ripwire

by Red Hat

Featured

Red Hat's zero-dependency C++23 code-context engine — ranked call graphs and blast-radius analysis, indexing a repo in under half a second with no server and no database.

MCP: Graft

by Trail

Featured

Builds a searchable markdown graph of your repo so coding agents stop re-exploring it on every task — reported 42% fewer tokens and 46% fewer tool calls.

Featured

Expo's official remote MCP server — searches Expo docs, installs compatible SDK packages, triggers and monitors EAS builds, and drives iOS/Android simulators.

Browse all MCP servers →