Skip to main content

A Python package for accessing Solr indexes via Model Context Protocol (MCP)

Project description

Solr MCP

A Python package for accessing Apache Solr indexes via Model Context Protocol (MCP). This integration allows AI assistants like Claude to perform powerful search queries against your Solr indexes, combining both keyword and vector search capabilities.

Features

  • MCP Server: Implements the Model Context Protocol for integration with AI assistants
  • Hybrid Search: Combines keyword search precision with vector search semantic understanding
  • Vector Embeddings: Generates embeddings for documents using Ollama with nomic-embed-text
  • Unified Collections: Store both document content and vector embeddings in the same collection
  • Docker Integration: Easy setup with Docker and docker-compose
  • Optimized Vector Search: Efficiently handles combined vector and SQL queries by pushing down SQL filters to the vector search stage, ensuring optimal performance even with large result sets and pagination

Architecture

Vector Search Optimization

The system employs an important optimization for combined vector and SQL queries. When executing a query that includes both vector similarity search and SQL filters:

  1. SQL filters (WHERE clauses) are pushed down to the vector search stage
  2. This ensures that vector similarity calculations are only performed on documents that will match the final SQL criteria
  3. Significantly improves performance for queries with:
    • Selective WHERE clauses
    • Pagination (LIMIT/OFFSET)
    • Large result sets

This optimization reduces computational overhead and network transfer by minimizing the number of vector similarity calculations needed.

Quick Start

  1. Clone this repository
  2. Start SolrCloud with Docker:
    docker-compose up -d
    
  3. Install dependencies:
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install poetry
    poetry install
    
  4. Process and index the sample document:
    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
    
  5. Run the MCP server:
    poetry run python -m solr_mcp.server
    

For more detailed setup and usage instructions, see the QUICKSTART.md guide.

Requirements

  • Python 3.10 or higher
  • Docker and Docker Compose
  • SolrCloud 9.x
  • Ollama (for embedding generation)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

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

mseep_solr_mcp-0.1.0.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

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

mseep_solr_mcp-0.1.0-py3-none-any.whl (51.3 kB view details)

Uploaded Python 3

File details

Details for the file mseep_solr_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: mseep_solr_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mseep_solr_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72f7e68af89056c04a8df8b7924aecd83f50f35e15ddf1c4c5dc868674f7b3ca
MD5 e262ae5762e5927cfcad5145ac8ec1c1
BLAKE2b-256 97ee4b6f4522ec9406241ddb321b76d9511193360f1091f0e1b3cba6b4ce3e8d

See more details on using hashes here.

File details

Details for the file mseep_solr_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mseep_solr_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for mseep_solr_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eab345b6ae40685d60635cddcf97f44d7b7bd6ddc036f848ca618ffd6a98a09c
MD5 aa9cf1be80dccde78596d8f5f1c87eb5
BLAKE2b-256 9f444a308892ee811678623ac51b90422df704621e01276bcd057cf3d55b94ca

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