Skip to main content

MCP server for vector search with Qdrant and Ollama embeddings

Project description

Qdrant MCP Server

Model Context Protocol server for vector search using Qdrant and Ollama embeddings.

Features

  • Vector Search: Search for similar documents using text queries (auto-embedded via Ollama)
  • Collection Management: List and manage Qdrant collections
  • Flexible Output: Markdown or JSON response formats
  • Read-Only: Safe for querying without modifying data

Prerequisites

Qdrant Server

docker run -p 6333:6333 qdrant/qdrant:latest

Or install locally: Qdrant Quick Start

Ollama Server

# Install: https://ollama.ai
ollama pull nomic-embed-text
ollama serve

Other embedding models available:

  • nomic-embed-text (768 dims) - recommended, lightweight
  • mxbai-embed-large (1024 dims) - higher quality
  • all-minilm (384 dims) - ultra-lightweight

Installation

# Clone/navigate to project directory
cd w3-mcp-server-qdrant

# Install dependencies
pip install -e .

# Or with uv:
uv sync

Configuration

Create a .env file or export environment variables:

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

# Ollama
export OLLAMA_BASE_URL=http://localhost:11434
export OLLAMA_MODEL=nomic-embed-text

Usage

Run with stdio transport

python server.py

Test with MCP Inspector

uv run mcp dev server.py

Then open http://localhost:5173 in your browser.

Configure in Claude Desktop

Edit ~/.claude/mcp_servers.json and add one of the configurations below:

Option 1: Direct Command (Recommended)

After installing with pip install -e . or pip install w3-mcp-server-qdrant:

{
  "mcpServers": {
    "qdrant": {
      "command": "w3-mcp-server-qdrant",
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_MODEL": "nomic-embed-text"
      }
    }
  }
}

Option 2: Using UVX (Recommended after publishing to PyPI)

Once the package is published to PyPI:

{
  "mcpServers": {
    "qdrant": {
      "command": "uvx",
      "args": ["w3-mcp-server-qdrant"],
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_MODEL": "nomic-embed-text"
      }
    }
  }
}

Option 3: Python Module (Legacy)

{
  "mcpServers": {
    "qdrant": {
      "command": "python",
      "args": ["-m", "server"],
      "env": {
        "QDRANT_URL": "http://localhost:6333",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_MODEL": "nomic-embed-text"
      }
    }
  }
}

After updating, restart Claude Desktop for the changes to take effect.

Tools

qdrant_search

Search for similar documents in a collection.

Parameters:

  • collection_name (string): Name of the collection to search
  • query_text (string): Text to search for (will be embedded)
  • limit (integer, 1-100): Max results (default: 5)
  • score_threshold (float, 0.0-1.0): Min similarity threshold (default: 0.0)
  • response_format (string): "markdown" or "json" (default: markdown)

Example:

Search documents about "machine learning" in the "papers" collection
with a similarity threshold of 0.7, return top 10 results as JSON

qdrant_list_collections

List all collections in Qdrant with metadata.

Parameters:

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

Examples

Search documents

# Via Claude/MCP interface
qdrant_search(
    collection_name="tech_docs",
    query_text="How do vector databases work?",
    limit=5,
    score_threshold=0.6,
    response_format="markdown"
)

List collections

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

Architecture

Claude/LLM
    ↓
MCP Server (server.py)
    ├── Ollama: text → embedding
    └── Qdrant: search/store vectors

Data Flow

Search:

  1. User provides text query
  2. Ollama embeds the query → vector
  3. Qdrant searches for similar vectors
  4. Results returned with scores and metadata

Error Handling

  • Collection not found: Ensure collection exists in Qdrant
  • Connection error: Verify Qdrant/Ollama servers are running
  • Embedding failed: Check Ollama model is loaded (ollama pull nomic-embed-text)

Development

Run tests

pytest tests/

Code formatting

black server.py
ruff check server.py

Performance Tips

  • Score threshold: Use score_threshold to filter low-relevance results and reduce noise
  • Result limit: Adjust limit parameter to control number of results (1-100)
  • 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

Troubleshooting

Issue: "Cannot connect to Qdrant"

  • Check: curl http://localhost:6333/health
  • Start Qdrant: docker run -p 6333:6333 qdrant/qdrant:latest

Issue: "Failed to embed text"

  • Check: curl http://localhost:11434/api/tags
  • Pull model: ollama pull nomic-embed-text
  • Start Ollama: ollama serve

Issue: "Collection not found"

  • Create collection: Use Qdrant console or add data through external tools

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

w3_mcp_server_qdrant-0.1.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

w3_mcp_server_qdrant-0.1.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file w3_mcp_server_qdrant-0.1.2.tar.gz.

File metadata

  • Download URL: w3_mcp_server_qdrant-0.1.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.5

File hashes

Hashes for w3_mcp_server_qdrant-0.1.2.tar.gz
Algorithm Hash digest
SHA256 2911613094469d9c41b51c2a2c1cdad90bb86509477b98eda7714e222a035cd4
MD5 29c9d653128b0d21afa2779c8dd41d67
BLAKE2b-256 5d85ef2b02cdb076ef0c7c38e88e90c9a94aa14087dabb1a6ab44ef86aed1e83

See more details on using hashes here.

File details

Details for the file w3_mcp_server_qdrant-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for w3_mcp_server_qdrant-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5084c555b319c2b42af46695ccadb8daec5122cf711ee836c29ed416a715bd73
MD5 d1bda712afde0e8389ec90211b8b7f97
BLAKE2b-256 665a4eee67b02ae92959444d8b31d3175eeabff1c878a9fb57545bc9915a69cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page