This manual provides detailed instructions on how to use the Codebase RAG MCP Server effectively.
Ask questions about your codebase in plain English. The system converts your question into vectors and finds the most semantically relevant code chunks.
Supported languages include:
- Python, JavaScript, TypeScript (including JSX/TSX)
- Go, Rust, Java, C++
- JSON, YAML, Markdown
Unlike simple text search, this tool understands code structure (functions, classes, methods) using Tree-sitter. This means it returns complete logical units of code, not just random lines.
Indexing is the process of reading your code and storing it in the vector database.
Option 1: Manual Indexing (Recommended for first run) Use the command-line tool for the initial setup or large codebases.
# Full fresh index
uv run python manual_indexing.py -d /path/to/repo -m clear_existing
# Incremental update (only changed files)
uv run python manual_indexing.py -d /path/to/repo -m incrementalOption 2: Chat-based Indexing You can ask Claude to index for you:
"Please index the current directory."
Note: For very large repositories, the manual tool is faster and more reliable.
The search tool is your main interface. You can be specific or broad.
- Specific: "Find the
CodeParserclass definition." - Conceptual: "How does the system handle retry logic for network requests?"
- Architectural: "Show me the relationship between the Service layer and the Data layer."
We use syntax-aware code chunking. Instead of cutting files at fixed character limits, we split them by logical blocks:
function: Complete function bodies.class: Class definitions with properties.method: Individual methods within classes.interface: Type definitions.
This ensures that when you retrieve code, you get the full context needed to understand it.
The server includes specialized prompts to help you navigate complex projects.
Use this when you are new to a codebase. It analyzes the structure and gives you a guided tour.
Usage:
"Run the explore_project prompt on this directory."
What it does:
- Analyzes directory structure.
- Identifies entry points and core modules.
- Suggests a navigation strategy.
Use this for deep dives or cross-project searches.
Usage:
"Use advance_search to find how authentication is implemented across all projects."
Features:
- Targeted Search: Search specific projects.
- Cross-Project: Search everything you've indexed.
- Search Modes: Hybrid (Keyword + Semantic) for best results.
For a complete detailed reference of all available tools and their arguments, please refer to: docs/MCP_TOOLS.md
Q: The search returns no results.
A: Ensure you have indexed the directory. Run uv run python manual_indexing.py -d . -m incremental to check.
Q: Indexing is slow.
A: If you are on a Mac with Apple Silicon, ensure you are using the MLX provider (see Configuration Guide) or adjust the INDEXING_BATCH_SIZE in .env.
Q: "Port already in use" error. A: Check if Qdrant is already running in Docker.