Skip to main content

Hybrid Search MCP Server

An MCP (Model Context Protocol) server that provides read-only access to the Hybrid Search knowledge base. Enables AI assistants in Windsurf, VS Code, Open Code, and Claude Desktop to query collections and search documents using hybrid search (semantic + keyword with RRF ranking).

⚠️ IMPORTANT PREREQUISITE

This MCP server requires the Hybrid Search container stack to be running in order to work. The MCP server does not directly access the database - it communicates with the Hybrid Search backend API.

When you install the Hybrid Search container stack, it automatically ensures that the backend API is available at http://localhost:8000.

Features

  • List Collections: View all available knowledge base collections
  • Get Collection Details: See document counts, chunk counts, and metadata
  • List Files: View all files in a collection with chunk counts
  • Hybrid Search: Search using semantic AI + keyword matching with Reciprocal Rank Fusion

Prerequisites

  • Python 3.11+
  • uv package manager (recommended)
  • Hybrid Search backend running at http://localhost:8000

Installation

Once published to PyPI, you can install with:

# Using pip
pip install hybrid-search-mcp

# Using uvx (run without installing)
uvx hybrid-search-mcp

# Using pipx (isolated environment)
pipx install hybrid-search-mcp

From Source

cd mcp-server
uv sync

Using pip

cd mcp-server
pip install -e .

Configuration

The MCP server connects to the Hybrid Search FastAPI backend. Configure via environment variables:

Variable Default Description
HYBRID_SEARCH_API_URL http://localhost:8000 Backend API base URL
HYBRID_SEARCH_API_TIMEOUT 30.0 Request timeout in seconds

Running the Server

If Installed via pip/uvx

# Direct command (if installed globally)
hybrid-search-mcp

# Using uvx (no installation needed)
uvx hybrid-search-mcp

# Using pipx
pipx run hybrid-search-mcp

From Source

cd mcp-server
uv run python -m hybrid_search_mcp
# or
uv run hybrid-search-mcp

Client Configuration

Windsurf

Add to your Windsurf MCP configuration (~/.windsurf/mcp_config.json or similar):

{
  "mcpServers": {
    "hybrid-search": {
      "command": "uv",
      "args": [
        "run",
        "--project", "/path/to/mcp-server",
        "python", "-m", "hybrid_search_mcp"
      ],
      "env": {
        "HYBRID_SEARCH_API_URL": "http://localhost:8000"
      }
    }
  }
}

VS Code (with Continue or similar MCP extensions)

Add to your VS Code MCP configuration:

