context-mode
Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.
context-mode is an MCP server that solves context window exhaustion in AI coding sessions by sandboxing tool output (achieving 98% reduction), persisting session memory across conversation compactions, and enforcing intelligent routing. It transforms large raw outputs from tools like Playwright, GitHub API, and file operations into compact summaries while maintaining full session continuity. The server works across 17+ platforms including Claude Code, Cursor, VS Code Copilot, and Gemini CLI, providing both MCP tools for sandboxed execution and hooks for programmatic routing enforcement.
Key Features
Use Cases
- 01Analyzing large repository structures without flooding context with raw file contents
- 02Processing web scraping results, API responses, or log files while keeping only relevant summaries in conversation
- 03Maintaining project context across multi-hour coding sessions that exceed token limits
- 04Indexing documentation or code repositories for semantic search during development
- 05Running authenticated CLI tools (gh, aws, kubectl) in sandbox with credential passthrough
- 06Resuming interrupted sessions with full memory of files edited, tasks completed, and errors resolved
Related MCP Servers
View moremarkitdown
Python tool for converting files and office documents to Markdown.
firecrawl
The context API to search, scrape, and interact with the web at scale. 🔥
prompts.chat
f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.
langflow
Langflow is a powerful tool for building and deploying AI-powered agents and workflows.
context-mode — FAQ
What is context-mode and what problem does it solve?+
context-mode is an MCP server that prevents context window exhaustion by sandboxing tool output (98% reduction), persisting session state across compactions, and enforcing smart routing. It extends 30-minute sessions to 3+ hours by keeping raw data out of the conversation while maintaining full continuity.
How do I install context-mode in Claude Code?+
In Claude Code v1.0.33+, run `/plugin marketplace add mksglu/context-mode` then `/plugin install context-mode@context-mode`. Restart Claude Code and verify with `/context-mode:ctx-doctor`. The plugin automatically registers MCP tools, hooks, and routing.
Which AI clients and platforms does context-mode support?+
context-mode works with 17+ platforms: Claude Code, Cursor, VS Code Copilot, JetBrains Copilot, GitHub Copilot CLI, Gemini CLI, Qwen Code, OpenCode, KiloCode, Codex CLI, Kimi Code, Antigravity, Kiro, Zed, Pi Coding Agent, OMP, and OpenClaw. Hook support varies by platform (full on Claude Code/Gemini CLI, partial on Cursor/Zed).
Do I need API keys or external services to use context-mode?+
No. context-mode runs entirely locally with no telemetry, cloud sync, or accounts required. It uses SQLite databases stored in your home directory and sandboxed subprocesses for execution. Authenticated CLI tools inherit your existing credentials via environment passthrough.
Is context-mode free and open source?+
context-mode is source-available under Elastic License 2.0 (ELv2). You can use, fork, modify, and distribute it freely. The two restrictions are: you cannot offer it as a hosted/managed service, and you cannot remove licensing notices.
What are the prerequisites for installation?+
Node.js >= 22.5 or Bun is required. On Linux with Node >= 22.5, context-mode automatically uses the built-in node:sqlite module. Bun users get automatic bun:sqlite detection with no native compilation. Older glibc systems (CentOS/RHEL) may need GCC 10+ for native addon compilation.
How do I install context-mode?+
Open the source repository on GitHub and follow its README. context-mode is a mcp server — MCP Agents Market links you directly to the official repo.
Is context-mode free?+
context-mode is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.