Qdrant RAG MCP Server
About
A semantic search server for codebases using Qdrant, featuring intelligent GitHub issue and project management.
Explore
The 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": ](https://github.com/astral-sh/uv)["/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. SeeClaude Code Configuration Guidefor more details.
- Complete Setup & Usage Guideπ - Comprehensive setup and usage instructions
- Includes:Changing Embedding Models- What to expect when switching models
- 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.sh
# 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?"
# 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 exploration
# 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 needed
# 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 content
# 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"
- 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)
- 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"
- 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.json
Logs are stored in~/.mcp-servers/qdrant-rag/logs/:
- global/- Server startup and non-project operations
- projects/- 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
A context-aware Model Context Protocol (MCP) server that provides semantic search capabilities across your codebase using Qdrant vector database. Now withintelligent GitHub issue resolution(v0.3.0),GitHub Projects V2 management(v0.3.4), andhierarchical 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 β
π GitHub Integration (v0.3.0) + Projects V2 (v0.3.4) + Sub-Issues (v0.3.4.post4)
- π€ 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
- ποΈ 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
π Progressive Context Management (v0.3.2)
- π― 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+ withuv(ultraviolet package manager)
This project usesuvfor 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' >> ~/.zshrc
π§ Working Directory Configuration (Important!)
The MCP server needs to know your actual working directory to correctly detect projects. You have three options:
Option 1: Natural Language (No Configuration Required!)
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!
Option 2: Environment Variable Configuration
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. SeeClaude Code Configuration Guidefor more details.
- Complete Setup & Usage Guideπ - Comprehensive setup and usage instructions
- Includes:Changing Embedding Models- What to expect when switching models
- 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
β¦
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.


