Skip to main content
Glama
famtong8-dev

w3-mcp-server-qdrant

by famtong8-dev

W3 MCP Qdrant Server

Python MCP server for vector search using Qdrant vector database and Ollama embeddings.

Status: ✅ Working with Qdrant vector search and Ollama embeddings + Advanced query techniques

Features

  • qdrant_search - Search for similar documents using text queries (auto-embedded via Ollama)

    • ✨ Query Expansion - Generate N query variations, search all, merge with RRF

    • ✨ HyDE - Hypothetical Document Embeddings for semantic enrichment

    • ✨ Reranking - Use LLM to reorder results by relevance

  • qdrant_list_collections - List and manage Qdrant collections

Supports flexible output formats (Markdown or JSON) with configurable similarity thresholds and advanced search options.

Related MCP server: Tiny Chat

Quick Start

1. Prerequisites Setup

Qdrant Server

# Using Docker (Recommended)
docker run -p 6333:6333 qdrant/qdrant:latest

Or install locally: Qdrant Quick Start

Ollama Server

# Install: https://ollama.ai
ollama pull bge-m3
ollama pull mistral
ollama serve

Available embedding models:

  • bge-m3 (384 dims) - ⭐ recommended - best quality-speed balance

  • nomic-embed-text (768 dims) - balanced, good for general use

  • mxbai-embed-large (1024 dims) - highest quality

  • all-minilm (384 dims) - ultra-lightweight, good for mobile

2. Clean Setup (Important!)

cd /path/to/w3-mcp-server-qdrant

# Remove old lockfile and venv
rm -rf uv.lock .venv venv

# Unset old environment variable
unset VIRTUAL_ENV

3. Install Dependencies with uv

# Install all Python dependencies using uv
uv sync

That's it! uv sync installs all dependencies including MCP, pydantic, qdrant-client, and httpx.

4. Configure Environment

Create a .env file from template:

cp .env.example .env

Edit .env:

# Qdrant Configuration
QDRANT_URL=http://localhost:6333
QDRANT_API_KEY=  # Optional if using API key auth

# Ollama Configuration
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_EMBED_MODEL=bge-m3:latest
OLLAMA_RERANK_MODEL=mistral  # For query expansion and reranking

Or export environment variables:

export QDRANT_URL=http://localhost:6333
export OLLAMA_BASE_URL=http://localhost:11434
export OLLAMA_EMBED_MODEL=bge-m3:latest
export OLLAMA_RERANK_MODEL=mistral

5. Verify Installation

# Check Qdrant
curl http://localhost:6333/health

# Check Ollama
curl http://localhost:11434/api/tags

# Check Python env
uv run python -c "from mcp.server.fastmcp import FastMCP; print('✓ MCP ready')"

6. Test with MCP Inspector

# Start MCP Inspector (interactive web UI)
uv run mcp dev server.py

Opens URL like:

http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=...

Features:

  • ✅ Available tools listed in sidebar

  • ✅ Test each tool interactively with JSON input

  • ✅ Real-time request/response viewing

  • ✅ Server logs and debugging

  • ✅ No extra dependencies needed

Usage

Option A: MCP Inspector (Development)

Best way to test and debug:

cd /path/to/w3-mcp-server-qdrant

# Start inspector
uv run mcp dev server.py

Opens web UI at http://localhost:5173:

  • See available tools

  • Test each tool with JSON input

  • View request/response in real-time

  • See server logs

Option B: Direct Python

# Run server (stdio mode)
uv run python server.py

Option C: Claude Code Integration

Method 1: Local Source (Development)

Edit ~/.claude/claude_config.json:

{
  "mcpServers": {
    "qdrant": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "server.py"],
      "cwd": "/path/to/w3-mcp-server-qdrant",
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_EMBED_MODEL": "bge-m3:latest",
        "OLLAMA_RERANK_MODEL": "mistral"
      }
    }
  }
}

Advantages:

  • ✅ Run latest development version

  • ✅ Easy to modify and test changes

  • ✅ Direct access to source code

