repocontext
⚡ RepoContext
The Next-Generation AST Codebase Map, Token Compression, and Context Packaging Engine for AI Coding Agents and IDEs.
🌟 Why RepoContext?
When feeding codebases into modern AI coding assistants (Claude Code, Cursor, Windsurf, OpenAI Codex, Antigravity, Cline), developers face three critical bottlenecks:
💥 Token Explosion & High API Costs: Raw code dumps quickly exceed context limits or cost tens of dollars per query.
📉 Low Signal-to-Noise Ratio: 80% of lines are routine implementation details. LLMs only need the semantic API surface (signatures, types, interfaces, docstrings).
🔓 Security Leaks: Accidental exposure of
.envcredentials, API keys, and database URIs in prompts.
RepoContext solves all three with intelligent AST outline pruning, task-focused semantic file ranking, automated credential redaction, and native Model Context Protocol (MCP) integration.
Related MCP server: AtlasMemory
🚀 Key Features
⚡ AST Codebase Map & Skeletonizer: Compresses source files by 70%~85% while retaining 100% of interfaces, types, functions, and JSDoc/docstrings.
🎯 Task-Oriented Relevance Pruning: Pass your prompt query (e.g.
repocontext pack -q "Fix JWT auth token expiry") to automatically rank and pack only the most critical files.🛡️ Automated Secret Scanner & Redaction: Built-in entropy and regex scanner detects and masks OpenAI keys, GitHub tokens, AWS keys, JWTs, and database URIs.
🔌 Native Model Context Protocol (MCP) Server: Directly integrates with Claude Desktop, Cursor, Windsurf, and Antigravity via standard MCP tools.
📑 Multi-Format Export: Generates clean Markdown with directory trees, Claude-optimized XML (
<documents>), or structured JSON.📊 Multi-Model Token & Cost Analytics: Real-time token counter with cost estimates for GPT-4o, GPT-5, Claude 3.5 Sonnet, and Gemini 1.5 Pro.
📦 Quick Start
1. Run without installation via npx
# Pack entire repository into an optimized Markdown prompt
npx repocontext pack
# Pack only files relevant to a specific task prompt
npx repocontext pack -q "Implement Stripe payment webhook handler" -o prompt.md
# Generate lightweight AST skeleton map (75%+ token reduction)
npx repocontext map -o codebase-map.md2. Global Installation
npm install -g repocontext🛠️ CLI Usage & Options
repocontext pack [dir] [options]
Options:
-m, --mode <mode> Packing mode: full | ast | relevant | hybrid (default: "full")
-q, --query <query> Filter and rank files relevant to a coding task prompt
-f, --format <format> Output format: markdown | xml | json (default: "markdown")
-o, --output <file> Output file path (default: "repocontext-output.md")
-t, --max-tokens <number> Maximum token budget ceiling (default: 80000)
--no-security Disable secret scanning and auto-redaction
-h, --help Display help for command🔌 Model Context Protocol (MCP) Integration
RepoContext comes with built-in MCP server support. Add it to your claude_desktop_config.json or Cursor/Windsurf MCP settings:
{
"mcpServers": {
"repocontext": {
"command": "npx",
"args": ["-y", "repocontext", "mcp"]
}
}
}Exposed MCP Tools:
get_codebase_map: Returns AST symbol outline map of the repository.extract_relevant_context: Prunes codebase and returns only files needed for a prompt.read_file_outline: Reads compressed AST skeleton for a single file.
📊 Benchmark & Comparison
Feature | Raw Concatenation | Repomix | RepoContext |
AST Skeleton Pruning | ❌ No | ❌ No | ✅ Yes (80% Token Savings) |
Task Relevance Ranker | ❌ No | ❌ No | ✅ Yes (Query-guided Pruning) |
Secret Auto-Redaction | ❌ No | ⚠️ Basic | ✅ Yes (10+ Security Rules) |
Native MCP Server | ❌ No | ❌ No | ✅ Yes (Claude / Cursor / Windsurf) |
Multi-Model Cost Est. | ❌ No | ❌ No | ✅ Yes (GPT-4o/5, Claude, Gemini) |
🤝 Contributing
Contributions, issues and feature requests are welcome! Feel free to check issues page.
📄 License
This project is MIT licensed.
This server cannot be installed
Maintenance
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides 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.6123MIT
- AlicenseNot gradedqualityCmaintenanceTurn any codebase into an AI-readable neural map — with proof. Every claim linked to code anchors (line + SHA-256 hash), every context window optimized with greedy token budgeting, every session protected by drift detection. Tree-sitter indexing across 11 languages, cross-session learning, AI enrichment, and 28 MCP tools. Zero config — just connect and your AI agent remembers everything.4513GPL 3.0
- FlicenseNot gradedqualityCmaintenanceTransforms codebases into a knowledge graph for AI agents, enabling semantic search, impact analysis, and persistent session memory with up to 94% token savings.217
- AlicenseNot gradedqualityDmaintenanceMake any LLM a codebase expert instantly. Provides deep code intelligence through semantic search, architecture mapping, security analysis, and smart context that fits perfectly in token windows.MIT
Related MCP Connectors
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
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/ILoveMyJay/repocontext'
If you have feedback or need assistance with the MCP directory API, please join our Discord server