| name | jcodemunch-mcp-code-retrieval |
| description | Token-efficient GitHub source code exploration via tree-sitter AST parsing and structured retrieval |
| triggers | ["install jcodemunch for code navigation","set up structured code retrieval","index my codebase with jcodemunch","find function implementations efficiently","reduce token usage for code reading","search code symbols with tree-sitter","explore repository structure efficiently","get code context with token budget"] |
jCodeMunch MCP - Structured Code Retrieval
Skill by ara.so — MCP Skills collection.
jCodeMunch is an MCP server that indexes codebases using tree-sitter AST parsing and enables structured retrieval of code symbols (functions, classes, methods, constants) with byte-level precision. It cuts code-reading token usage by 95%+ by letting agents retrieve exact implementations instead of reading entire files.
Core Concept
Traditional approach: open files → scan thousands of lines → repeat (token incinerator).
jCodeMunch approach: index once → query cheaply → retrieve exact symbols (95%+ token savings).
Installation
Quick Install (VS Code, Cursor, Claude Code)
VS Code:
uvx jcodemunch-mcp
Cursor:
Use the one-click install badge or add to MCP settings:
{
"mcpServers": {
"jcodemunch": {
"command": "uvx",
"args": ["jcodemunch-mcp"]
}
}
}
Claude Code (CLI):
uvx jcodemunch-mcp
jcm install claude-code
Universal Install (Any MCP-compatible client)
Add to your MCP configuration file:
{
"mcpServers": {
"jcodemunch": {
"command": "uvx",
"args": ["jcodemunch-mcp"]
}
}
}
CLI Installation
pip install jcodemunch-mcp
uvx jcodemunch-mcp
Configuration
Create .jcodemunch/config.jsonc in your project root:
{
"index_path": ".jcodemunch/index",
"excluded_patterns": [
"node_modules/**",
"venv/**",
".git/**",
"*.pyc",
"__pycache__/**"
],
"default_token_budget": 8000,
"max_token_budget": 16000,
"compact_format_enabled": true,
"compact_format_threshold": 0.15,
"semantic_search_enabled": false,
"embedding_model": "sentence-transformers/all-MiniLM-L6-v2",
"disabled_tools":
Core Tools & Usage
1. Indexing
Index a repository:
index_repository(
path="/path/to/repo",
force_reindex=False
)
Check index status:
get_index_info()
2. Symbol Search
Find symbols by name (BM25 + fuzzy matching):
find_symbols(
query="get_user",
limit=10,
file_pattern="*.py",
format="auto"
)
Find implementations (multi-source resolution):
find_implementations(
symbol="UserService.authenticate",
include_lsp=True,
include_hierarchy=True,
include_duck_typed=True,
include_decorators=True
)
3. Context Retrieval
Get exact function/class implementation:
get_symbol_content(
identifier="UserService.authenticate",
include_docstring=True,
include_decorators=True,
format="auto"
)
Get context bundle with token budget:
get_ranked_context(
query="authentication logic",
token_budget=4000,
include_imports=True,
include_references=True,
format="auto"
)
Task-aware context orchestration:
assemble_task_context(
task="fix bug in user authentication where tokens expire too early",
token_budget=8000,
session_id="fix-auth-bug-001"
)
4. Structural Queries
Find references to a symbol:
find_references(
identifier="get_user",
include_calls=True,
include_imports=True,
format="auto"
)
Find who imports a module/symbol:
find_importers(
target="services.auth",
format="auto"
)
Get blast radius (impact analysis):
get_blast_radius(
identifier="User.email",
max_depth=3,
include_source=True,
format="auto"
)
Class hierarchy:
get_class_hierarchy(
class_name="BaseModel",
direction="both",
format="auto"
)
5. Code Quality & Refactoring
Find dead code:
find_dead_code(
scope="all",
include_private=True,
format="auto"
)
Find untested symbols:
get_untested_symbols(
scope="all",
min_complexity=5,
format="auto"
)
Find similar/duplicate code:
find_similar_symbols(
threshold=0.8,
min_cluster_size=2,
use_semantic=True,
use_structural=True,
use_behavioral=True,
format="auto"
)
Check if safe to delete:
check_delete_safe(
identifier="legacy_auth_handler",
format="auto"
)
6. Architectural Analysis
Get symbol importance (PageRank):
get_symbol_importance(
limit=20,
scope="all",
format="auto"
)
Repository overview map (cold-start orientation):
get_repo_map(
token_budget=4000,
signature_only=True,
format="auto"
)
Dependency cycles:
get_dependency_cycles(
format="auto"
)
Hotspot detection (complexity × churn):
get_hotspots(
min_complexity=10,
days_back=90,
format="auto"
)
7. Multi-Repo Operations
Cross-repo API contracts:
get_group_contracts(
repos=["/path/to/repo1", "/path/to/repo2"],
min_shared=2,
format="auto"
)
8. Git Integration
Get changed symbols from git diff:
get_changed_symbols(
base_ref="main",
head_ref="feature-branch",
format="auto"
)
Real-World Workflows
Workflow 1: Fix a Bug
assemble_task_context(
task="fix NullPointerException in payment processing",
token_budget=6000,
session_id="fix-payment-bug"
)
find_symbols(
query="payment process",
limit=5
)
get_symbol_content(identifier="PaymentService.process")
find_references(identifier="PaymentService.process")
get_blast_radius(
identifier="PaymentService.process",
max_depth=2,
include_source=True
)
Workflow 2: Refactor Dead Code
dead_symbols = find_dead_code(scope="all", include_private=True)
check_delete_safe(identifier="legacy_user_handler")
get_blast_radius(identifier="legacy_user_handler", max_depth=1)
find_similar_symbols(threshold=0.85, min_cluster_size=2)
Workflow 3: Understand New Codebase
get_repo_map(token_budget=3000, signature_only=True)
get_symbol_importance(limit=15)
get_class_hierarchy(class_name="BaseController", direction="down")
get_dependency_cycles()
get_hotspots(min_complexity=8, days_back=30)
Workflow 4: Feature Implementation
find_symbols(query="user authentication", limit=10)
assemble_task_context(
task="add OAuth2 authentication alongside existing password auth",
token_budget=8000
)
get_ranked_context(
query="authentication oauth password",
token_budget=5000,
include_imports=True
)
find_importers(target="auth.handlers")
Compact Format (MUNCH)
All tools accept format parameter:
auto - Use compact if ≥15% savings, else JSON (default)
compact - Always use compact format (45.5% avg token savings)
json - Always use JSON (backwards compatible)
Example savings on get_blast_radius:
- JSON: 3,850 tokens
- Compact: 700 tokens (5.5× reduction)
Advanced Features
Semantic Search (Optional)
Enable in config:
{
"semantic_search_enabled": true,
"embedding_model": "sentence-transformers/all-MiniLM-L6-v2"
}
Install dependencies:
pip install sentence-transformers torch
Use hybrid search:
find_symbols(
query="handles user authentication with tokens",
use_semantic=True,
limit=10
)
Custom Context Providers
Add dbt or Git context:
get_dbt_context(
model_name="fct_orders",
include_upstream=True,
include_downstream=True
)
get_changed_symbols(base_ref="main", head_ref="HEAD")
Session Management
Track multi-turn context:
plan_turn(
session_id="feature-impl-001",
task="implement OAuth2",
budget=10000
)
assemble_task_context(
task="add Google OAuth provider",
session_id="feature-impl-001",
token_budget=6000
)
Language Support
Fully supported via tree-sitter:
- Python, JavaScript, TypeScript, Go, Rust
- Java, C, C++, C#, Ruby, PHP
- And more (see
LANGUAGE_SUPPORT.md)
Troubleshooting
Index not found
index_repository(path=".", force_reindex=True)
Semantic search not working
pip install sentence-transformers torch
Too many results
find_symbols(
query="handler",
file_pattern="**/controllers/*.py",
limit=5
)
Token budget exceeded
get_repo_map(token_budget=2000, signature_only=True)
Performance issues
{
"excluded_patterns": [
"node_modules/**",
"venv/**",
"dist/**",
"build/**",
".git/**"
]
}
CLI Commands (jcm)
jcm install claude-code
jcm install cursor
jcm install windsurf
jcm index .
jcm search "UserService"
jcm info "UserService.authenticate"
jcm config --validate
Best Practices
- Index early: Run
index_repository() before starting work
- Use token budgets: Always specify budget for context retrieval
- Enable compact format: Set
format="auto" for 45%+ token savings
- Filter aggressively: Use
file_pattern and scope to narrow results
- Use task context:
assemble_task_context() auto-orchestrates the right tools
- Check blast radius: Before refactoring, verify impact with
get_blast_radius()
- Exclude build artifacts: Add node_modules, dist, venv to
excluded_patterns
- Use semantic search: For natural language queries, enable embeddings
Commercial Use
- Free: Non-commercial use
- Builder ($79): 1 developer
- Studio ($349): Up to 5 developers
- Platform ($1,999): Organization-wide
See license details at https://j.gravelle.us/jCodeMunch/descriptions.php