Method 2: PyPI Installation (When Published)

Install from PyPI (always fetch latest version):

uv run --with w3-mcp-server-qdrant --refresh w3-mcp-server-qdrant

Edit ~/.claude/claude_config.json:

{
  "mcpServers": {
    "qdrant": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--with", "w3-mcp-server-qdrant", "--refresh", "w3-mcp-server-qdrant"],
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_EMBED_MODEL": "bge-m3:latest",
        "OLLAMA_RERANK_MODEL": "mistral"
      }
    }
  }
}

Advantages:

  • ✅ No need to clone repository

  • ✅ Easy version management

  • ✅ Automatic dependency isolation

Then restart Claude Code.

Tools Documentation

Search for similar documents in a collection using text query (auto-embedded via Ollama).

Supports advanced search techniques: query expansion, hypothetical document embeddings (HyDE), and LLM-based reranking.

Basic Parameters

Parameter

Type

Default

Description

collection_name

string

required

Name of the collection to search

query_text

string

required

Text to search for (auto-embedded via Ollama)

limit

integer

5

Max results to return (1-100)

score_threshold

float

0.0

Minimum similarity threshold (0.0-1.0)

fields

string

""

Comma-separated metadata fields to return (empty = all)

response_format

string

"markdown"

"markdown" or "json"

Advanced Parameters - Query Expansion

Generate N query variations, search all in parallel, merge results with Reciprocal Rank Fusion:

Parameter

Type

Default

Description

expand_query

boolean

false

Enable query expansion

expand_query_count

integer

3

Number of variations to generate (1-10)

Advanced Parameters - HyDE

Generate a hypothetical document matching the query intent, then embed it:

Parameter

Type

Default

Description

use_hyde

boolean

false

Enable HyDE

hyde_combine_original

boolean

true

Also search original query + HyDE doc

Advanced Parameters - Reranking

Use LLM to reorder results by relevance to the original query:

Parameter

Type

Default

Description

rerank

boolean

false

Enable LLM reranking

rerank_top_n

integer

10

Number of results to rerank (1-100)

Examples

Example 1: Basic search

{
  "collection_name": "docs",
  "query_text": "machine learning",
  "limit": 5
}

Example 2: Query expansion (good recall)

{
  "collection_name": "docs",
  "query_text": "machine learning",
  "expand_query": true,
  "expand_query_count": 5,
  "limit": 5
}

Example 3: HyDE (semantic understanding)

{
  "collection_name": "docs",
  "query_text": "machine learning",
  "use_hyde": true,
  "hyde_combine_original": true,
  "limit": 5
}

Example 4: Full combo (best quality, slower)

{
  "collection_name": "docs",
  "query_text": "machine learning",
  "expand_query": true,
  "expand_query_count": 3,
  "use_hyde": true,
  "rerank": true,
  "rerank_top_n": 15,
  "limit": 5
}

Output Format

Returns JSON with search metadata and ranked results:

{
  "query": "machine learning",
  "collection": "docs",
  "total": 3,
  "search_method": "rrf+hyde+expand+rerank",
  "results": [
    {
      "index": 1,
      "id": "doc_123",
      "score": 0.0273,
      "metadata": {
        "title": "Machine Learning Basics",
        "author": "Jane Doe"
      }
    }
  ]
}

Note: search_method field indicates which techniques were applied:

  • basic - simple vector search

  • rrf - multiple searches merged with Reciprocal Rank Fusion

  • rrf+hyde - RRF with HyDE

  • rrf+expand - RRF with query expansion

  • rrf+hyde+expand+rerank - all techniques combined


qdrant_list_collections

List all collections in Qdrant with metadata.

Parameters:

  • response_format (string): "markdown" or "json" (default: "markdown")

Example:

{
  "response_format": "json"
}

Output:

{
  "collections": [
    {
      "name": "tech_docs",
      "points_count": 1250,
      "vector_size": 768
    },
    {
      "name": "papers",
      "points_count": 3840,
      "vector_size": 1024
    }
  ]
}

