CodeRAG is a powerful MCP (Model Context Protocol) Server that creates a graph database representation of your codebase using Neo4J. This enables advanced code analysis, relationship mapping, and AI-powered insights about your code structure.
For a complete setup guide, see Installation & Setup.
- Install Prerequisites: Node.js 18+, Neo4J 5.11+
- Clone and Build:
git clone repo && npm install && npm run build - Configure Environment: Create
.envwith Neo4J connection details - Start Neo4J: Launch your Neo4J database
- Integrate with AI Tool: Configure MCP server in your AI assistant
- Scan Your Project: Use the scanner to populate the graph
This user guide is organized into focused sections:
- Installation & Setup - Prerequisites, installation, and configuration
- AI Integration - Connect CodeRAG to Claude Code, Windsurf, Cursor, and other AI tools
- Scanner Usage - Scan your codebase and populate the graph database
- Available Tools - Complete reference of all 23 CodeRAG tools
- Semantic Search - Natural language code discovery with AI embeddings
- MCP Prompts Guide - Guided workflows for effective code analysis
- Multi-Project Management - Manage multiple codebases in one database
- Quality Metrics - Understand CK metrics, package metrics, and architectural analysis
- Troubleshooting - Diagnose and resolve common issues
CodeRAG transforms your codebase into a searchable graph database, enabling:
- 🔍 Advanced Code Analysis - Find complex relationships and dependencies
- 🧠 Semantic Code Search - Find code by functionality using natural language queries
- 📊 Quality Metrics - Calculate industry-standard metrics (CK metrics, package coupling)
- 🏗️ Architecture Insights - Detect design patterns, architectural issues, and violations
- 🤖 AI-Powered Exploration - Use natural language to query your codebase structure
- 📈 Multi-Project Management - Analyze multiple codebases in a unified view
- 🌐 Remote Repository Analysis - Scan GitHub, GitLab, and Bitbucket repositories directly
- 🎯 Smart Language Detection - Automatically detects project languages from build files and metadata
- 🏗️ Mono-Repository Support - Handles complex projects with multiple languages and sub-projects
Local Project:
- Auto-scan the project (languages detected automatically):
The scanner will automatically detect TypeScript, Java, Python, etc. from build files
Use scan_dir to scan /path/to/my/project with clear_existing=true
Remote Repository:
-
Scan directly from GitHub/GitLab/Bitbucket:
Use scan_remote_repo with repository_url=https://github.com/owner/repo.gitAutomatically clones, scans, and cleans up the repository
-
Get overview with project metadata:
Use get_project_summary to show me the codebase overviewIncludes auto-extracted project name, version, framework information
-
Find issues:
Use find_architectural_issues to identify problems -
Analyze key classes:
Use calculate_ck_metrics for the main service classes
-
Find a specific class:
Use search_nodes to find classes containing "Service" -
Analyze its dependencies:
Use find_dependencies prompt for target_class=UserService -
Check coupling:
Use calculate_ck_metrics for the UserService class
-
Map inheritance:
Use analyze_inheritance prompt for class_or_interface=BaseEntity -
Find implementations:
Use find_classes_implementing_interface for Repository -
Check package structure:
Use calculate_package_metrics for com.myapp.service
-
Search by functionality:
Use semantic_search with query="functions that validate user input" -
Find similar code:
Use get_similar_code for node_id="UserValidator.validateEmail" -
Update embeddings after changes:
Use update_embeddings for project_id="my-project"
# Setup
npm install && npm run build
# Auto-detect and scan project (recommended)
npm run scan /path/to/project
# Scan remote repository
npm run scan https://github.com/owner/repo.git
# Scan multiple projects (multi-project support)
npm run scan /path/to/project1
npm run scan /path/to/project2
# List all scanned projects
Use list_projects tool to see all projects with statistics
# Start STDIO mode
npm start
# Start HTTP mode
npm start -- --sse --port 3000scan_dir- Scan local codebasescan_remote_repo- Scan remote repositoriessemantic_search- Natural language code searchget_project_summary- Overviewfind_architectural_issues- Find problemscalculate_ck_metrics- Class qualityget_similar_code- Find similar code entitiesget_inheritance_hierarchy- Class relationships
setup_code_graph- New project setupanalyze_codebase- General analysisfind_dependencies- Dependency analysisanalyze_inheritance- Inheritance analysis
This overview gets you started quickly. For detailed information:
- 🚀 New to CodeRAG? Start with Installation & Setup
- 🔧 Having issues? Check Troubleshooting
- 📖 Want comprehensive info? Each section above links to detailed guides
The combination of automated scanning, quality metrics, and AI-powered analysis makes CodeRAG a powerful tool for understanding and improving your codebase architecture.