Context Mode Solves Claude Code Context Window Exhaustion — 98% MCP Output Reduction
Context Mode, a new MCP server that reduces MCP tool output by up to 98%,来解决MCP tool outputs consuming context windows and causing sessions to slow down after 30 minutes.
Context Mode Solves Claude Code Context Window Exhaustion — 98% MCP Output Reduction
A growing challenge among developers using AI coding agents has been MCP (Model Context Protocol) tool outputs consuming context windows, causing sessions to slow down after about 30 minutes. Context Mode, developed by Mert Köseoğlu, solves this problem by compressing MCP tool outputs by up to 98%.
The Problem: Context Window Exhaustion from MCP Outputs
MCP has become the standard tool protocol for AI coding agents, but each tool call consumes context window tokens. The problem is particularly severe on the output side, where the following data is added to context for every tool call:
| Data Type | Context Consumption |
|---|---|
| Playwright snapshots | 56 KB |
| GitHub Issues (20 items) | 59 KB |
| Access logs (1 item) | 45 KB |
| CSV analysis (500 rows) | 85 KB |
After 30 minutes of a session, 40% of the context is lost, degrading session longevity and response quality.
Context Mode’s Solution
Context Mode acts as an MCP server that receives raw data from MCP tools and returns only the minimum information AI needs to context. Compression results:
| Data Type | Before | After | Reduction |
|---|---|---|---|
| Playwright snapshots | 56 KB | 299 B | 99.5% |
| GitHub Issues (20 items) | 59 KB | 1.1 KB | 98% |
| Access logs (500 items) | 45 KB | 155 B | 99.7% |
| CSV analysis (500 rows) | 85 KB | 222 B | 99.7% |
For entire sessions, 315 KB compresses to 5.4 KB, extending session runtime from approximately 30 minutes to about 3 hours before context degradation.
Technical Approach
Context Mode consists of two main components:
1. Sandbox
Each execute call runs in an isolated subprocess. Raw data (logs, API responses, snapshots) never enters context—only stdout is returned, preventing unnecessary data from bloating the context.
2. Knowledge Base
Chunks markdown by headings and provides BM25 ranking search via SQLite FTS5. Returns code blocks precisely, keeping context information minimal yet sufficient.
Installation
# MCP only
claude mcp add context-mode -- npx -y context-mode
Or install via Claude Code’s Plugin Marketplace. Supports 10 language runtimes (JS/TS/Python/Shell/Ruby/Go/Rust/PHP/Perl/R), with 3-5x speedup when using Bun.
Why It Was Needed
The idea came from Köseoğlu, who operates the MCP Directory & Hub. “Everyone builds tools, but nobody addresses the output side. We process 100,000 requests daily at MCP Hub. When Cloudflare announced Tool Mode for compressing tool definitions, we tackled the reverse—compressing tool outputs.”
Conclusion
Context Mode addresses the often-overlooked “output side efficiency” in an era where MCP standardization is advancing. Efficient context window utilization will become increasingly important for future AI coding agent development.
Repository: github.com/mksglu/claude-context-mode (MIT License)
関連記事
Claude Codeでコンテキストウィンドウの消耗を解決するContext Modeが登場 — MCP出力を98%削減
MCPツールの出力がコンテキストウィンドウを消費し、セッションが30分で遅くなる問題を解決するContext Modeが登場。Playwrightスナップショット59KB→299B、GitHub Issues 59KB→1.1KBに圧縮。
Claude Code v2.1.64 リリース — Remote Control新機能とパフォーマンス改善
Claude Code v2.1.64がリリース。Remote Controlサブコマンド追加、BashToolパフォーマンス改善、コンテキスト自動保存機能強化など多数の改善を含む。
Claude Code v2.1.66 リリース — 新规スラッシュコマンドとHTTP Hooksの導入
Claude Code v2.1.66がリリース。/simplify・/batchスラッシュコマンドの追加、HTTP Hooksサポート、多数のパフォーマンス改善とメモリリーク修正を含む。
人気記事
Claude Code v2.1.93 リリース - PreToolUseフック延期決定やフリッカーFREE渲染など
AnthropicがClaude Code v2.1.93をリリース。PreToolUseフックの延期決定機能、フリッカー-freeレンダリングオプション、PermissionDeniedフック、名前付きサブエージェントのタイプアヘッド対応などを含む。
Claude Code v2.1.92 リリース - forceRemoteSettingsRefreshやBedrockセットアップウィザードなど
AnthropicがClaude Code v2.1.92をリリース。forceRemoteSettingsRefreshポリシー設定、Bedrockセットアップウィザード、costコマンドの改善など多数の機能追加とバグ修正を含む。
Claude Code v2.1.84 リリース - PowerShellツールプレビューと環境設定の強化
Claude Code v2.1.84がリリース。Windows向けのPowerShellツール、環境変数によるモデル選択のカスタマイズアイドルセッション処理の改善などが含まれる。
最新記事
Claude Code v2.1.93 リリース - PreToolUseフック延期決定やフリッカーFREE渲染など
AnthropicがClaude Code v2.1.93をリリース。PreToolUseフックの延期決定機能、フリッカー-freeレンダリングオプション、PermissionDeniedフック、名前付きサブエージェントのタイプアヘッド対応などを含む。
Claude Code v2.1.92 リリース - forceRemoteSettingsRefreshやBedrockセットアップウィザードなど
AnthropicがClaude Code v2.1.92をリリース。forceRemoteSettingsRefreshポリシー設定、Bedrockセットアップウィザード、costコマンドの改善など多数の機能追加とバグ修正を含む。
Claude Code v2.1.91 リリース - MCPツール結果の永続化とEditツールの最適化
Claude Code v2.1.91ではMCPツールの結果サイズの上書き、シェル実行の制御強化、Editツールの効率改善などが行われた。