</>MCP Agents Market
MCP Server

context-mode

by mksglu20.1kTypeScriptUpdated 2026-08-21

Context window optimization for AI coding agents. Sandboxes tool output (98% reduction), persists session memory, and enforces routing across 17 platforms via MCP + hooks.

Claude CodeCursorClaude DesktopVS Code CopilotJetBrainsZedWindsurf

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

Sandbox execution in 12 languages (JavaScript, TypeScript, Python, Shell, Ruby, Go, Rust, PHP, Perl, R, Elixir, C#) captures only stdout, reducing 56 KB Playwright snapshots to 299 bytes
SQLite-backed session continuity tracks file edits, git operations, tasks, errors, and user decisions across context compactions and restarts
FTS5 full-text search with BM25 ranking, Porter stemming, and trigram matching for intelligent content indexing and retrieval
Platform hooks (PreToolUse, PostToolUse, SessionStart, PreCompact, UserPromptSubmit, Stop) enforce routing and capture session events programmatically
Batch execution tool runs multiple commands and queries concurrently with configurable parallelism (1-8 workers)
URL fetch-and-index with TTL caching (default 24h) converts HTML to markdown, chunks by headings, and indexes for later retrieval
Security enforcement respects project-level permissions, blocks dangerous commands, and contains file access within project boundaries
Network fetch hardening blocks cloud metadata endpoints, link-local addresses, and dangerous URL schemes by default

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 more

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.

Related searches