mcp-server-qdrant

repository·master·Indexed 23 days ago

https://github.com/qdrant/mcp-server-qdrant

An official Model Context Protocol (MCP) server that turns a Qdrant vector database into a semantic memory layer for LLMs. It provides tools for storing information via `qdrant-store` and retrieving it through semantic search using `qdrant-find`. The server supports multiple transport protocols including stdio, SSE, and streamable-http, and can be deployed via uvx, Docker, or Smithery.

Tokens
5.9K
Snippets
11
Records
29
Agent score
81%

What's inside mcp-server-qdrant

  1. Overview of mcp-server-qdrant

    master
    The mcp-server-qdrant is an official Model Context Protocol (MCP) server that provides a semantic memory layer on top of the Qdrant vector search engine. It allows LLM applications to store and retrieve information (memories) using semantic search capabilities provided by Qdrant.
  2. Set up Qdrant MCP with Claude Code

    master

    To enable semantic search over your codebase using Claude Code, add the mcp-server-qdrant using the claude mcp add command. You must specify the Qdrant connection details, the collection name, and the embedding model to be used.

    Once added, Claude Code can use the qdrant-store tool to save snippets and the qdrant-find tool to search for them using natural language queries.

    # Add mcp-server-qdrant configured for code search
    claude mcp add code-search \
    -e QDRANT_URL="http://localhost:6333" \
    -e COLLECTION_NAME="code-repository" \
    -e EMBEDDING_MODEL="sentence-transformers/all-MiniLM-L6-v2" \
    -e TOOL_STORE_DESCRIPTION="Store code snippets with descriptions. The 'information' parameter should contain a natural language description of what the code does, while the actual code should be included in the 'metadata' parameter as a 'code' property." \
    -e TOOL_FIND_DESCRIPTION="Search for relevant code snippets using natural language. The 'query' parameter should describe the functionality you're looking for." \
    -- uvx mcp-server-qdrant
    
    # Verify the server was added
    claude mcp list
  3. Manually install Qdrant MCP in VS Code

    master

    To manually configure the Qdrant MCP server in VS Code, add a configuration block to your User Settings (JSON) or a workspace-specific .vscode/mcp.json file. You can choose between using uvx or docker as the execution command.

    Both methods require defining inputs for qdrantUrl, qdrantApiKey, and collectionName to allow for secure and flexible configuration.

    {
      "mcp": {
        "inputs": [
          {
            "type": "promptString",
            "id": "qdrantUrl",
            "description": "Qdrant URL"
          },
          {
            "type": "promptString",
            "id": "qdrantApiKey",
            "description": "Qdrant API Key",
            "password": true
          },
          {
            "type": "promptString",
            "id": "collectionName",
            "description": "Collection Name"
          }
        ],
        "servers": {
          "qdrant": {
            "command": "uvx",
            "args": ["mcp-server-qdrant"],
            "env": {
              "QDRANT_URL": "${input:qdrantUrl}",
              "QDRANT_API_KEY": "${input:qdrantApiKey}",
              "COLLECTION_NAME": "${input:collectionName}"
            }
          }
        }
      }
    }
  4. Install and run mcp-server-qdrant using uvx

    master

    You can run the server directly using uvx without a manual installation. You can specify the transport protocol using the --transport flag.

    Supported Transport Protocols:

    • stdio (default): Standard input/output transport, typically for local MCP clients.
    • sse: Server-Sent Events transport, for remote clients. Listens on a port (default 8000).
    • streamable-http: Streamable HTTP transport, for remote clients.

    Example: Basic run with stdio

    QDRANT_URL="http://localhost:6333" \
    COLLECTION_NAME="my-collection" \
    EMBEDDING_MODEL="sentence-transformers/all-MiniLM-L6-v2" \
    uvx mcp-server-qdrant

    Example: Run with SSE transport on a custom port

    QDRANT_URL="http://localhost:6333" \
    COLLECTION_NAME="my-collection" \
    FASTMCP_SERVER_PORT=1234 \
    uvx mcp-server-qdrant --transport sse
  5. Install and run mcp-server-qdrant using Docker

    master

    You can build and run the server using Docker. When running in a container, ensure FASTMCP_SERVER_HOST is set to 0.0.0.0 so the server listens on all network interfaces.

    Build the container:

    docker build -t mcp-server-qdrant .

    Run the container:

    docker run -p 8000:8000 \
      -e FASTMCP_SERVER_HOST="0.0.0.0" \
      -e QDRANT_URL="http://your-qdrant-server:6333" \
      -e QDRANT_API_KEY="your-api-key" \
      -e COLLECTION_NAME="your-collection" \
      mcp-server-qdrant
  6. Configure Qdrant MCP for Cursor or Windsurf

    master

    You can use the Qdrant MCP server as a code search tool in Cursor or Windsurf by running it with SSE (Server-Sent Events) transport and providing custom tool descriptions via environment variables. This allows the AI to store and retrieve code snippets using semantic search.

    To set this up:

    1. Run the server using uvx with the --transport sse flag.
    2. Set QDRANT_URL, COLLECTION_NAME, TOOL_STORE_DESCRIPTION, and TOOL_FIND_DESCRIPTION environment variables.
    3. In Cursor/Windsurf settings, point to the running server using the SSE transport protocol (e.g., http://localhost:8000/sse for local runs).

    Note: If the tools aren't being used, consider creating Cursor rules to explicitly instruct the agent to use the MCP tools when generating code.

    QDRANT_URL="http://localhost:6333" \
    COLLECTION_NAME="code-snippets" \
    TOOL_STORE_DESCRIPTION="Store reusable code snippets for later retrieval. \\nThe 'information' parameter should contain a natural language description of what the code does, \\nwhile the actual code should be included in the 'metadata' parameter as a 'code' property. \\nThe value of 'metadata' is a Python dictionary with strings as keys. \\nUse this whenever you generate some code snippet." \
    TOOL_FIND_DESCRIPTION="Search for relevant code snippets based on natural language descriptions. \\nThe 'query' parameter should describe what you're looking for, \\nand the tool will return the most relevant code snippets. \\nUse this when you need to find existing code snippets for reuse or reference." \
    uvx mcp-server-qdrant --transport sse # Enable SSE transport
  7. Configure Qdrant MCP in VS Code using Docker

    master

    If you prefer running the MCP server in an isolated container, use the following configuration in your VS Code User Settings (JSON) or .vscode/mcp.json. This setup maps port 8000 and passes the necessary Qdrant environment variables through to the container.

    {
      "mcp": {
        "inputs": [
          {
            "type": "promptString",
            "id": "qdrantUrl",
            "description": "Qdrant URL"
          },
          {
            "type": "promptString",
            "id": "qdrantApiKey",
            "description": "Qdrant API Key",
            "password": true
          },
          {
            "type": "promptString",
            "id": "collectionName",
            "description": "Collection Name"
          }
        ],
        "servers": {
          "qdrant": {
            "command": "docker",
            "args": [
              "run",
              "-p", "8000:8000",
              "-i",
              "--rm",
              "-e", "QDRANT_URL",
              "-e", "QDRANT_API_KEY",
              "-e", "COLLECTION_NAME",
              "mcp-server-qdrant"
            ],
            "env": {
              "QDRANT_URL": "${input:qdrantUrl}",
              "QDRANT_API_KEY": "${input:qdrantApiKey}",
              "COLLECTION_NAME": "${input:collectionName}"
            }
          }
        }
      }
    }
  8. Run Qdrant MCP in Development Mode

    master

    To debug or develop the server, use the mcp dev command. This starts the server and launches the MCP inspector in your web browser for interactive testing.

    COLLECTION_NAME=mcp-dev fastmcp dev src/mcp_server_qdrant/server.py
  9. Manually configure Claude Desktop for mcp-server-qdrant

    master

    To use this server with Claude Desktop, add a configuration entry to the mcpServers section of your claude_desktop_config.json file.

    Configuration for Remote Qdrant (Cloud/Server):

    {
      "qdrant": {
        "command": "uvx",
        "args": ["mcp-server-qdrant"],
        "env": {
          "QDRANT_URL": "https://xyz-example.eu-central.aws.cloud.qdrant.io:6333",
          "QDRANT_API_KEY": "your_api_key",
          "COLLECTION_NAME": "your-collection-name",
          "EMBEDDING_MODEL": "sentence-transformers/all-MiniLM-L6-v2"
        }
      }
    }

    Configuration for Local Qdrant:

    {
      "qdrant": {
        "command": "uvx",
        "args": ["mcp-server-qdrant"],
        "env": {
          "QDRANT_LOCAL_PATH": "/path/to/qdrant/database",
          "COLLECTION_NAME": "your-collection-name",
          "EMBEDDING_MODEL": "sentence-transformers/all-MiniLM-L6-v2"
        }
      }
    }

    Note: The server will automatically create the specified collection if it does not exist.

  10. Test mcp-server-qdrant locally with MCP Inspector

    master

    To test and debug the mcp-server-qdrant server, use the MCP inspector. This tool provides a client UI (default port 5173) and an MCP proxy server (default port 3000).

    Run the server in development mode using fastmcp dev while providing the necessary environment variables for the Qdrant connection and collection name. Once the command is running, access the inspector interface in your browser at http://localhost:5173.

    QDRANT_URL=":memory:" COLLECTION_NAME="test" \
    fastmcp dev src/mcp_server_qdrant/server.py
  11. Configure mcp-server-qdrant via environment variables

    master

    The server is configured using environment variables.

    Important Constraints:

    • You cannot provide both QDRANT_URL and QDRANT_LOCAL_PATH at the same time.
    • If COLLECTION_NAME is provided, the collection_name argument in tools becomes optional.

    Qdrant Configuration Variables:

    NameDescriptionDefault
    QDRANT_URLURL of the Qdrant serverNone
    QDRANT_API_KEYAPI key for the Qdrant serverNone
    COLLECTION_NAMEName of the default collection to useNone
    QDRANT_LOCAL_PATHPath to the local Qdrant database (alternative to QDRANT_URL)None
    EMBEDDING_PROVIDEREmbedding provider (currently only fastembed is supported)fastembed
    EMBEDDING_MODELName of the embedding model to usesentence-transformers/all-MiniLM-L6-v2
    TOOL_STORE_DESCRIPTIONCustom description for the store tool(from settings.py)
    TOOL_FIND_DESCRIPTIONCustom description for the find tool(from settings.py)
    QDRANT_SEARCH_LIMITMaximum number of results to return from search10
    QDRANT_READ_ONLYEnable read-only mode (disables qdrant-store)false

    FastMCP Server Variables:

    NameDescriptionDefault
    FASTMCP_LOG_LEVELLogging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)INFO
    FASTMCP_SERVER_DEBUGEnable debug modefalse
    FASTMCP_SERVER_HOSTHost address to bind the server to127.0.0.1
    FASTMCP_SERVER_PORTPort to run the server on8000
    FASTMCP_SERVER_ON_DUPLICATE_RESOURCESBehavior for duplicate resources (warn, error, replace, ignore)warn
    FASTMCP_SERVER_ON_DUPLICATE_TOOLSBehavior for duplicate tools (warn, error, replace, ignore)warn
    FASTMCP_SERVER_ON_DUPLICATE_PROMPTSBehavior for duplicate prompts (warn, error, replace, ignore)warn
    FASTMCP_SERVER_DEPENDENCIESList of dependencies to install in the server environment[]