Home / MCP / Solr MCP Server

Solr MCP Server

Provides hybrid search over Solr data by merging keyword filters with vector similarity through an MCP endpoint.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "solr_mcp": {
            "command": "poetry",
            "args": [
                "run",
                "python",
                "-m",
                "solr_mcp.server"
            ],
            "env": {
                "SOLR_HOST": "http://localhost:8983"
            }
        }
    }
}

You deploy the Solr MCP server to enable AI assistants to query your Solr indexes with a powerful mix of keyword and vector search. It runs a local or remote MCP endpoint that integrates Solr data into multi-modal search workflows, optimizing performance for large result sets and paginated queries.

How to use

You use an MCP client to connect to the Solr MCP server and perform hybrid searches across your Solr collections. The server exposes an MCP-compatible endpoint, allowing you to issue search requests that combine keyword filtering with vector similarity, while letting the underlying engine push down SQL-like filters to the vector stage for faster results. Use the client to construct queries that target your unified collections, request relevant document snippets, and fetch embeddings as needed for downstream tasks.

Typical usage patterns include: performing a keyword-driven retrieval with a vector similarity constraint to find documents most relevant to a query, applying WHERE-style filters to narrow results before vector scoring, and paginating results efficiently by leveraging the server’s SQL-like filtering before embedding calculations. You can also manage and index documents so that each record contains both content and its vector representation within a single collection.

How to install

Follow these concrete steps to set up the Solr MCP server locally and index sample data.

# 1) Prerequisites
# Ensure you have Python 3.10+, Docker, and Docker Compose installed

# 2) Set up a Python virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# 3) Install the build/development tool
pip install poetry

# 4) Install dependencies for the project
poetry install

# 5) Start SolrCloud with Docker Compose
docker-compose up -d

# 6) Process and index a sample document (example shown)
python scripts/process_markdown.py data/bitcoin-whitepaper.md --output data/processed/bitcoin_sections.json
python scripts/create_unified_collection.py unified
python scripts/unified_index.py data/processed/bitcoin_sections.json --collection unified

# 7) Run the MCP server
poetry run python -m solr_mcp.server

Configuration and notes

The integration provides a dedicated MCP server that talks to Solr indexes and combines keyword and vector search. You can start the server locally and connect with an MCP client to execute hybrid queries against a unified collection that stores both document content and vector embeddings. The setup emphasizes Docker-based SolrCloud with a Python-based MCP server that coordinates embedding generation and search orchestration.

Troubleshooting and tips

- Ensure Docker and Docker Compose are running before starting SolrCloud. - If you encounter issues starting the MCP server, confirm the Python environment is activated and Poetry dependencies are installed. - Verify the unified collection contains both content and embeddings to enable hybrid search. - For large datasets, validate that WHERE filters are effectively pushed down to the vector search stage to maintain performance.

Notes on requirements and licensing

You need Python 3.10 or higher, Docker with Docker Compose, SolrCloud 9.x, and Ollama for embedding generation. This project is licensed under the MIT License.

Available tools

hybrid_search

Performs searches that combine keyword-based filtering with vector similarity to retrieve highly relevant documents.

vector_embeddings

Generates and stores vector embeddings for documents to enable semantic search.

unified_collections

Stores both document content and vector embeddings in a single collection for simplified queries.

docker_integration

Provides easy setup and orchestration with Docker and Docker Compose for SolrCloud and MCP server.

vector_search_optimization

Pushes SQL-like filters down to the vector search stage to improve performance for paginated and large result sets.