context-slim
ContextSlim
AIコンテキストトークンを50%以上節約。重要なコードの意味は失わずに。
コード: github.com/lilite572-cyber/context-slim · インストール: @idmxgne/context-slim (npmアカウント idmxgne)。Jagganuのcontext-slim(CLI出力トリマー)とは別物です。
Cursor、Claude、その他のコーディングエージェントは、ターンごとにファイル全体を読み直します。その予算の大半はJSDoc、未使用のインポート、DTOマッパーです。ContextSlimはJS/TS(Babel)とPHP(php-parser)を解析し、ノイズを空洞化しつつ、try/catch、認証メソッド、env() / process.env、FIXME / SECURITY / В ПРОД НЕ ГНАТЬ などのマーカーは保持します。
変更前 / 変更後
tests/fixtures/real_world_controller.ts の実世界の請求コントローラーで測定(--signatures-only):
トークン | 保持される内容 | |
変更前 | 3,522 | コメント、マッパー、未使用インポート、すべてのメソッド本体 |
変更後 | 1,408 | シグネチャ + 重要な本体 + 保護されたコメント |
削減率 | 60%(10ラベル保持) | try/catch、 |
CLI統計はgpt-tokenizer(o200k_base、GPT-4o / GPT-5系)を使用し、stderrに出力します。スリム化されたソースはstdoutに出力されます。
npx -y --package=@idmxgne/context-slim context-slim .
# Исходный размер: 3,522 токенов -> Сжатый: 1,408 токенов. Экономия: 60% ...バイナリは context-slim であり、@idmxgne/context-slim ではありません。スコープ付きの npx @idmxgne/context-slim . は command not found で失敗します。
Related MCP server: cctx-mcp
クイックスタート
npx -y --package=@idmxgne/context-slim context-slim .
npx -y --package=@idmxgne/context-slim context-slim ./src --signatures-only
npx -y --package=@idmxgne/context-slim context-slim ./src --out slim.txt
npx -y --package=@idmxgne/context-slim context-slim-mcpクローンから:
npm i && npm run build
node dist/cli.js ./srcMCPサーバー(Cursor、Windsurf、Claude Code)
バイナリ: context-slim-mcp → dist/mcp.js。公式の @modelcontextprotocol/sdk の Server + StdioServerTransport。stdoutにログを書き込まないでください。
プロンプト use-slim-context:
ソースコードファイルを読む際は、コンテキストウィンドウを最適化するために常に
read_slim_fileツールの使用を優先してください。
ツール:
ツール | 引数 | 結果 |
|
| 圧縮されたソース |
| なし | 前回の実行: トークン(前/後)、節約 |
Cursor
~/.cursor/mcp.json にマージします(既製コピー: examples/cursor-mcp.json):
{
"mcpServers": {
"context-slim": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/context-slim/dist/mcp.js"]
}
}
}npm publish 後:
{
"mcpServers": {
"context-slim": {
"command": "npx",
"args": ["-y", "--package=@idmxgne/context-slim", "context-slim-mcp"]
}
}
}Cursorを再起動し、エージェントに肥大化したコントローラーで read_slim_file を実行するよう依頼します。
Windsurf
WindsurfのMCP設定(~/.codeium/windsurf/mcp_config.json、または設定のMCPパネル)に同じ mcpServers ブロックを使用します。command を node + dist/mcp.js に向けるか、上記のように npx に向けます。
Claude Code / Claude Desktop
Claude Desktop — examples/claude_desktop_config.json を claude_desktop_config.json にマージします:
{
"mcpServers": {
"context-slim": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/context-slim/dist/mcp.js"]
}
}
}Claude Code:
claude mcp add context-slim -- node /ABSOLUTE/PATH/TO/context-slim/dist/mcp.js安全ラベル(.contextslimrc + isCriticalNode)
isCriticalNode がそう判断した場合、ノードは決して空洞化されません:
CRITICAL、FIXME、TODO、SECURITY、DONT TOUCH、
В ПРОД НЕ ГНАТЬ、@keepに一致するコメントtry/catch認証らしい名前のメソッド(
authorize、login、jwt、csrfなど)env()、getenv()、process.envPHP/Laravel:
$this->hasMany/$this->belongsTo(およびその他のEloquentリレーション)とscope*メソッド
リポジトリ: https://github.com/lilite572-cyber/context-slim
追加のフレーズはプロジェクトルートの .contextslimrc に記述します:
{
"keep_patterns": ["HACK", "LEGACY"]
}entry_patterns(デフォルト: index / cli / main / app / server)は、--signatures-only がなくても通常の関数本体を保持します。依存ファイルは空洞化されます。--signatures-only(またはMCPの signaturesOnly: true)を渡すと、重要でないものはすべて空洞化されます。
インストール / 公開
npm i
npm test
npm run buildバイナリ: context-slim → ./dist/cli.js、context-slim-mcp → ./dist/mcp.js。npm: @idmxgne/context-slim。GitHub: lilite572-cyber/context-slim。ライセンス: MIT。
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server that reduces token consumption in AI coding assistants by up to 90% via structural reads, PreToolUse hooks, and tp-\* subagents.254254MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that provides structure-aware code analysis (symbol trees, dependencies, docs) to reduce AI agent token consumption by up to 99%, along with Git commit intelligence.MIT
- AlicenseAqualityBmaintenanceAn AST-based MCP server that provides token-efficient codebase skeletons to LLM agents, reducing context token usage by 80-95% by exposing structural information instead of full source files.5122MIT
- -licenseNot gradedqualityNot gradedmaintenanceAST-aware code exploration MCP server for AI agents, optimized for token efficiency.
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lilite572-cyber/context-slim'
If you have feedback or need assistance with the MCP directory API, please join our Discord server