Skip to main content
Glama

ContextSlim

중요한 코드 의미를 잃지 않고 AI 컨텍스트 토큰을 50% 이상 절약하세요.

코드: github.com/lilite572-cyber/context-slim · 설치: @idmxgne/context-slim (npm 계정 idmxgne). Jagganu의 context-slim(CLI 출력 트리머)이 아닙니다.

Cursor, Claude 및 기타 코딩 에이전트는 매 턴마다 전체 파일을 다시 읽습니다. 해당 예산의 대부분은 JSDoc, 사용하지 않는 import, DTO 매퍼가 차지합니다. ContextSlim은 JS/TS(Babel)와 PHP(php-parser)를 파싱하여 노이즈를 제거하고, try/catch, 인증 메서드, env() / process.env, 그리고 FIXME / SECURITY / В ПРОД НЕ ГНАТЬ 같은 마커는 유지합니다.

전후 비교

tests/fixtures/real_world_controller.ts의 실제 billing 컨트롤러에서 측정(--signatures-only):

토큰

유지되는 내용

Before

3,522

주석, 매퍼, 사용하지 않는 import, 모든 메서드 본문

After

1,408

시그니처 + 중요 본문 + 보호된 주석

Savings

60% (레이블 10개 유지)

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

CLI 통계는 gpt-tokenizer(o200k_base, GPT-4o / GPT-5 계열)를 사용하며 stderr로 출력합니다. 슬림 소스는 stdout으로 출력됩니다.

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

바이너리는 @idmxgne/context-slim이 아니라 context-slim입니다. Scoped 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 ./src

MCP 서버 (Cursor, Windsurf, Claude Code)

바이너리: context-slim-mcpdist/mcp.js. 공식 @modelcontextprotocol/sdk Server + StdioServerTransport. stdout에 로그를 쓰지 마세요.

use-slim-context 프롬프트:

소스 코드 파일을 읽을 때는 항상 read_slim_file 도구를 우선 사용하여 컨텍스트 창을 최적화하세요.

도구:

도구

인자

결과

read_slim_file

path (문자열), signaturesOnly (불리언, 기본값 true)

압축된 소스

get_slim_stats

없음

마지막 실행: 토큰 before / after, % 절약, 보호된 레이블 수

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 블록을 사용하세요. commandnode + dist/mcp.js 또는 위와 같이 npx로 지정하세요.

Claude Code / Claude Desktop

Claude Desktopexamples/claude_desktop_config.jsonclaude_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.env

  • PHP/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

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