context-trim
Provides remote MCP tools for downloading and packing public GitHub repositories (including branch-specific URLs) into Markdown context, and for analyzing repository token waste and heaviest files, subject to download, file, and concurrency limits.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
context-trim βοΈ
Pack a whole codebase into lean Markdown context for LLMs: no lockfiles, no build output, no secrets. Zero-dependency CLI, local MCP server, Claude plugin, and remote MCP server for Claude Code, Claude, ChatGPT, Codex, and Cursor.
β‘ Why context-trim?
When you hand a whole repository to an AI assistant:
Lockfiles (
package-lock.json,poetry.lock,yarn.lock) can cost tens of thousands of tokens and tell the model nothing.Build and cache folders (
dist,.next,target,vendor,__pycache__) flood the context window.Credentials in
.envfiles and source code (sk-ant-...,sk-proj-...,ghp_...) leak into prompts.
context-trim filters out the bloat, leaves credential files out, masks keys found in code, and gives you one clean Markdown pack in your clipboard, a file, or straight to your assistant through MCP. Run --stats to see exactly how many tokens it saves on your project.
Related MCP server: Ambiance MCP Server
π Quick Start
Run instantly with npx:
# Scan and pack directly into your clipboard (Cmd+V into Claude / ChatGPT)
npx context-trim -c
# Scan current repository and save a clean ai-context.md
npx context-trim
# Check token waste and see estimated dollar savings
npx context-trim --stats
# Preview the clean file tree that LLMs will receive
npx context-trim --tree
# Save with a strict token ceiling
npx context-trim -o prompt.md --budget 40000π‘οΈ Built-in Security Shield
Credential files are never read. .env, .env.* (except .env.example, .env.sample, .env.template), .envrc, private keys (*.pem, *.key, id_rsa, id_ed25519 ...), .npmrc, .pypirc, .netrc, credentials.json, secrets.yaml, service-account JSON files and Terraform state are skipped entirely.
Secrets inside other files are masked with [REDACTED_SECRET_KEY]:
Anthropic, OpenAI, Stripe, Google, AWS, GitHub and Slack keys and tokens
JSON Web Tokens and private key blocks
Passwords inside connection strings (
postgres://user:PASSWORD@host)Quoted values and
.env-style lines assigned to names such aspassword,secret,api_key,access_token
Masking is pattern-based and can't catch every possible secret, so review what you share when a repository holds sensitive data.
π Claude Code plugin
Install the plugin and Claude gets the MCP tools plus a pack-codebase skill that tells it when to use them:
claude plugin marketplace add kaanefebusiness-ai/context-trim
claude plugin install context-trimThe plugin runs node ${CLAUDE_PLUGIN_ROOT}/bin/cli.js --mcp from its own folder. Nothing is downloaded at run time.
π Local MCP server (Claude Desktop, Cursor, Codex)
Add it to your MCP configuration (for Claude Desktop, claude_desktop_config.json):
{
"mcpServers": {
"context-trim": {
"command": "npx",
"args": ["-y", "context-trim@1.3.1", "--mcp"]
}
}
}The server only reads folders inside the workspace: the project roots your client shares over MCP (Claude Code and Codex do this), otherwise CONTEXT_TRIM_ROOT or the folder it was started in. Requests for any other path, including symlinks that point outside, are refused.
Tool | What it does | Annotations |
| Packs a project folder into Markdown, up to | read-only, not destructive, closed world |
| Shows total tokens, filtered files and the 10 heaviest files | read-only, not destructive, closed world |
π Remote MCP server (ChatGPT, Claude connectors)
Hosted endpoint: https://context-trim.kaanefedemir.co/mcp (no login; privacy policy at /privacy).
The remote server reads public GitHub repositories only. It never touches the disk of the machine it runs on beyond a temporary folder that is deleted after each request.
npx context-trim --http --port 8787 # serves POST /mcp, GET /privacy, GET /health
docker run -p 8787:8787 <image> --http # same, from the DockerfileTool | What it does | Annotations |
| Downloads a public repository ( | read-only, not destructive, open world |
| Reports token cost and the heaviest files of a public repository | read-only, not destructive, open world |
Limits: 50 MB download, 200 MB unpacked, 5,000 files, 4 repositories at a time (CONTEXT_TRIM_MAX_CONCURRENCY).
π Privacy
Local use (CLI, local MCP server, plugin): context-trim makes no network requests, collects nothing, and has no telemetry. It reads only the folder you point it at, and the result goes only where you send it.
Remote server: it receives the repository name you ask for, downloads that public repository from GitHub, returns the packed text, and deletes the download. It stores no repository contents, requests or results, and needs no account.
Full policy: PRIVACY.md (also served by the remote server at /privacy). Terms: TERMS.md.
βοΈ CLI Options
Flag | Description |
| Copy packed context directly to native clipboard (macOS, Windows, Linux). |
| Custom path to save the generated markdown pack (default: |
| Show token count, skipped files, and estimated cost savings. |
| Print the filtered file tree with token estimates per file. |
| Cap context at a specific token ceiling (e.g. |
| Start as a local MCP server over stdio. |
| Start as a remote MCP server over HTTP for public GitHub repositories. |
| Output version number. |
| Display command-line help. |
Token counts are estimates (about 3.8 characters per token), not exact tokenizer output.
π¦ Zero Dependencies
Written in native Node.js ESM (Node 18+) with zero external dependencies. Compatible with macOS, Windows, and Linux.
π¬ Support
Questions, bugs and requests: GitHub Issues.
π License
MIT Β© Kaan Efe Demir
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Codebase intelligence for AI agents β dead code, blast radius, ownership.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
AI-powered codebase analysis β call graphs, security, dead code, complexity. 150+ tools.
Related MCP Servers
- AlicenseBqualityDmaintenanceExtracts minimal, relevant code context from multiple programming languages while analyzing diffs and optimizing imports to reduce token usage for AI assistants. Supports TypeScript/JavaScript, Python, Go, and Rust with token-aware caching.71MIT
- AlicenseAqualityCmaintenanceProvides intelligent code context and analysis through semantic compression, AST parsing, and multi-language support. Offers 60-80% token reduction while enabling AI assistants to understand codebases through local analysis, OpenAI-enhanced insights, and GitHub repository integration.620 npm3MIT
- AlicenseAqualityDmaintenanceAnalyzes codebases from local directories, GitHub, and Azure DevOps, providing intelligent context to AI coding assistants through repository structure, critical files, and semantic maps.144MIT

Code Scalpelofficial
AlicenseNot gradedqualityDmaintenanceEnables AI assistants to surgically extract and analyze code, reducing token usage and costs by up to 200x compared to reading entire files.10 PyPI20MIT