Context Mode
An MCP server that keeps large tool output out of the agent's context window and stores session memory in SQLite
Medium risk
We rate an entry medium when the tool runs code, makes network calls or reads project files. Check what exactly it does before installing.
Why this level
- Executes code through ctx_execute and reads project files
- Installs hooks that intercept the agent's tool calls
Install
In your terminal, with SkillFoxx CLI
npx skillfoxx add mcp/context-modeDetects the agents on your machine, checks the risk and pins the version.
Other ways to install
Run in a terminal
claude mcp add --transport stdio context-mode -- npx -y context-modeOr add to the file .mcp.json, in the project
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
The button opens the agent and offers to add the server. If nothing happens, copy the config below.
Add to the file ~/.cursor/mcp.json, for all projects
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key. For a single project, put the same block into .cursor/mcp.json.
The button opens the agent and offers to add the server. If nothing happens, copy the config below.
Run in a terminal
code --add-mcp '{"name":"context-mode","type":"stdio","command":"npx","args":["-y","context-mode"]}'Or add to the file .vscode/mcp.json, in the project
{
"servers": {
"context-mode": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the servers key.
Run in a terminal
codex mcp add context-mode -- npx -y context-modeOr add to the file ~/.codex/config.toml, for all projects
[mcp_servers.context-mode]
command = "npx"
args = ["-y", "context-mode"]If the file already exists, append the block to the end.
Add to the file ~/.gemini/settings.json, for all projects
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
Add to the file ~/.config/devin/mcp_config.json, for all projects
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key. Legacy Cascade keeps the MCP config in ~/.codeium/windsurf/mcp_config.json.
Formerly Windsurf.
Add to the file cline_mcp_settings.json, for all projects
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key. Open the settings file in Cline: MCP Servers tab, Configure MCP Servers.
Add to the file .roo/mcp.json, in the project
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
A fork of Roo Code, same .roo folders.
Add to the file opencode.json, in the project
{
"mcp": {
"context-mode": {
"type": "local",
"command": [
"npx",
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcp key.
Add to the file ~/.config/zed/settings.json, for all projects
{
"context_servers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the context_servers key.
Add to the file .codeassistant/mcp.json, in the project
{
"mcpServers": {
"context-mode": {
"command": "npx",
"args": [
"-y",
"context-mode"
]
}
}
}If the file already exists, add the server inside the mcpServers key.
Install in Claude Code: /plugin marketplace add mksglu/context-mode, then /plugin install context-mode@context-mode. Or add the MCP server only: claude mcp add context-mode -- npx -y context-mode.
Other ways from the author
/plugin marketplace add mksglu/context-mode
/plugin install context-mode@context-modeFull install with hooks and utility commands. Restart the agent afterward.
This is third-party code. Review the repository files before installing.
What it does
Context Mode connects to the agent as an MCP server and fights context bloat. It moves large tool output into a sandbox and returns only a compact summary to the context rather than raw data. It records work history, file edits, git operations, tasks and errors in SQLite, and on conversation compaction it retrieves only what is relevant via full-text search. It also encourages a specific habit: instead of reading dozens of files into context, write a short script through ctx_execute and print only the result. On hook-capable platforms routing to these tools turns on automatically; on others the rules are added by copying a single file.
Who it is for. For developers who run long sessions with a coding agent and keep hitting context-window limits.
Good fit when
- Long sessions where context fills up fast with tool output
- You need to keep memory across compactions and resume where you left off
- You want to compute and analyze code with a script rather than reading files into context
Not a fit when
- Short one-off tasks where saving context is not needed
- The agent or platform does not support MCP
- You are not ready to install a local server and set up hooks
Example request
Count the functions in the src folder by writing a script and print only the numberLimitations
It needs a suitable Node.js version and a local server install. Automatic routing works only on hook-capable platforms; elsewhere the rules are added by copying a file manually. The Insight analytics panel is a separate hosted service. It is under the Elastic License v2, which is not a fully open license, so keep that in mind.
How to disable. Remove the server from your agent's MCP configuration, and if you installed the Claude Code plugin, remove it via /plugin. Remove the hooks from the platform settings.
MCP
- Transport
- stdio
- Authentication
- not required
Security check
- Executes code through ctx_execute and reads project files
- Installs hooks that intercept the agent's tool calls
README in short
The README presents Context Mode as an MCP server that tackles context bloat from several angles. It moves large tool output into a sandbox, keeps session memory in SQLite with full-text search, and promotes a pattern where the agent writes a script instead of reading many files. A set of platforms is supported: where hooks exist, routing turns on by itself; where they do not, the rules are copied manually. Installation is via the Claude Code plugin, a standalone MCP server, or a global npm package with per-platform config and hooks. There are utility commands for stats, diagnostics and clearing the index.
FAQ
Does it change how the model writes answers?
No. The server controls where tool data goes and does not dictate how the model phrases its final answer.
What happens to a previous session without continuation?
If you do not ask to continue, the previous session's data is deleted and a new session starts clean.
Related
Open-source personal AI assistant on your own machine: answers in Telegram, Slack, Discord and WhatsApp, extended with skills and plugins
A self-improving agent from Nous Research with a TUI, messaging gateway, cron jobs and skills it writes itself
An open source coding agent for the terminal and desktop with build and plan modes
Open prompt library with a Claude Code plugin, MCP server and CLI: search, fetch and improve prompts and skills from an agent