Skip to main content
Glama

MCP Qdrant Codebase Embeddings

by steiner385

MCP Qdrant Codebase Embeddings

This MCP (Model Context Protocol) server uses Qdrant vector database to provide semantic understanding of your codebase. It enables AI assistants to understand relationships between files, find similar code patterns, and provide architectural insights.

Features

  • Semantic File Search: Find files based on their purpose or functionality
  • Relationship Discovery: Understand how files relate to each other (imports, exports, tests, etc.)
  • Architecture Analysis: Get insights into code structure, dependencies, and potential issues
  • Refactoring Suggestions: Find candidates for refactoring based on various criteria
  • Code Pattern Recognition: Identify similar code patterns across the codebase

Setup

Prerequisites

  1. Qdrant: You need a running Qdrant instance
    # Using Docker docker run -p 6333:6333 qdrant/qdrant # Or use the docker-compose.yml in the parent directory docker-compose -f ../docker-compose.qdrant.yml up -d
  2. Node.js: Version 18 or higher

Installation

  1. Install dependencies:
    cd mcp-server npm install
  2. Configure environment:
    cp .env.example .env # Edit .env with your configuration
  3. Index your codebase:
    npm run index # Or index a specific directory npm run index /path/to/codebase

Running the Server

npm run dev # Development mode with auto-reload npm start # Production mode

MCP Tools Available

Find files that are semantically related to a given file.

Parameters:

  • filePath: Path to the file to find relationships for
  • limit: Maximum number of related files to return (default: 10)

Example:

{ "filePath": "src/components/Button.tsx", "limit": 5 }

2. search_by_purpose

Search for files that match a specific purpose or functionality.

Parameters:

  • purpose: Description of the purpose or functionality
  • limit: Maximum number of files to return (default: 10)

Example:

{ "purpose": "authentication and user login", "limit": 10 }

3. analyze_architecture

Analyze the codebase architecture and identify patterns, issues, and insights.

Parameters:

  • rootPath: Root path to analyze (optional, defaults to current directory)

Example:

{ "rootPath": "/home/user/project" }

4. find_refactoring_candidates

Find files that match criteria for refactoring.

Parameters:

  • criteria: Description of what needs refactoring
  • limit: Maximum number of files to return (default: 20)

Example:

{ "criteria": "complex functions with high cyclomatic complexity", "limit": 15 }

5. explain_file_relationship

Explain the relationship between two files.

Parameters:

  • sourceFile: Path to the source file
  • targetFile: Path to the target file

Example:

{ "sourceFile": "src/services/UserService.ts", "targetFile": "src/types/User.ts" }

How It Works

  1. Indexing: The system analyzes each file in your codebase and generates embeddings that capture:
    • File structure and patterns
    • Imports and exports
    • Classes, functions, and interfaces
    • Code complexity and style
  2. Vector Storage: These embeddings are stored in Qdrant, enabling fast similarity searches
  3. Relationship Analysis: The system can identify various types of relationships:
    • Imports: Direct dependency relationships
    • Exports: Provider-consumer relationships
    • Similar: Files with similar structure or purpose
    • Complementary: Files that work together
    • Test: Test files and their implementations
    • Implementation: Interface/type implementations
  4. Semantic Search: When you search by purpose, the system:
    • Generates an embedding for your query
    • Finds files with similar embeddings
    • Returns the most relevant matches

Configuration

For best results, provide an OpenAI API key in your .env file. This uses OpenAI's text-embedding-ada-002 model.

Using Local Embeddings

If no OpenAI API key is provided, the system falls back to local embeddings based on code patterns. While less sophisticated, this still provides useful results without external dependencies.

Development

Building

npm run build

Testing

npm test

Adding New Tools

To add new MCP tools:

  1. Add the tool definition in src/index.ts in the ListToolsRequestSchema handler
  2. Add the handler in the CallToolRequestSchema switch statement
  3. Implement the logic in the appropriate service

Troubleshooting

Qdrant Connection Issues

  • Ensure Qdrant is running on the configured URL (default: http://localhost:6333)
  • Check if the port is not blocked by firewall
  • Verify QDRANT_URL in your .env file

Indexing Issues

  • Check file permissions for the codebase directory
  • Ensure sufficient memory for large codebases
  • Monitor Qdrant logs for storage issues

Embedding Generation Issues

  • If using OpenAI, verify your API key is valid
  • Check rate limits if indexing large codebases
  • Consider using local embeddings for development

Integration with AI Assistants

This MCP server is designed to work with AI assistants that support the Model Context Protocol. Configure your AI assistant to connect to this server to enable codebase-aware responses.

Claude Desktop Configuration

Add to your Claude desktop configuration:

{ "mcpServers": { "qdrant-codebase": { "command": "node", "args": ["/path/to/mcp-server/dist/index.js"], "env": { "QDRANT_URL": "http://localhost:6333" } } } }

License

This tool is part of the FamilyManager project and follows the same license terms.

-
security - not tested
F
license - not found
-
quality - not tested

A Model Context Protocol server that provides semantic understanding of codebases using Qdrant vector database, enabling AI assistants to search files by purpose, discover relationships between files, analyze architecture, and identify refactoring opportunities.

  1. Features
    1. Setup
      1. Prerequisites
      2. Installation
      3. Running the Server
    2. MCP Tools Available
      1. find_related_files
      2. search_by_purpose
      3. analyze_architecture
      4. find_refactoring_candidates
      5. explain_file_relationship
    3. How It Works
      1. Configuration
        1. Using OpenAI Embeddings (Recommended)
        2. Using Local Embeddings
      2. Development
        1. Building
        2. Testing
        3. Adding New Tools
      3. Troubleshooting
        1. Qdrant Connection Issues
        2. Indexing Issues
        3. Embedding Generation Issues
      4. Integration with AI Assistants
        1. Claude Desktop Configuration
      5. License

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol (MCP) server that enables semantic search and retrieval of documentation using a vector database (Qdrant). This server allows you to add documentation from URLs or local files and then search through them using natural language queries.
          Last updated -
          14
          74
          JavaScript
          Apache 2.0
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables AI agents to retrieve and understand entire codebases at once, providing tools to analyze local workspaces or remote GitHub repositories.
          Last updated -
          9
          TypeScript
          MIT License
          • Linux
          • Apple
        • -
          security
          F
          license
          -
          quality
          A server component of the Model Context Protocol that provides intelligent analysis of codebases using vector search and machine learning to understand code patterns, architectural decisions, and documentation.
          Last updated -
          4
          Python
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables semantic search capabilities by providing tools to manage Qdrant vector database collections, process and embed documents using various embedding services, and perform semantic searches across vector embeddings.
          Last updated -
          89
          TypeScript
          MIT License

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/steiner385/mcp-qdrant-codebase-embeddings'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server