Configuration

QDRANT_URL

Specifies the URL of your Qdrant server.

Set via:

  1. Environment variable:

    export QDRANT_URL=http://localhost:6333
    uv run python server.py
  2. .env file:

    QDRANT_URL=http://localhost:6333
  3. In claude_config.json:

    "env": {
      "QDRANT_URL": "http://localhost:6333"
    }

OLLAMA_BASE_URL

Specifies the URL of your Ollama server.

Default: http://localhost:11434

OLLAMA_EMBED_MODEL

Specifies which embedding model to use for embedding search queries and documents.

Default: bge-m3:latest

Recommended embedding models:

  • bge-m3 (384 dims) - ⭐ Recommended - best quality-to-speed ratio

  • nomic-embed-text (768 dims) - balanced, good for most use cases

  • all-minilm (384 dims) - fast, lightweight

  • mxbai-embed-large (1024 dims) - highest quality but slower

OLLAMA_RERANK_MODEL

Specifies which LLM model to use for advanced features (query expansion, HyDE, reranking).

Default: mistral

Recommended models:

  • mistral (7B) - ⭐ Recommended - good quality, reasonable speed

  • qwen2.5-coder (7B) - high quality but optimized for code

  • llama3.2 (3B) - smaller, faster but lower quality

  • neural-chat (7B) - good for instruction-following

Note: Only used when expand_query=true, use_hyde=true, or rerank=true

Project Structure

w3-mcp-server-qdrant/
├── server.py              # MCP server entry point
├── pyproject.toml         # Project config
├── .env.example           # Environment variables template
├── README.md              # This file
└── tests/
    └── test_mcp_server.py # Integration tests

How It Works

Architecture

MCP Client (Claude, IDE, etc.)
    ↓
MCP Server (server.py)
    ├── Ollama: text → embedding vector
    └── Qdrant: vector search

Search Flow

  1. User provides text query

  2. Ollama embeds query → embedding vector

  3. Qdrant searches for similar vectors

  4. Results returned with scores and metadata

Examples

Search documents

# Via Claude/MCP interface
qdrant_search(
    collection_name="tech_docs",
    query_text="machine learning algorithms",
    limit=5,
    score_threshold=0.6,
    response_format="markdown"
)

List collections

# Via Claude/MCP interface
qdrant_list_collections(response_format="json")

Development

Run tests using uv

uv run pytest tests/

Code formatting with uv

uv run black server.py
uv run ruff check server.py

Testing with MCP Inspector

uv run mcp dev server.py

Web UI at http://localhost:5173 shows:

  • Available tools and schemas

  • Real-time request/response

  • Server logs

  • Interactive testing

Performance Tips

Basic Search Optimization

  • Score threshold: Use score_threshold to filter low-relevance results and reduce noise

  • Result limit: Adjust limit parameter (1-100) to balance quality vs. speed

  • Embedding model: Choose based on quality vs. speed tradeoff:

    • nomic-embed-text: balanced (recommended)

    • all-minilm: fast, lightweight

    • mxbai-embed-large: higher quality but slower

Advanced Features Trade-offs

Feature

Quality

Speed

Use Case

Basic search

⭐⭐

⚡⚡⚡

Clear, specific queries

Query expansion

⭐⭐⭐

⚡⚡

Ambiguous queries, high recall needed

HyDE

⭐⭐⭐

⚡⚡

Semantic understanding important

Reranking

⭐⭐⭐⭐

Precision critical, can wait 1-2s

All combined

⭐⭐⭐⭐⭐

Best quality, time not critical

Performance Strategy

  • Fast path: Basic search with limit=5

  • Balanced: expand_query=true, expand_query_count=3

  • High quality: Add use_hyde=true

  • Maximum quality: Add rerank=true (slowest, ~5-10s)

Troubleshooting

Qdrant connection error

# Check if Qdrant is running
curl http://localhost:6333/health

# Start Qdrant with Docker
docker run -p 6333:6333 qdrant/qdrant:latest

Ollama embedding failed

