Solr MCP Server Basic Search Service
Search Solr servers with the MCP server basic search service to quickly retrieve relevant results.
npx -y @mjochum64/mcp-solr-searchOverview
The Solr MCP Server Basic Search Service is a lightweight adapter that exposes an Apache Solr index as an MCP (Model Context Protocol) tool. It makes it easy for model-driven agents or other MCP-aware clients to perform relevance searches against a Solr collection and retrieve structured results suitable for context augmentation, QA, or retrieval-augmented generation.
This service translates MCP tool calls into Solr queries, applies basic filtering and pagination, and returns a compact, consistent JSON result set. That lets LLMs and other orchestrators request the “most relevant” documents without needing to know Solr query syntax or connectivity details.
Features
- MCP-compatible search tool exposing Solr as a retrieval backend
- Query string search with configurable top_k (number of results)
- Optional field selection and simple filter support
- Score and snippet (highlight) return where supported by Solr
- Simple environment-driven configuration (Solr URL, core/collection, defaults)
- Lightweight HTTP API suitable for local deployment, containers, or integration into orchestration systems
Installation / Configuration
Clone the repository and run the service. The project supports environment configuration for Solr connectivity and service behavior.
Clone and run (example using npm; adapt if project uses another runtime):
# install dependencies (if Node.js)
# start the server (example)
Environment variables (example .env):
# Solr connection
SOLR_URL=http://localhost:8983
SOLR_CORE=my_core_or_collection
# Service options
PORT=8080
DEFAULT_TOP_K=5
DEFAULT_FIELDS=id,title,content
REQUEST_TIMEOUT_MS=5000
Docker run example (sets environment variables at runtime):
Configuration table (common environment variables)
| Variable | Purpose | Example |
|---|---|---|
| SOLR_URL | Base URL of your Solr server | http://localhost:8983 |
| SOLR_CORE | Core or collection name to query | my_core |
| PORT | HTTP port for MCP server | 8080 |
| DEFAULT_TOP_K | Default number of results when not provided | 5 |
| DEFAULT_FIELDS | Comma-separated fields to return by default | id,title,summary |
| REQUEST_TIMEOUT_MS | Solr request timeout in milliseconds | 5000 |
Note: Adjust the service start command to match the repository’s runtime (node, python, etc.). See the repo README for exact start commands if different.
Available Resources
- GitHub repository: https://github.com/mjochum64/mcp-solr-search
- Apache Solr docs (querying, highlighting): https://lucene.apache.org/solr/
- MCP (Model Context Protocol) overview/spec (for tool invocation patterns): consult your MCP client docs or server spec
Usage / Example Requests
The server exposes an MCP-style tool for basic searching. Example payloads below show typical calls — adapt the exact endpoint if your instance exposes a different path (e.g., /call, /tools/basic_search, or an MCP endpoint).
Example: simple search (curl)
Example: search with field selection and filters
Example response (typical structure)
Fields returned include document id, relevancy score, requested fields, optional highlight snippets (if Solr highlighting is enabled), and meta information about the query.
Use Cases
- Retrieval Augmented Generation (RAG): Use the MCP tool to fetch top-k relevant documents to include as context for an LLM prompt, improving factual grounding.