{"id":"91811486-9ce5-4843-8732-52476c7665a7","slug":"ilovemyjay-repocontext","kind":"mcp","name":"repocontext","summary":"Next-gen AST codebase map, token compression, and context packaging engine for AI coding agents & IDEs","owner":"ILoveMyJay","repoUrl":"https://github.com/ILoveMyJay/repocontext","license":"MIT","licenseTier":"permissive","trust":"community","stars":3,"match":null,"fewStars":true,"format":"mcp","createdAt":"2026-08-21T02:20:43.000Z","addedAt":"2026-10-14T05:20:41.494Z","logoUrl":"https://avatars.githubusercontent.com/u/20902737?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["memory-knowledge","utilities"],"tags":[],"runtime":"node","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-14T23:15:31.306Z","sample":false,"url":"https://conduits.dev/tools/ilovemyjay-repocontext","language":"TypeScript","transports":["stdio"],"install":{"npm":"repocontext"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# ⚡ RepoContext\n\n<div align=\"center\">\n\n[![CI](https://github.com/ILoveMyJay/repocontext/actions/workflows/ci.yml/badge.svg)](https://github.com/ILoveMyJay/repocontext/actions)\n[![Glama Score](https://glama.ai/mcp/servers/ILoveMyJay/repocontext/badges/score.svg)](https://glama.ai/mcp/servers/ILoveMyJay/repocontext)\n[![npm version](https://img.shields.io/npm/v/repocontext.svg?color=blue)](https://www.npmjs.com/package/repocontext)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-brightgreen.svg)](https://modelcontextprotocol.io)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.7+-blue.svg)](https://www.typescriptlang.org/)\n\n**The Next-Generation AST Codebase Map, Token Compression, and Context Packaging Engine for AI Coding Agents and IDEs.**\n\n[English](./README.md) | [中文说明](./README_zh.md)\n\n</div>\n\n---\n\n## 🌟 Why RepoContext?\n\nWhen feeding codebases into modern AI coding assistants (**Claude Code**, **Cursor**, **Windsurf**, **OpenAI Codex**, **Antigravity**, **Cline**), developers face three critical bottlenecks:\n\n1. 💥 **Token Explosion & High API Costs**: Raw code dumps quickly exceed context limits or cost tens of dollars per query.\n2. 📉 **Low Signal-to-Noise Ratio**: 80% of lines are routine implementation details. LLMs only need the semantic API surface (signatures, types, interfaces, docstrings).\n3. 🔓 **Security Leaks**: Accidental exposure of `.env` credentials, API keys, and database URIs in prompts.\n\n**RepoContext** solves all three with intelligent AST outline pruning, task-focused semantic file ranking, automated credential redaction, and native **Model Context Protocol (MCP)** integration.\n\n---\n\n## 🚀 Key Features\n\n* ⚡ **AST Codebase Map & Skeletonizer**: Compresses source files by **70%~85%** while retaining 100% of interfaces, types, functions, and JSDoc/docstrings.\n* 🎯 **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.\n* 🛡️ **Automated Secret Scanner & Redaction**: Built-in entropy and regex scanner detects and masks OpenAI keys, GitHub tokens, AWS keys, JWTs, and database URIs.\n* 🔌 **Native Model Context Protocol (MCP) Server**: Directly integrates with Claude Desktop, Cursor, Windsurf, and Antigravity via standard MCP tools.\n* 📑 **Multi-Format Export**: Generates clean Markdown with directory trees, Claude-optimized XML (`<documents>`), or structured JSON.\n* 📊 **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.\n\n---\n\n## 📦 Quick Start\n\n### 1. Run without installation via `npx`\n```bash\n# Pack entire repository into an optimized Markdown prompt\nnpx repocontext pack\n\n# Pack only files relevant to a specific task prompt\nnpx repocontext pack -q \"Implement Stripe payment webhook handler\" -o prompt.md\n\n# Generate lightweight AST skeleton map (75%+ token reduction)\nnpx repocontext map -o codebase-map.md\n```\n\n### 2. Global Installation\n```bash\nnpm install -g repocontext\n```\n\n---\n\n## 🛠️ CLI Usage & Options\n\n```bash\n# 1. Pack with direct clipboard copy (ready to paste into ChatGPT/Claude)\nrepocontext pack -c\n\n# 2. Pack relevant files only based on task query\nrepocontext pack -q \"Fix JWT auth expiration\" -o prompt.md\n\n# 3. Generate AST symbol map\nrepocontext map -c\n\n# 4. Analyze token distribution without writing a file\nrepocontext analyze .\n```\n\n### Options for `pack`:\n| Option | Description | Default |\n| :--- | :--- | :--- |\n| `-m, --mode <mode>` | Packing mode: `full`, `ast`, `relevant`, `hybrid` | `\"full\"` |\n| `-q, --query <query>` | Filter and rank files relevant to coding prompt | None |\n| `-f, --format <format>`| Output format: `markdown`, `xml`, `json` | `\"markdown\"` |\n| `-o, --output <file>` | Output file path | `\"repocontext-output.md\"` |\n| `-t, --max-tokens <num>`| Maximum token budget | `80000` |\n| `-c, --copy` | Copy output directly to system clipboard | `false` |\n| `--no-security` | Disable automated secret redaction | `false` |\n\n---\n\n## 🔌 Model Context Protocol (MCP) Integration\n\nRepoContext comes with built-in MCP server support. Add it to your `claude_desktop_config.json` or Cursor/Windsurf MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"repocontext\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"repocontext\", \"mcp\"]\n    }\n  }\n}\n```\n\n### Exposed MCP Tools (4-Tier Context Pyramid):\n* `get_codebase_map`: Extracts token-efficient AST symbol outline map across the repository (~80% token savings).\n* `extract_relevant_context`: Prunes codebase using semantic ranking to return files pertinent to a task prompt.\n* `read_file_outline`: Reads compressed AST skeleton for an individual file (signatures & docstrings).\n* `read_file_content`: Precise source code reading with optional line-range slicing (`startLine`/`endLine`) and automated credential masking.\n\n---\n\n## 📊 Benchmark & Comparison\n\n| Feature | Raw Concatenation | Repomix | RepoContext |\n| :--- | :---: | :---: | :---: |\n| **AST Skeleton Pruning** | ❌ No | ❌ No | ✅ **Yes (80% Token Savings)** |\n| **Task Relevance Ranker** | ❌ No | ❌ No | ✅ **Yes (Query-guided Pruning)** |\n| **Secret Auto-Redaction** | ❌ No | ⚠️ Basic | ✅ **Yes (10+ Security Rules)** |\n| **Native MCP Server** | ❌ No | ❌ No | ✅ **Yes (Claude / Cursor / Windsurf)** |\n| **Multi-Model Cost Est.** | ❌ No | ❌ No | ✅ **Yes (GPT-4o/5, Claude, Gemini)** |\n\n---\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome! Feel free to check [issues page](https://github.com/ILoveMyJay/repocontext/issues).\n\n## 📄 License\n\nThis project is [MIT](./LICENSE) licensed.\n"}