Solr MCP

Solr MCP

This MCP server offers a basic functionality to perform a search on Solr servers.

8
Stars
3
Forks
6
Releases

Overview

This MCP server exposes Apache Solr search capabilities to Large Language Models through the Model Context Protocol. It implements MCP resources for basic and advanced search, including a resource solr://search/{query} for quick lookups and two tools: search (supporting filtering, sorting, pagination, faceting and highlighting) and get_document (retrieve documents by ID with selectable fields). Communication with Solr is asynchronous via httpx, and the server uses Pydantic models to provide type-safe interfaces. Security is provided by optional JWT authentication, with full OAuth 2.1 support using Keycloak for production deployments. The server is designed around MCP 1.21.0, with Streamable HTTP transport for modern clients and a legacy HTTP server retained for backwards compatibility. A Docker-based Solr development environment ships with a Solr 9.4 container, a sample 'documents' collection, and data loaders, enabling immediate testing. The project includes an extensive test suite and run scripts for both MCP and HTTP modes. Configuration is controlled via environment variables (e.g., SOLR_BASE_URL, SOLR_COLLECTION, and ENABLE_OAUTH).

Details

Owner
mjochum64
Language
Python
License
Updated
2025-12-07

Features

MCP Resources for searching Solr documents

Provides MCP resources for basic and exploration-style searches against Solr documents.

MCP Tools for advanced search and document retrieval

Offers the 'search' and 'get_document' tools to perform filtering, sorting, pagination, and fetch documents by ID.

Faceted Search support for data exploration and aggregation

Supports facet_fields to aggregate and explore data.

Highlighting support to show where search terms appear in results

Includes highlighting results with matched terms emphasized.

Asynchronous communication with Solr using httpx

Solr requests are performed asynchronously using httpx for efficient IO.

Type-safe interfaces with Pydantic models

Uses Pydantic models to enforce type safety across requests and responses.

Authentication support (JWT)

JWT-based authentication support for securing MCP tool calls.

Docker-based Solr development environment

Includes a Docker Compose setup with Solr and sample data for development and testing.

Audience

LLM developersExpose Solr document search to LLMs via MCP, enabling query, filter, sort, and pagination.
AI application developersIntegrate Solr-backed retrieval into tools for document search, filtering, and highlighting within apps.
MCP integrators / DevOpsSet up MCP 1.21.0 environment with Streamable HTTP transport and optional OAuth 2.1 (Keycloak) for production deployments.

Tags

SolrMCPdocument searchfaceted searchhighlightingJWTOAuth 2.1KeycloakdockerasynchttpxPydanticLLM integration