A context-aware Model Context Protocol (MCP) server that provides semantic search capabilities across your codebase using Qdrant vector database. Now with intelligent GitHub issue resolution (v0.3.0), GitHub Projects V2 management (v0.3.4), and hierarchical sub-issues support (v0.3.4.post4). Designed to work seamlessly with Claude Code.
Why MCP RAG? This server enables AI agents to efficiently work with entire codebases while using 95%+ fewer tokens. Learn how β
- π€ Intelligent Issue Resolution: RAG-powered GitHub issue analysis and automated fix generation
- π End-to-End Workflows: Analyze issues β Generate fixes β Create PRs with dry-run safety
- π GitHub Projects V2 Management: Create projects, manage roadmaps, track progress with custom dashboards
- π― 29 GitHub MCP Tools: Complete issue lifecycle + 8 project management tools + 5 sub-issues tools via natural language
- π Hierarchical Sub-Issues: Break down complex work with parent/child issue relationships
- List, add, remove, create, and reorder sub-issues
- Bulk add sub-issues to Projects V2 with smart field assignment
- Re-parenting support for reorganizing work
- Automatic issue number to ID conversion for intuitive usage
- π¬ Issue Comments: Add comments to existing issues for workflow updates and collaboration
- π§ Smart Project Assignment: RAG-enhanced field assignment based on issue content analysis
- π Project Templates: Pre-built templates for roadmaps, bug tracking, and feature planning
- π Flexible Authentication: Personal Access Token and GitHub App support
- π RAG-Enhanced Analysis: Leverage full codebase search for issue understanding
- π‘οΈ Safety-First Design: Dry-run mode, file protection, rate limiting, and audit logging
- ποΈ Context Window Visibility: Monitor what Claude knows in the current session
- π Token Usage Tracking: Real-time estimates of context window consumption
β οΈ Usage Warnings: Automatic alerts at 60% and 80% context usage- π Session Timeline: Chronological view of all context-consuming operations
- πΎ Session Persistence: Automatic saving for later analysis
- π Session Viewer: Utility to analyze patterns across sessions
- π― Content-Type Specific Models: Different AI models optimized for different content types
- Code: Programming-aware embeddings for 30-50% better code search relevance
- Config: Structure-aware models for precise JSON/YAML/XML navigation
- Documentation: Prose-optimized embeddings for natural documentation search
- π§ Language-Specific Understanding: Python idioms, JavaScript patterns, and more
- π₯ Reduced Cross-Type Noise: Configs don't pollute code searches and vice versa
- π‘οΈ Thread-Safe & Reliable: Comprehensive thread safety with fallback protection
- π Apple Silicon Optimized: Memory management with MPS acceleration
- π― Multi-Level Context: File β Class β Method hierarchy for optimal token usage
- π° 50-70% Token Reduction: Get high-level overviews without sacrificing detail access
- π§ Query Intent Detection: Automatically determines the right context level for your query
- β‘ Semantic Caching: Similar queries hit cache with 0.85 similarity threshold
- π Drill-Down Options: Start with overview, expand to details as needed
- ποΈ Smart Structure Building: Automatically constructs code hierarchies from search results
- π― Context-Aware: Automatically detects and scopes to your current project
- π Hybrid Search: Combines semantic understanding with keyword matching for +30% better precision
- π§ AST-Based Chunking: Structure-aware code parsing for Python, Shell, Go, JavaScript, and TypeScript (-40% tokens)
- π Dependency-Aware Search: Automatically includes files that import or are imported by your search results (v0.1.9)
- π Enhanced Search Context: Get surrounding code chunks automatically for better understanding (v0.2.0)
- π― Multi-Signal Ranking: 5-factor ranking system for 45% better search precision (v0.2.1)
- π Documentation Indexing: Index and search markdown documentation files (v0.2.3)
- β‘ Smart Incremental Reindexing: Only process changed files for 90%+ faster reindexing (v0.2.4)
- π Multi-Project Support: Keep different projects' knowledge separate
- π Fast Local Execution: Supports Apple Silicon MPS acceleration
- π§ Specialized Indexers: Language-aware code parsing and config file understanding
- π Optional Auto-Indexing: Keep your index up-to-date automatically as files change
- π Project-Aware Logging: Automatic log separation by project with rich debugging tools
- π₯ Health Monitoring: Built-in health checks with detailed system status
Complete documentation for setting up and using the Qdrant RAG server with Claude Code.
- Claude Code CLI
- Docker
- Python 3.10+ with
uv(ultraviolet package manager)
This project uses uv for fast, reliable Python package management. If you don't have it installed:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or with Homebrew
brew install uv
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"Why uv? It's 10-100x faster than pip and provides better dependency resolution. Learn more
# 1. Clone the repository
git clone <repository-url> ~/mcp-servers/qdrant-rag
cd ~/mcp-servers/qdrant-rag
# 2. Run setup (starts Qdrant, installs dependencies)
./scripts/setup.sh
# 3. Install globally with context awareness (ONE TIME ONLY)
./install_global.sh
# That's it! The MCP server is now available in ALL projects
# 4. Test in any project
cd ~/any-project
claude
# Ask: "What's my current project context?"# For current session only
export QDRANT_RAG_AUTO_INDEX=true
claude
# For permanent auto-indexing
echo 'export QDRANT_RAG_AUTO_INDEX=true' >> ~/.bashrc
# or for zsh users:
echo 'export QDRANT_RAG_AUTO_INDEX=true' >> ~/.zshrcThe MCP server needs to know your actual working directory to correctly detect projects. You have three options:
Simply tell Claude Code to set the working directory at the start of your session:
"Get current directory with pwd, export MCP_CLIENT_CWD to that value, then run health check"
This works immediately without any configuration changes!
In your Claude Code configuration (~/.claude-code/config.json):
{
"mcpServers": {
"qdrant-rag": {
"command": "python",
"args": ["/path/to/qdrant-rag/src/qdrant_mcp_context_aware.py"],
"env": {
"MCP_CLIENT_CWD": "${workspaceFolder}"
}
}
}
}{
"mcpServers": {
"qdrant-rag": {
"command": "python",
"args": [
"/path/to/qdrant-rag/src/qdrant_mcp_context_aware.py",
"--client-cwd",
"${workspaceFolder}"
]
}
}
}Note: Without proper working directory setup, the server may detect the wrong project. The natural language approach (Option 1) is the quickest way to get started. See Claude Code Configuration Guide for more details.
- Complete Setup & Usage Guide π - Comprehensive setup and usage instructions
- Includes: Changing Embedding Models - What to expect when switching models
- GitHub Integration Guide π€ - Setup and use GitHub issue resolution (v0.3.0)
- GitHub Projects Guide π - Manage GitHub Projects V2 with custom fields (v0.3.4)
- Context-Aware Guide π― - How the context-aware system works
- MCP Scope Configuration Guide π§ - Understanding local vs global configuration
- Practical Usage Examples π‘ - Real-world examples with Claude Code
- Why MCP RAG for Agentic Coding π€ - Understand how MCP enables efficient AI coding
- Context Tracking Guide ποΈ - Monitor and understand Claude's context window usage (v0.3.1)
- Qdrant Quick Reference - Quick commands for Qdrant operations
- MPS Quick Reference - Apple Silicon optimization guide
- Troubleshooting Guide - Common issues and solutions
- Enhanced RAG Guide - Technical implementation details
- Development Workflow Guide π οΈ - Efficient development patterns using RAG search
- Progressive Context Implementation π― - Multi-level context retrieval system (v0.3.2)
- AST Chunking Implementation - How AST-based chunking works (v0.1.5+)
- Hybrid Search Implementation - How hybrid search works (v0.1.4+)
- Enhanced Ranking Guide π― - Configure multi-signal ranking for better results (v0.2.1+)
- MCP Protocol Research - Research on MCP protocol and race conditions
- Installation Playbook - Detailed breakdown of how installation works
- Context Awareness Playbook - Deep dive into context detection
- Get started quickly β Complete Setup & Usage Guide
- π Automate GitHub issues β GitHub Integration Guide
- π Manage GitHub Projects β GitHub Projects Guide
- π Use progressive search efficiently β Progressive Search Usage Guide
- Load context fast in Claude β Quick Context Setup
- Use RAG in ALL my projects β MCP Scope Configuration Guide
- Understand project isolation β Context-Aware Guide
- See practical examples β Usage Examples
- Troubleshoot issues β Troubleshooting Guide
- Optimize for Apple Silicon β MPS Quick Reference
# Run the installer - it handles everything
./install_global.shManual Indexing (Default)
# Navigate to any project
cd ~/projects/my-app
claude
# In Claude:
# - Index: "Index all code files in this project"
# - Search: "Find authentication functions"
# - Context: "What's my current project context?"π GitHub Issue Resolution (v0.3.0)
# In Claude with GitHub integration:
# - Setup: "Switch to repository owner/repo-name"
# - Create: "Create a test issue with title 'Bug in login' and labels 'bug'"
# - Analyze: "Analyze issue #123 using RAG search"
# - Fix: "Generate fix suggestions for issue #123"
# - Resolve: "Resolve issue #123 in dry-run mode"π GitHub Projects V2 Management (v0.3.4)
# In Claude with GitHub Projects:
# - Create: "Create a roadmap project for Q1 2025"
# - Template: "Create a bug tracking project from template"
# - Add Items: "Add issue #123 to project with smart field assignment"
# - Status: "Show project #1 status with completion metrics"
# - Update: "Update issue #123 status to In Progress"
# - Custom Fields: "Create a priority field with High/Medium/Low options"π Progressive Context Management (v0.3.2)
# In Claude - use progressive context for token efficiency:
# - Overview: "What does the authentication system do?" (70% token reduction)
# - Navigation: "Find the DatabaseManager class" (50% token reduction)
# - Debugging: "Show me the bug in save_user function" (20% token reduction)
# - Explicit: "Search for logging with context_level=file"
# - Full detail: "Search for validate_user with progressive_mode=false"
# The system automatically:
# - Detects query intent (understanding vs debugging)
# - Uses semantic cache for similar queries
# - Provides drill-down options for deeper explorationWith Auto-Indexing
# Enable for this session
export QDRANT_RAG_AUTO_INDEX=true
cd ~/projects/my-app
claude
# Files are automatically indexed as you work!
# Just search - no manual indexing neededReindexing (Clean Index)
# Use reindex when files have been:
# - Renamed or moved
# - Deleted
# - You see stale results
# In Claude:
# "Reindex this project" - Clears old data before indexing
# "Reindex the src directory" - Clean reindex of specific directory
# Regular index only adds new content
# Reindex removes old + adds new contentDependency-Aware Search (v0.1.9+)
# In Claude - search with dependencies:
# "Search for 'validate_user' and include files that import it"
# "Find 'database connection' including dependent files"
# The include_dependencies parameter automatically:
# - Finds files that import the search results
# - Finds files imported by the search results
# - Shows related code for better understanding- Specialized Code Indexer: Language-specific parsing for 10+ programming languages
- Advanced Config Indexer: Support for JSON, XML, YAML, TOML, INI, ENV files
- Structure-Aware Chunking: Functions, classes, and config sections
- Rich Metadata: Line numbers, imports, dependencies, schema extraction
- Default Patterns: Automatically indexes common code, config, and doc files
- Custom Patterns: Specify exactly which file types to index
- Usage Examples:
# In Claude Code "Index directory with patterns *.sql *.graphql" "Index only Rust files: *.rs *.toml Cargo.lock" "Reindex with patterns *.proto *.pb.go for protobuf"
- Supported Patterns: Any glob pattern (*.ext, specific-file.ext, etc.)
- Structure-Aware Parsing: Uses Abstract Syntax Trees to understand code structure
- Complete Code Units: Never splits functions or classes in the middle
- Multi-Language Support: Python, JavaScript/TypeScript, Shell scripts, and Go
- Hierarchical Metadata: Tracks relationships (module β class β method)
- 40-60% Fewer Chunks: More efficient token usage while preserving meaning
- Language-Specific Features:
- Python: Classes, methods, functions with decorators and docstrings
- JavaScript/TypeScript: ES6 modules, React components, arrow functions (v0.1.8)
- Shell: Function extraction with setup code preservation
- Go: Packages, structs, interfaces with visibility rules
- Automatic Dependency Inclusion: Find files that import or are imported by your search results
- Bidirectional Relationships: Tracks both imports and exports across the codebase
- Smart Scoring: Related files included with reduced scores to maintain relevance
- Import Resolution: Handles relative and absolute imports with path resolution
- Use Cases:
- Find all files using a specific function or class
- Understand the impact of changes by seeing dependent code
- Trace code flow through import chains
- Discover usage patterns across your project
- Three Search Modes: Hybrid (default), vector-only, keyword-only
- Smart Ranking: Combines exact keyword matches with semantic understanding
- Score Transparency: See individual contributions (vector_score, bm25_score)
- Automatic Mode: Hybrid search works out-of-the-box for best results
- 5 Ranking Signals: Combines multiple factors for optimal relevance
- Base score (semantic + keyword match)
- File proximity (same directory boost)
- Dependency distance (import relationships)
- Code structure similarity (functions, classes)
- Recency (recent modifications prioritized)
- Configurable Weights: Tune ranking for your workflow via
server_config.json - 45% Better Precision: Measured improvement in search relevance
- Visible Signals: See why results ranked as they did with
ranking_signals - Configuration Guide: Learn how to customize ranking
- Automatic Project Detection: Based on .git, package.json, etc.
- Project Isolation: Each project gets separate collections
- Smart Scoping: Searches default to current project only
- Cross-Project Option: Available when needed
- MPS Acceleration: Metal Performance Shaders support for M1/M2/M3 chips
- Local Mode: Native macOS execution for maximum performance
- Smart Caching: Efficient model storage and loading
- Automatic Log Separation: Logs organized by project, no mixing
- Structured JSON Format: Rich metadata for every operation
- Performance Tracking: Operation timing and success metrics
- Log Viewer Utility: Search, filter, and tail logs easily
- Configurable Levels: Debug specific operations as needed
- Connection Retry Logic: Automatic retry with exponential backoff
- Health Monitoring: Built-in health check for all services
- Progress Indicators: Track long-running operations
- Input Validation: Path traversal prevention and sanitization
- Better Error Handling: User-friendly messages with error codes
Claude Code ββ MCP Protocol ββ Context-Aware RAG Server ββ Qdrant Vector DB
β
Project Detection
β
Project-Specific Collections
β
Specialized Indexers
(Code + Config)
This project includes two distinct servers:
-
MCP Server (
src/qdrant_mcp_context_aware.py) - The main server- Integrates directly with Claude Code via stdio
- No network port - communicates via stdin/stdout
- Started automatically by Claude Code when needed
- This is what you use for normal operation
-
HTTP Test Server (
src/http_server.py) - Optional testing interface- Provides REST API endpoints on port 8081
- Only for testing indexing/search without Claude Code
- Not required for normal Claude Code usage
- Useful for debugging and integration testing
- Semantic Code Search: "Find authentication functions similar to UserService"
- Configuration Discovery: "Where is the database connection configured?"
- Pattern Analysis: "Show me error handling patterns in this codebase"
- Code Understanding: "How does the logging system work?"
- Cross-Project Insights: "Show JWT implementations across all my projects"
- Intelligent Issue Analysis: "Analyze issue #123 to understand the bug and find related code"
- Automated Fix Generation: "Generate fix suggestions for the authentication issue in #456"
- Repository Management: "Switch to my backend repository and show open issues"
- Issue Workflow: "Create a test issue, analyze it, and generate a fix in dry-run mode"
- Pull Request Creation: "Create a PR to resolve the login bug with automated content"
The server includes a health check tool to monitor all services:
# In Claude Code
"Check health status"
"Run health check"The health check reports:
- Qdrant Connection: Status and collection count
- Embedding Model: Model name and dimension verification
- Disk Space: Available storage with warnings
- Memory Usage: System memory status (if psutil installed)
- Project Context: Current project information
The server automatically retries failed operations:
- Exponential backoff for transient failures
- Automatic reconnection to Qdrant
- Graceful degradation with clear error messages
The server includes comprehensive project-aware logging for debugging and monitoring.
# View logs for current project
./scripts/qdrant-logs
# Follow logs in real-time
./scripts/qdrant-logs -f
# Filter by log level
./scripts/qdrant-logs --level ERROR
# Search logs
./scripts/qdrant-logs --search "index.*failed"
# View logs for specific project
./scripts/qdrant-logs --project /path/to/project
# Export logs for analysis
./scripts/qdrant-logs --export json > debug-logs.jsonLogs are stored in ~/.mcp-servers/qdrant-rag/logs/:
global/- Server startup and non-project operationsprojects/- Separated by project with friendly names (e.g.,qdrant-rag_70e24d/)errors/- Critical errors across all projects
Control logging via environment variables:
export QDRANT_LOG_LEVEL=DEBUG # Set log level
export QDRANT_LOG_DIR=/custom/path # Custom log directory| Issue | Solution | Reference |
|---|---|---|
| MCP not available globally | Add with -s user flag |
MCP Scope Guide |
| Wrong project detected | Check project markers | Context-Aware Guide |
| MPS not working | Use local mode | MPS Guide |
| No search results | Index first, check scope | Troubleshooting |
- β
Content-Type Specific Models: Different embedding models for different content types
- Code:
nomic-ai/CodeRankEmbed(768D) - Programming-aware embeddings for superior code search - Config:
jinaai/jina-embeddings-v3(1024D) - Structure-aware for JSON/YAML/XML files - Documentation:
hkunlp/instructor-large(768D) - Prose-optimized for markdown/docs - General:
sentence-transformers/all-MiniLM-L12-v2(384D) - Backward compatibility
- Code:
- β 30-50% Better Code Search: Programming-aware embeddings understand code context better
- β Unified Memory Management: Apple Silicon optimizations with conservative memory limits
- β Model Registry System: Central model management with compatibility checking
- β Enhanced Model Scripts: Improved download_models.sh with specialized model support
- β
Critical Post-Release Fixes (v0.3.3.post1-4):
- Fixed Critical Search Error: Payload type validation preventing search failures
- Fixed Context Tracking Error: Configuration float handling for proper context tracking
- π§ Fixed Dimension Mismatch: Resolved "Vector dimension error: expected dim: 768, got 384"
- Root Cause: Thread safety issues causing CodeRankEmbed model eviction
- Solution: Comprehensive thread safety + dimension-compatible fallback logic
- Impact: Code files now always get correct 768D embeddings
- β Test Suite Reorganization: Clean categorization (unit/integration/performance/debug)
- π Memory Management Guide: Apple Silicon optimization details
- β GitHub Projects V2 Support: Full GraphQL API integration for modern project management
- β 8 New Project Tools: Create projects, add items, update fields, track progress
- β Smart Field Assignment: RAG-enhanced analysis automatically assigns priority/status/type
- β Project Templates: Pre-built templates for roadmaps, bug tracking, feature planning
- β Custom Field Support: Create and manage TEXT, NUMBER, DATE, SINGLE_SELECT fields
- β Progress Dashboards: Automatic completion metrics and status tracking
- β GraphQL Adapter Pattern: Clean separation preserving existing REST functionality
- π GitHub Projects Guide: Complete guide with examples and templates
- β Multi-Level Context Retrieval: File β Class β Method hierarchy for 50-70% token reduction
- β Semantic Caching: Similar queries hit cache with 0.85 similarity threshold
- β Query Intent Detection: Automatically determines optimal context level
- β Configurable Scoring Pipeline: Modular scoring system with pluggable stages
- β Enhanced BM25 Tokenization: Code-specific preprocessing (camelCase, snake_case)
- β Linear Combination Scoring: More accurate hybrid search scores (0.6-0.9 vs 0.01-0.02)
- β Context Window Visibility: Monitor what Claude knows in current session
- β Token Usage Tracking: Real-time estimates with warnings at 60%/80%
- β Session Timeline: Chronological view of all context-consuming operations
- β Session Persistence: Automatic saving for later analysis
- β 10 GitHub MCP Tools: Complete issue lifecycle management via Claude Code
- β RAG-Powered Issue Analysis: Leverage codebase search for intelligent issue understanding
- β Automated Fix Generation: Generate code fixes with confidence scoring and templates
- β End-to-End Workflows: Analyze β Generate β Create PR with dry-run safety
- β Issue Comments: Add comments to existing issues for workflow updates
- β Flexible Authentication: Personal Access Token and GitHub App support
- β
HTTP API Testing: 10 new endpoints under
/github/for testing and integration - β Safety-First Design: Dry-run mode, rate limiting, audit logging, file protection
- β Configuration Enhanced: Fixed environment variable resolution for better config management
- π GitHub Integration Guide: Comprehensive 700+ line setup and usage guide
- β Multi-Signal Ranking: Search results now ranked by 5 configurable factors
- β File Proximity Scoring: Boosts results from same/nearby directories
- β Dependency Distance: Prioritizes files with import relationships
- β Code Structure Similarity: Groups similar code patterns together
- β Recency Weighting: Recently modified files surface first
- β 45% Better Precision: Significant improvement in search relevance
- π Configuration Guide: Learn how to tune ranking for your workflow
- β Automatic Context Expansion: Get surrounding chunks with search results
- β
Configurable Context: Control how much context with
context_chunksparameter - β Get File Chunks Tool: Retrieve complete files or specific chunk ranges
- β Doubled Chunk Sizes: Better semantic understanding (code: 3000, config: 2000 chars)
- β 60% Fewer Operations: Reduced need for follow-up grep/read operations
- β Dependency-Aware Search: Automatically include files that import or are imported by search results
- β Dependency Graph Builder: Tracks bidirectional import/export relationships across codebase
- β Enhanced Code Understanding: See how code modules relate and depend on each other
- β JavaScript/TypeScript Support: Full AST parsing for JS/TS files including React components
- β ES6 Module Support: Handles modern import/export syntax and arrow functions
- β Expanded Language Coverage: Now supports 5 languages with AST parsing
- β Shell Script Indexing: Fixed default patterns to include .sh, .bash, .zsh files
- β Better Script Support: Improved handling of executable scripts
- β AST-Based Chunking: Structure-aware parsing for better code understanding (v0.1.5)
- β Hybrid Search: Combined vector + keyword search for 30% better precision (v0.1.4)
- β Context-Aware System: Automatic project detection and scoping
- β Global Installation: Works across all projects with proper setup
- β MPS Support: Apple Silicon GPU acceleration for faster embeddings
- β Project-Aware Logging: Automatic log separation and rich debugging tools
- β Smart Reindexing: Clean index updates to prevent stale data
Happy coding with context-aware semantic search! π