# Check if Ollama is running
curl http://localhost:11434/api/tags

# Pull embedding model
ollama pull nomic-embed-text

# Start Ollama
ollama serve

Collection not found

  • Ensure collection exists in Qdrant

  • Create collection through Qdrant UI or external tools

  • Verify collection name matches exactly

MCP module not found

# Install dependencies with uv
uv sync

Server hangs on startup

  • Check if Qdrant server is running and accessible

  • Check if Ollama server is running

  • Try: curl http://localhost:6333/health and curl http://localhost:11434/api/tags

Implemented Features

  • Query expansion with LLM-generated variations

  • HyDE (Hypothetical Document Embeddings)

  • Reciprocal Rank Fusion (RRF) for result merging

  • LLM-based result reranking

  • Parallel async embedding and search

Future Enhancements

  • Support for additional embedding models

  • Batch vector operations

  • Collection creation/deletion tools

  • Vector update and delete operations

  • Semantic search filters

  • Caching for query expansions

  • Custom RRF weights configuration

References

License

MIT

Available Tools

2 tools
qdrant_list_collectionsA
Read-onlyIdempotent

List all collections in Qdrant.

Retrieves metadata about all collections including point counts and vector dimensions.

Args: params (ListCollectionsInput): Validated parameters: - response_format (str): 'markdown' or 'json'

Returns: str: Formatted list of collections with metadata

Errors: - Connection error: "Cannot connect to Qdrant at {url}"

ParametersJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already provide readOnlyHint, idempotentHint, and destructiveHint. The description adds that it returns a formatted list and includes error messages (connection errors). This adds useful behavioral context beyond annotations without contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (Args, Returns, Errors) but includes some redundancy (e.g., explaining the param that is already in schema). It is not overly long, but could be slightly more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity of the tool, the description adequately covers return values (formatted list with metadata) and error conditions. Annotations and output schema (present) cover safety and structure. The description is complete for a simple read-only list operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% for the top-level params, but the schema does describe the response_format field with enums. The description repeats this information and adds 'Validated parameters', which provides minor additional meaning. Baseline is 3 due to schema having some descriptions, and the description adds limited value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List all collections in Qdrant' and specifies the output includes 'point counts and vector dimensions'. It is a specific verb+resource combination, and the sibling tool qdrant_search is different (search vs list).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide guidance on when to use this tool versus the sibling qdrant_search. There is no mention of prerequisites, when not to use, or alternatives. Usage context is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv0.1.7
    • First observedqdrant_list_collections
    • First observedqdrant_search

TDQS

A3.9/5.0

Scored across 2 tools

Disambiguation5/5

The two tools have clearly distinct purposes: listing collections vs. searching within a collection. No overlap or ambiguity.

Naming Consistency5/5

Both tools follow a consistent 'qdrant_verb_noun' pattern (list_collections, search), making it predictable.

Tool Count3/5

Only two tools for a vector database feels thin; typical usage would benefit from additional CRUD operations. However, for a focused query-only server, it might be borderline acceptable.

Completeness2/5

Significant gaps: no tools to create/delete collections, insert/update/delete points. Agent cannot populate or manage data, only list and search existing content.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    An MCP server implementation that provides tools for retrieving and processing documentation through vector search, enabling AI assistants to augment their responses with relevant documentation context. Uses Ollama or OpenAI to generate embeddings. Docker files included
    9
    30
    MIT
  • A
    license
    D
    quality
    C
    maintenance
    A lightweight RAG system that provides an MCP server for searching and interacting with vector-based knowledge bases. It enables users to perform retrieval-augmented generation and search across Qdrant collections through a standardized interface.
    1
    2
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for Qdrant vector database with local BERT embeddings. Enables semantic search and vector storage operations through natural language.
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    An MCP server for querying and managing LlamaIndex documents stored in Qdrant vector databases, with automatic embedding model detection and extensive tools for search, retrieval, and collection management.
    17
    Apache 2.0

Latest Blog Posts

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/famtong8-dev/w3-mcp-server-qdrant'

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