diff --git a/solr-mcp-tutorial.html b/solr-mcp-tutorial.html new file mode 100644 index 0000000..cea07d4 --- /dev/null +++ b/solr-mcp-tutorial.html @@ -0,0 +1,817 @@ + + +
+ + +The Solr MCP (Model Context Protocol) Server enables AI assistants like Claude to interact with Apache Solr through a + standardized protocol. This guide provides comprehensive instructions for setting up, configuring, and using the + Solr MCP Server.
+ +The Solr MCP Server is a Spring AI-based implementation that provides AI assistants with tools to interact with + Apache Solr. It supports both STDIO and HTTP transport modes, enabling flexible deployment options.
+ +http://localhost:8983/solr/)docker compose up -d
+The Solr MCP Server can be integrated with any MCP-compatible client. Both STDIO mode and HTTP + mode are fully supported.
+ +STDIO mode uses standard input/output for communication. This is the default mode and works with Claude Desktop, + GitHub Copilot, VSCode extensions, and other MCP clients.
+ +Edit your configuration file:
+~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonUsing Docker:
+{
+ "mcpServers": {
+ "solr-mcp": {
+ "command": "docker",
+ "args": ["run", "-i", "--rm", "ghcr.io/apache/solr-mcp:latest"],
+ "env": {
+ "SOLR_URL": "http://localhost:8983/solr/"
+ }
+ }
+ }
+}
+
+Using JAR:
+{
+ "mcpServers": {
+ "solr-mcp": {
+ "command": "java",
+ "args": ["-jar", "/absolute/path/to/solr-mcp-0.0.1-SNAPSHOT.jar"],
+ "env": {
+ "SOLR_URL": "http://localhost:8983/solr/"
+ }
+ }
+ }
+}
+
+These clients use the same configuration format.
+ +GitHub Copilot: Add to VS Code settings (settings.json)
Cline: Add to Cline MCP settings
+Continue: Add to ~/.continue/config.json
Configuration (Docker):
+{
+ "mcpServers": {
+ "solr-mcp": {
+ "command": "docker",
+ "args": ["run", "-i", "--rm", "ghcr.io/apache/solr-mcp:latest"],
+ "env": {
+ "SOLR_URL": "http://localhost:8983/solr/"
+ }
+ }
+ }
+}
+
+Configuration (JAR):
+{
+ "mcpServers": {
+ "solr-mcp": {
+ "command": "java",
+ "args": ["-jar", "/absolute/path/to/solr-mcp-0.0.1-SNAPSHOT.jar"],
+ "env": {
+ "SOLR_URL": "http://localhost:8983/solr/"
+ }
+ }
+ }
+}
+
+{"mcpServers": [...]}
+JetBrains IDEs (IntelliJ IDEA, PyCharm, WebStorm, etc.) support MCP through AI Assistant settings.
+ +Navigate to Settings → Tools → AI Assistant → Model Context Protocol and add:
+{
+ "servers": {
+ "solr-mcp": {
+ "command": "docker",
+ "args": ["run", "-i", "--rm", "ghcr.io/apache/solr-mcp:latest"],
+ "env": {
+ "SOLR_URL": "http://localhost:8983/solr/"
+ }
+ }
+ }
+}
+
+Alternatively, edit the MCP configuration file directly:
+~/Library/Application Support/JetBrains/[IDE]/mcp_config.json%APPDATA%\JetBrains\[IDE]\mcp_config.json~/.config/JetBrains/[IDE]/mcp_config.jsonThe MCP Inspector is an official tool for testing and + debugging MCP servers.
+ +For testing with STDIO transport:
+# Start the server
+docker run -i --rm ghcr.io/apache/solr-mcp:latest
+
+# Or using JAR
+java -jar build/libs/solr-mcp-0.0.1-SNAPSHOT.jar
+
+# In another terminal, connect with MCP Inspector
+npx @modelcontextprotocol/inspector
+
+HTTP mode uses a streamable HTTP transport. This is useful for debugging with MCP Inspector or when your client + doesn't support STDIO.
+ +Using Docker:
+docker run -d --name solr-mcp \
+ -p 8080:8080 \
+ -e PROFILES=http \
+ -e SOLR_URL=http://localhost:8983/solr/ \
+ ghcr.io/apache/solr-mcp:latest
+
+Using JAR:
+PROFILES=http java -jar build/libs/solr-mcp-0.0.1-SNAPSHOT.jar
+
+All clients use the same configuration format for HTTP mode:
+ +Claude Desktop, GitHub Copilot, Cline, Continue:
+{
+ "mcpServers": {
+ "solr-mcp": {
+ "url": "http://localhost:8080/mcp"
+ }
+ }
+}
+
+JetBrains IDEs:
+{
+ "servers": {
+ "solr-mcp": {
+ "url": "http://localhost:8080/mcp"
+ }
+ }
+}
+
+MCP Inspector (HTTP):
+npx @modelcontextprotocol/inspector http://localhost:8080/mcp
+
+| Variable | +Description | +Default | +
|---|---|---|
SOLR_URL |
+ URL of the Solr instance | +http://localhost:8983/solr/ |
+
PROFILES |
+ Transport mode (empty=STDIO, http=HTTP) |
+ (empty - STDIO mode) | +
host.docker.internal instead of localhost--network host to docker run commandClaude Desktop: Look for the 🔌 icon in the bottom-right corner. Click it to see "solr-mcp" with 6 + available tools.
+ +Other Clients: Check your client's tools/context servers panel to confirm the connection and see + available tools.
+ +The Solr MCP Server provides six tools accessible to AI assistants:
+ +Search Solr collections with advanced query options.
+ +| Parameter | +Type | +Description | +Required | +
|---|---|---|---|
collection |
+ String | +Solr collection to query | +Yes | +
query |
+ String | +Solr query (defaults to *:*) |
+ No | +
filterQueries |
+ Array | +Filter queries (fq parameter) | +No | +
facetFields |
+ Array | +Fields to facet on | +No | +
sortClauses |
+ Array | +Sorting criteria | +No | +
start |
+ Integer | +Starting offset for pagination | +No | +
rows |
+ Integer | +Number of rows to return | +No | +
_s - String field (exact matching)_i - Integer field_l - Long field_f - Float field_d - Double field_dt - Date field_b - Boolean field_t - Text field (tokenized)Index documents from a JSON string.
+{
+ "collection": "myCollection",
+ "json": "[{\"id\":\"1\",\"title\":\"Example\"}]"
+}
+
+Index documents from a CSV string.
+{
+ "collection": "myCollection",
+ "csv": "id,title\n1,Example\n2,Another"
+}
+
+Index documents from an XML string.
+{
+ "collection": "myCollection",
+ "xml": "<docs><doc><field name=\"id\">1</field></doc></docs>"
+}
+
+List all available Solr collections. No parameters required.
+ +Retrieve statistics and metrics for a collection.
+{
+ "collection": "books"
+}
+
+Check the health status of a collection.
+{
+ "collection": "books"
+}
+
+Retrieve schema information for a collection.
+{
+ "collection": "books"
+}
+
+User: "Search for books about science in the books collection"
+AI Assistant uses:
+Search({
+ "collection": "books",
+ "query": "science"
+})
+
+User: "Show me fantasy books with facets by author"
+AI Assistant uses:
+Search({
+ "collection": "books",
+ "query": "*:*",
+ "filterQueries": ["genre_s:fantasy"],
+ "facetFields": ["author"],
+ "rows": 10
+})
+
+User: "Show me the newest films, sorted by year descending, page 2"
+AI Assistant uses:
+Search({
+ "collection": "films",
+ "query": "*:*",
+ "sortClauses": [{"field": "initial_release_date", "order": "desc"}],
+ "start": 10,
+ "rows": 10
+})
+
+User: "Add a new book to the collection"
+AI Assistant uses:
+index_json_documents({
+ "collection": "books",
+ "json": "[{
+ \"id\": \"new-book-1\",
+ \"name\": [\"Introduction to Solr\"],
+ \"author\": [\"Jane Developer\"],
+ \"genre_s\": \"technical\",
+ \"price\": [29.99],
+ \"inStock\": [true]
+ }]"
+})
+
+User: "What collections are available and show me stats for books"
+AI Assistant uses:
+listCollections()
+
+getCollectionStats({
+ "collection": "books"
+})
+
+curl http://localhost:8983/solr/SOLR_URL environment variable--network hosthost.docker.internal instead of localhostSOLR_URL=http://host.docker.internal:8983/solr/--network host to docker run command*:*field:"exact phrase"field:test*price:[10 TO 20]field1:value1 AND field2:value2# Clone the repository
+git clone https://github.com/apache/solr-mcp.git
+cd solr-mcp
+
+# Build with Gradle
+./gradlew build
+
+# Run tests
+./gradlew test
+
+# Build Docker image locally
+./gradlew jibDockerBuild
+
+Connect to a remote Solr instance:
+{
+ "mcpServers": {
+ "solr-mcp": {
+ "command": "docker",
+ "args": ["run", "-i", "--rm", "ghcr.io/apache/solr-mcp:latest"],
+ "env": {
+ "SOLR_URL": "https://remote-solr.example.com:8983/solr/"
+ }
+ }
+ }
+}
+
+start and rows)fq) for better cachingfl parameterThis guide was created for Solr MCP Server version 0.0.1-SNAPSHOT. Last updated: November 2025.
+ +License: Apache License 2.0
+ + \ No newline at end of file