{
  "mcpServers": {
    "hybrid-search": {
      "command": "uv",
      "args": [
        "run",
        "--project", "/path/to/mcp-server",
        "python", "-m", "hybrid_search_mcp"
      ],
      "env": {
        "HYBRID_SEARCH_API_URL": "http://localhost:8000"
      }
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "hybrid-search": {
      "command": "uv",
      "args": [
        "run",
        "--project", "/path/to/mcp-server",
        "python", "-m", "hybrid_search_mcp"
      ],
      "env": {
        "HYBRID_SEARCH_API_URL": "http://localhost:8000"
      }
    }
  }
}

Open Code

Add to your Open Code MCP configuration:

{
  "mcpServers": {
    "hybrid-search": {
      "command": "uv",
      "args": [
        "run",
        "--project", "/path/to/mcp-server",
        "python", "-m", "hybrid_search_mcp"
      ],
      "env": {
        "HYBRID_SEARCH_API_URL": "http://localhost:8000"
      }
    }
  }
}

Available Tools

list_collections

List all available collections in the knowledge base.

Returns: Collection names, document counts, chunk counts, and metadata.

get_collection

Get detailed information about a specific collection.

Parameters:

  • collection_name (string): Name of the collection

Returns: Document count, chunk count, embedding dimension, timestamps.

get_collection_files

List all files in a collection with their chunk counts.

Parameters:

  • collection_name (string): Name of the collection

Returns: List of files with filenames and chunk counts.

search_collection

Search a collection using hybrid search (semantic + keyword with RRF ranking).

Parameters:

  • collection_name (string): Name of the collection to search
  • query (string): Search query (natural language or keywords)
  • limit (integer, optional): Maximum results (1-100, default 10)

Returns: Ranked search results with chunk text, similarity scores, source files, and metadata.

Available Resources

collections://list

Static resource listing all available collections.

collection://{name}

Dynamic resource with detailed information about a specific collection.

Example Usage

Once configured, you can ask your AI assistant:

  • "What collections are available in the Hybrid Search knowledge base?"
  • "Search the 'network-docs' collection for information about BGP routing"
  • "How many documents are in the 'technical-specs' collection?"
  • "List all files in the 'meeting-notes' collection"

Architecture

┌─────────────────┐     STDIO      ┌─────────────────┐     HTTP      ┌─────────────────┐
│   AI Assistant  │ ◄────────────► │   MCP Server    │ ◄───────────► │  FastAPI Backend│
│  (Windsurf/VS   │                │  (FastMCP)      │               │  (Hybrid Search)│
│   Code/etc.)    │                │                 │               │                 │
└─────────────────┘                └─────────────────┘               └─────────────────┘
                                                                              │
                                                                              ▼
                                                                     ┌─────────────────┐
                                                                     │   PostgreSQL    │
                                                                     │   + pgvector    │
                                                                     └─────────────────┘

Troubleshooting

"Cannot connect to Hybrid Search backend"

Ensure the FastAPI backend is running:

cd backend
uvicorn application:app --reload --host 0.0.0.0 --port 8000

"Collection not found"

Use list_collections to see available collections, then use the exact collection name.

MCP server not appearing in client

  1. Check the path in your MCP configuration is correct
  2. Ensure uv is installed and in your PATH
  3. Check client logs for connection errors

Development

Running Tests

cd mcp-server
uv run pytest

Project Structure

mcp-server/
├── pyproject.toml              # Project configuration
├── README.md                   # This file
└── src/
    └── hybrid_search_mcp/
        ├── __init__.py         # Package exports
        ├── __main__.py         # Module entry point
        ├── server.py           # FastMCP server with tools/resources
        ├── api_client.py       # HTTP client for backend
        └── config.py           # Configuration management

Publishing to PyPI

Prerequisites

  1. Install build tools:
pip install build twine
  1. Create accounts on:

Build the Package

cd mcp-server
uv build
# or
python -m build

This creates:

  • dist/hybrid_search_mcp-0.1.0.tar.gz (source distribution)
  • dist/hybrid_search_mcp-0.1.0-py3-none-any.whl (wheel)
# Upload to TestPyPI
twine upload --repository testpypi dist/*

# Test installation
pip install --index-url https://test.pypi.org/simple/ hybrid-search-mcp

Publish to PyPI

# Upload to PyPI
twine upload dist/*

# Verify installation
pip install hybrid-search-mcp
  1. Generate API token on PyPI/TestPyPI
  2. Create ~/.pypirc:
[distutils]
index-servers =
    pypi
    testpypi

[pypi]
username = __token__
password = pypi-YOUR-API-TOKEN

[testpypi]
username = __token__
password = pypi-YOUR-TESTPYPI-TOKEN

Version Bumping

Update version in pyproject.toml, then:

# Clean old builds
rm -rf dist/

# Build new version
uv build

# Upload
twine upload dist/*

License

MIT License - see LICENSE file for details.

Metadata

Release files for hybrid-search-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hybrid-search-mcp 0.1.0
File Size Uploaded Provenance Actions
hybrid_search_mcp-0.1.0.tar.gz 75.8 kB Without provenance Details for hybrid_search_mcp-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hybrid-search-mcp 0.1.0
File Interpreter ABI Platform Actions
hybrid_search_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for hybrid_search_mcp-0.1.0-py3-none-any.whl

Total release size: 86.4 kB

Release files / hybrid_search_mcp-0.1.0.tar.gz

Download URL hybrid_search_mcp-0.1.0.tar.gz
Size 75.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d79d11275f89d824ff9051fd0ce5343a44a75b06fe96496527dd860dc99b427c
BLAKE2b-256 checksum
How to use checksums
70a11b913c9712e059075ed5d0269808b3110f15d826e799118a61162c8c316b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / hybrid_search_mcp-0.1.0-py3-none-any.whl

Download URL hybrid_search_mcp-0.1.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac0121a27a85c57dcc434c8ff823e70a555660df473c9f33ded5077a001bdf5d
BLAKE2b-256 checksum
How to use checksums
4ce9b7faf3383b6f5fd4a2f67d00ffeb5a7ad94eaee825ad5904c2f0e98933c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for hybrid-search-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page