
MCP-Server for Apache Solr
概览
This project implements a Model Context Protocol (MCP) server that provides document search capabilities through Apache Solr. It allows Large Language Models to search and retrieve documents from Solr collections using the MCP standard. - MCP Resources for searching Solr documents - MCP Tools for advanced search and document retrieval - support for data exploration and aggregation - support to show where search terms appear in results - Asynchronous communication with Solr using httpx - Type-safe interfaces with Pydantic models - Authentication support (JWT) - Comprehensive test suite - Docker-based Solr development environment - edismax Multi-Field Search & OAuth Auto-Refresh. Includes automatic OAuth token management and improved search results. Fully compliant with MCP Spec 2025-06-18. See CHANGELOG.md for details on all changes. The Model Context Protocol (MCP) is a standardized way for applications to provide context to Large Language Models (LLMs).
README
以下为原文 README 节选,完整内容请查看原文。
MCP-Server for Apache Solr Document Search
This project implements a Model Context Protocol (MCP) server that provides document search capabilities through Apache Solr. It allows Large Language Models to search and retrieve documents from Solr collections using the MCP standard.
Features
- MCP Resources for searching Solr documents
- MCP Tools for advanced search and document retrieval
- Faceted Search support for data exploration and aggregation
- Highlighting support to show where search terms appear in results
- Asynchronous communication with Solr using httpx
- Type-safe interfaces with Pydantic models
- Authentication support (JWT)
- Comprehensive test suite
- Docker-based Solr development environment
Current Version
Version 1.5.0 - edismax Multi-Field Search & OAuth Auto-Refresh. Includes automatic OAuth token management and improved search results. Fully compliant with MCP Spec 2025-06-18. See CHANGELOG.md for details on all changes.
What is MCP?
The Model Context Protocol (MCP) is a standardized way for applications to provide context to Large Language Models (LLMs). This project implements an MCP server that exposes Apache Solr’s search capabilities to LLMs, allowing them to:
- Search for documents using simple or complex queries
- Retrieve specific documents by ID
- Filter, sort, and paginate search results
Requirements
- Python 3.11+
- Docker and Docker Compose (for the integrated Solr environment)
uvpackage manager (recommended)- MCP 1.21.0+ (fully compatible with 2025-06-18 specification)
Installation
-
Install
uv(if not already installed):pip install uv -
Install the project dependencies:
uv installOr with pip:
pip install -e . -
Copy the environment template and configure it:
cp .env.example .env # Edit .env with your Solr connection details -
Create and activate a virtual environment (important):
python -m venv .venv source .venv/bin/activate # On Linux/macOS # OR .\.venv\Scripts\activate # On WindowsNote: Always ensure the virtual environment is activated before running the server or client tools. Many connection issues are caused by running commands outside the virtual environment.
MCP 1.21.0 Modern Features
This project uses the latest MCP 1.21.0 SDK with full support for the 2025-06-18 specification:
✅ Lifespan Context Manager: Type-safe dependency injection with AppContext dataclass
✅ Streamable HTTP Transport: Native HTTP support without external workarounds
✅ Tool Annotations: Enhanced metadata (readOnlyHint, title, description)
✅ Context-Based Logging: Direct client communication via ctx.info/debug/warning/error
✅ Modern Decorators: @app.tool() and @app.resource() patterns
Migration from MCP 1.6.0
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →