AS

apache/solr-mcp

部署与 DevOps官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

21 stars 17 forks 质量 81 趋势 30Apache-2.0

Solr MCP 服务器

概览

搜索、索引和管理Apache Solr集合——无需手工制作Solr查询、构建过滤表达式或记忆管理API。 “查找2000年后上映的科幻电影标题中带有'星球大战'的作品,给我看类型分类,并按相关性排序。” 这款 Spring AI 模型上下文协议(MCP)服务器将 Solr 操作展示为任何兼容 MCP 的 AI 客户端(Claude Desktop、Claude Code、Codex、ChatGPT、VS Code/Copilot、Cursor、JetBrains、Zed)都可以调用的工具。 Java 25+,Docker 和 Docker Compose,git。 支持Apache Solr(测试套件默认运行于9.9版本——参见Solr版本兼容性)。 这会以两个样本集合启动 SolrCloud,包含两个样本集合:(1,100+ 电影)和(空,准备索引)。等待~30秒,然后在[[T0]处验证。 这会产生构建/库/solr-mcp-1.0.0-SNAPSHOT.jar。 将服务器添加到你的MCP客户端。编辑 ~/Library/Application Support/Claude/claude_desktop_config。

概述(AI 翻译)

使用自然语言搜索、索引和管理Apache Solr集合——无需手工编写Solr查询、构建过滤表达式或记忆管理API。

而不是写:

问问你的AI助手:

“查找2000年后上映的科幻电影标题中带有’星球大战’的作品,展示类型分类,并按相关性排序。”

这款 Spring AI 模型上下文协议(MCP)服务器将 Solr 操作展示为任何兼容 MCP 的 AI 客户端(Claude Desktop、Claude Code、Codex、ChatGPT、VS Code/Copilot、Cursor、JetBrains、Zed)都可以调用的工具。

快速开始

先决条件: Java 25+,Docker 和 Docker Compose,git。

兼容性: 可与 Apache Solr 9.4–10 兼容(测试套件默认运行于 9.9 版本——详见 Solr 版本兼容性)。

1.用样本数据开始 Solr

这会在 SolrCloud 模式下以两个样本集合启动 Solr:films(1,100+ 部电影)和books(空的,准备索引)。等待 ~30 秒,然后在 。

2.搭建服务器

这会产生build/libs/solr-mcp-1.0.0-SNAPSHOT.jar。

3.连接你的AI客户端

把服务器添加到你的MCP客户端。关于Claude桌面,编辑

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Solr MCP Server

Search, index, and manage Apache Solr collections using natural language — no need to hand-craft Solr queries, build filter expressions, or memorize the admin API.

Instead of writing:

q=title:"star wars" AND genre_s:"sci-fi"&fq=year_i:[2000 TO *]&facet=true&facet.field=genre_s&sort=score desc&rows=10

Just ask your AI assistant:

“Find sci-fi movies with ‘star wars’ in the title released after 2000, show me the genre breakdown, and sort by relevance.”

This Spring AI Model Context Protocol (MCP) server exposes Solr operations as tools that any MCP-compatible AI client (Claude Desktop, Claude Code, Codex, ChatGPT, VS Code/Copilot, Cursor, JetBrains, Zed) can invoke.

Quick start

Prerequisites: Java 25+, Docker and Docker Compose, Git.

Compatibility: works with Apache Solr 9.4–10 (the test suite runs against 9.9 by default — see Solr version compatibility).

1. Start Solr with sample data

git clone https://github.com/apache/solr-mcp.git
cd solr-mcp
docker compose up -d

This starts Solr in SolrCloud mode with two sample collections: films (1,100+ movies) and books (empty, ready for indexing). Wait ~30 seconds, then verify at .

2. Build the server

./gradlew build

This produces build/libs/solr-mcp-1.0.0-SNAPSHOT.jar.

3. Connect your AI client

Add the server to your MCP client. For Claude Desktop, edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), then restart Claude:

{
  "mcpServers": {
    "solr-mcp": {
      "command": "java",
      "args": ["-jar", "/absolute/path/to/solr-mcp/build/libs/solr-mcp-1.0.0-SNAPSHOT.jar"],
      "env": { "SOLR_URL": "http://localhost:8983/solr/" }
    }
  }
}

Using a different client, or want STDIO/HTTP/Docker options? See the per-client guides: Claude Desktop · Claude Code · Codex · ChatGPT (HTTP only) · VS Code / Copilot · Cursor · JetBrains · Zed · MCP Inspector.

4. Try it out

  • “What collections are available in Solr?”
  • “Search the films collection for movies directed by Steven Spielberg”
  • “Show me the schema for the films collection”
  • “Index this JSON into the books collection: [{“id”: “1”, “title”: “The Great Gatsby”, “author”: “F. Scott Fitzgerald”}]”

Example prompts

Searching

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "solr-mcp": { "command": "java", "args": ["-jar", "/absolute/path/to/solr-mcp/build/libs/solr-mcp-1.0.0-SNAPSHOT.jar"], "env": { "SOLR_URL": "http://localhost:8983/solr/" } } } }