Skip to main content
Glama

ContextSlim

Spare 50%+ KI-Kontext-Token, ohne kritische Codesemantik zu verlieren.

Code: github.com/lilite572-cyber/context-slim · Installation: @idmxgne/context-slim (npm-Konto idmxgne). Nicht Jagganus context-slim (CLI-Ausgabe-Trimmer).

Cursor, Claude und andere Coding-Agenten lesen bei jeder Runde ganze Dateien erneut. Der Großteil dieses Budgets sind JSDoc, ungenutzte Imports und DTO-Mapper. ContextSlim parst JS/TS (Babel) und PHP (php-parser), höhlt das Rauschen aus und behält try/catch, Auth-Methoden, env() / process.env sowie Marker wie FIXME / SECURITY / В ПРОД НЕ ГНАТЬ.

Vorher / Nachher

Gemessen am realen Billing-Controller in tests/fixtures/real_world_controller.ts (--signatures-only):

Tokens

Was du behältst

Vorher

3.522

Kommentare, Mapper, ungenutzte Imports, jeder Methodenrumpf

Nachher

1.408

Signaturen + kritische Rümpfe + geschützte Kommentare

Ersparnis

60% (10 Labels behalten)

try/catch, authorize / login, FIXME, В ПРОД НЕ ГНАТЬ

CLI-Statistiken verwenden gpt-tokenizer (o200k_base, GPT-4o / GPT-5-Familie) und werden auf stderr ausgegeben. Der geschlankte Quellcode geht an stdout.

npx -y --package=@idmxgne/context-slim context-slim .
# Исходный размер: 3,522 токенов -> Сжатый: 1,408 токенов. Экономия: 60% ...

Die Binärdatei heißt context-slim, nicht @idmxgne/context-slim. Das gescopte npx @idmxgne/context-slim . schlägt mit command not found fehl.

Related MCP server: cctx-mcp

Schnellstart

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

Aus einem Klon:

npm i && npm run build
node dist/cli.js ./src

MCP-Server (Cursor, Windsurf, Claude Code)

Bin: context-slim-mcpdist/mcp.js. Offizieller @modelcontextprotocol/sdk-Server + StdioServerTransport. Schreibe keine Logs nach stdout.

Prompt use-slim-context:

Bevorzuge beim Lesen von Quelldateien immer das Tool read_slim_file, um das Kontextfenster zu optimieren.

Tools:

Tool

Args

Ergebnis

read_slim_file

path (string), signaturesOnly (boolean, Standard true)

komprimierter Quellcode

get_slim_stats

keine

letzter Lauf: Tokens vorher / nachher, % gespart, Anzahl geschützter Labels

Cursor

In ~/.cursor/mcp.json einfügen (fertige Kopie: examples/cursor-mcp.json):

{
  "mcpServers": {
    "context-slim": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/context-slim/dist/mcp.js"]
    }
  }
}

Nach npm publish:

{
  "mcpServers": {
    "context-slim": {
      "command": "npx",
      "args": ["-y", "--package=@idmxgne/context-slim", "context-slim-mcp"]
    }
  }
}

Cursor neu starten und den Agenten bitten, read_slim_file auf einem fetten Controller auszuführen.

Windsurf

Derselbe mcpServers-Block in der MCP-Konfiguration von Windsurf (~/.codeium/windsurf/mcp_config.json oder im MCP-Panel in den Einstellungen). command auf node + dist/mcp.js oder wie oben auf npx zeigen lassen.

Claude Code / Claude Desktop

Claude Desktopexamples/claude_desktop_config.json in claude_desktop_config.json einfügen:

{
  "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

Sichere Labels (.contextslimrc + isCriticalNode)

Ein Knoten wird nie ausgehöhlt, wenn isCriticalNode das sagt:

  • Kommentare, die CRITICAL, FIXME, TODO, SECURITY, DONT TOUCH, В ПРОД НЕ ГНАТЬ, @keep entsprechen

  • try / catch

  • Methoden, deren Namen nach Auth aussehen (authorize, login, jwt, csrf, …)

  • env(), getenv(), process.env

  • PHP/Laravel: $this->hasMany / $this->belongsTo (und andere Eloquent-Beziehungen) sowie scope*-Methoden

Repo: https://github.com/lilite572-cyber/context-slim

Weitere Phrasen in .contextslimrc im Projektstamm ablegen:

{
  "keep_patterns": ["HACK", "LEGACY"]
}

entry_patterns (Standard: index / cli / main / app / server) behalten gewöhnliche Funktionsrümpfe auch ohne --signatures-only. Abhängigkeitsdateien werden ausgehöhlt; --signatures-only (oder MCP signaturesOnly: true) übergeben, um alles auszuhöhlen, was nicht kritisch ist.

Installation / Veröffentlichung

npm i
npm test
npm run build

Bins: context-slim./dist/cli.js, context-slim-mcp./dist/mcp.js. npm: @idmxgne/context-slim. GitHub: lilite572-cyber/context-slim. Lizenz: MIT.

Lizenz

MIT

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    C
    maintenance
    An 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
  • A
    license
    A
    quality
    B
    maintenance
    An 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.
    5
    12
    2
    MIT
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    AST-aware code exploration MCP server for AI agents, optimized for token efficiency.

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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