Solr MCP
Provides tools for accessing Apache Solr indexes, enabling full-text and hybrid keyword/vector search, SQL filtering, faceting, sorting, collection discovery, and schema inspection.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Solr MCP search the unified collection for documents about proof of work"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: mssql-mcp
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:
SQL filters (WHERE clauses) are pushed down to the vector search stage
This ensures that vector similarity calculations are only performed on documents that will match the final SQL criteria
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
Clone this repository
Start SolrCloud with Docker:
docker-compose up -dInstall dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install uv uv syncProcess 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 unifiedRun the MCP server (stdio transport, for local MCP clients):
uv run run-server
For more detailed setup and usage instructions, see the QUICKSTART.md guide.
MCP client configuration
The server speaks MCP over stdio by default. Install and run it from Git with uv:
Install from GitHub (recommended)
{
"mcpServers": {
"solr-mcp-server": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/kevinbtalbert/solr-mcp-python-stdio@main",
"run-server"
],
"env": {
"SOLR_BASE_URL": "https://solr-app.yoururlhere.ylcu-atmi.cloudera.site/solr",
"MCP_TRANSPORT": "stdio"
}
}
}
}Use this block in Cursor MCP settings, Claude Desktop, or Agent Studio MCP configuration.
Set SOLR_BASE_URL to your Solr Admin base URL (including the /solr path). The server uses plain HTTP/HTTPS with no login or API keys—suitable for open Solr endpoints. ZooKeeper is not required: when ZOOKEEPER_HOSTS is unset, collections are discovered through Solr’s HTTP API. For local SolrCloud with ZK directly reachable, optionally set ZOOKEEPER_HOSTS to a comma-separated list (e.g. localhost:2181).
MCP tools (Agent Studio / Claude)
Tool | Use for |
| Discover collection names |
| Field names and types before querying |
| Primary — Lucene |
| Solr SQL when you need it explicitly |
| SQL + vector similarity (requires embeddings setup) |
| Embedding model dimensions for semantic search |
After changing this repo, refresh the MCP server (restart the host or bump the git ref) so clients pick up new tool names. No mcp or ZooKeeper parameters are required in tool calls.
Local checkout
{
"mcpServers": {
"solr-mcp-server": {
"command": "uvx",
"args": [
"--from",
"file:///absolute/path/to/solr-mcp-python-stdio",
"run-server"
],
"env": {
"SOLR_BASE_URL": "https://your-solr-host.example.com/solr"
}
}
}
}Transport
Set MCP_TRANSPORT to choose how the server connects to the client:
Value | Use case |
| Cursor, Claude Desktop, and other subprocess-based MCP hosts |
| HTTP/SSE deployment (e.g. |
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.
Available Tools
7 toolsget-default-text-vectorizerA
Get the default embedding model used for semantic-select.
Returns model name, vector dimensionality, and service URL. Use this to ensure Solr vector fields match the embedding model dimensions.
Inputs: no named parameters. Returns: result
get-schemaA
Retrieve schema information for a Solr collection.
Returns field definitions, field types, and copy-field relationships from the Schema API. Call this before search when you need valid field names or types.
Parameters:
collection: Solr collection name
Inputs: collection (required). Returns: result
list-collectionsA
List all available Solr collections in the cluster.
Inputs: no named parameters. Returns: result
searchA
Full-text search with filtering, faceting, sorting, and pagination.
Queries Solr's /select handler using Lucene syntax. This is the preferred
tool for natural-language questions about document content.
Parameters:
collection: Solr collection name
query: Main query
q(Lucene syntax). Defaults to*:*when omitted.filter_queries: Optional filter queries (
fq), applied without affecting scorefacet_fields: Field names to facet on (enables
facet=true)sort: Solr sort clause, e.g.
score descoryear_i descstart: Pagination offset (default 0)
rows: Number of documents to return (default 10)
fields: Restrict returned stored fields (
fl). Omit to return the default set.
Examples:
collection=films,query=title:star AND genre_s:sci-ficollection=films,query=*:*,filter_queries=['year_i:[2000 TO *]']
Inputs: collection (required), rows, sort, query, +4 more. Returns: result
semantic-selectA
Semantic (vector) search combined with SQL filtering (advanced).
Extends sql-select with semantic search: natural language text is embedded
and matched against a dense_vector/knn_vector field. Results rank by similarity;
ORDER BY is not allowed in query.
Parameters:
query: SQL query to execute
text: Natural language text converted to a vector for similarity search
field: Vector field name (optional; auto-detected when omitted)
vector_provider: Optional
model@host:port(e.g. nomic-embed-text@localhost:11434)
Inputs: text (required), query (required), field, vector_provider. Returns: result
sql-selectA
Execute SQL SELECT queries against Solr (advanced).
Prefer the search tool for Lucene/full-text queries. Use this when you
need Solr's SQL interface explicitly.
Collection/Field Rules:
Collections are used as table names (case-insensitive)
Field names are case-sensitive and must exist in Solr schema
SELECT * only allowed with LIMIT clause
Unlimited queries restricted to docValues-enabled fields
Reserved words must be backtick-escaped
WHERE Clause Differences:
Field must be on one side of predicate
No comparing two constants or two fields
No subqueries
Solr syntax in values:
'[0 TO 100]' for ranges
'(term1 term2)' for non-phrase OR search
String literals use single-quotes
Supported Features:
Operators: =, <>, >, >=, <, <=, IN, LIKE (wildcards), BETWEEN, IS [NOT] NULL
Functions: COUNT(*), COUNT(DISTINCT), MIN, MAX, SUM, AVG
GROUP BY: Uses faceting (fast) for low cardinality, map_reduce (slow) for high cardinality
ORDER BY: Requires docValues-enabled fields
LIMIT/OFFSET: Use 'OFFSET x FETCH NEXT y ROWS ONLY' syntax
Performance of OFFSET degrades beyond 10k docs per shard
Parameters:
query: SQL query to execute
Inputs: query (required). Returns: result
vector-selectA
Vector similarity search combined with SQL filtering (advanced).
Extends sql-select with a query vector matched against a dense_vector/knn_vector
field. ORDER BY is not allowed in query.
Parameters:
query: SQL query to execute
vector: Query vector (dimensions must match the vector field)
field: Vector field name (optional; auto-detected when omitted)
Inputs: query (required), vector (required), field. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The four query tools (search, sql-select, semantic-select, vector-select) overlap in purpose, but descriptions explicitly steer agents—search for Lucene/full-text, sql-select for the SQL interface, and the two vector variants differ clearly by taking either natural-language text or a precomputed vector. Boundaries are mostly clear with only minor potential confusion between semantic-select and vector-select.
All names use consistent kebab-case (get-default-text-vectorizer, list-collections, get-schema, sql-select, etc.), which is predictable and readable. Minor deviation: a few tools are noun-style rather than verb_noun (search, sql-select, vector-select), but the pattern is still coherent.
Seven tools is well-scoped for a Solr query server, with each tool covering a distinct capability (listing, schema introspection, full-text search, SQL, semantic, vector, and vectorizer defaults). No filler or redundancy that would suggest bloat.
The read/query surface is fairly complete (collections, schema, multiple query modes), but there are no write operations—no document indexing/update/delete and no collection create/delete—which are core Solr lifecycle operations. Agents can search but cannot mutate data or manage collections, leaving notable gaps.
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Serverless hybrid search: full-text, vector and faceted search, in SQL, ES DSL, Solr and more.
Search and SQL on object storage: full-text, vector and hybrid search plus SQL over your data.
Agentic search over your Dewey document collections from any MCP-compatible client.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceConnects AI assistants to Obsidian vaults via the Local REST API to search notes, retrieve content, and perform semantic searches. It features self-healing multi-URL connectivity and supports both stdio and HTTP transports for flexible deployment.283 npm13MIT
- AlicenseAqualityDmaintenanceExposes any Microsoft SQL Server database to AI agents with multi-database support, keyword lookup, free SELECT queries, and three transport modes (stdio/SSE/Streamable HTTP).41,789 npmMIT
- AlicenseAqualityBmaintenanceProvides managed Apache Solr search as MCP tools, enabling hybrid retrieval, server-side GPU embeddings, document indexing, and grounded RAG answers without managing infrastructure.10MIT
- FlicenseAqualityCmaintenanceEnables LLM agents to search and retrieve a hybrid knowledge base of manuals, videos, PDFs, DOCX files and images through tools for hybrid BM25-plus-vector search with facet and tag filters, full document retrieval, semantically similar document lookup, and timestamped video transcript segments. It ships with an in-memory backend for instant local use and an identical Elasticsearch backend for production deployment over stdio or authenticated HTTP.5-