Integrations
Utilizes Apache Lucene for full-text search and indexing capabilities, enabling efficient document management, complex querying with Lucene query syntax, and document filtering based on metadata.
Supports containerization of the application using Docker, with instructions for building and running the server as a Docker container.
Built with Spring Boot for application setup and deployment, providing RESTful API endpoints for document management operations including upsert, delete, list, and query functionalities.
MCP Lucene 服务器
描述
MCP Lucene 服务器是基于模型上下文协议 (MCP) 的 Java 实现,旨在使用 Apache Lucene 提供高效的搜索和检索功能。此服务器允许您利用 Lucene 强大的索引和搜索功能来管理和查询文档。它使用 Spring Boot 构建,易于设置和部署。
特征
- **MCP 合规性:**实现核心模型上下文协议。
- **Lucene-Powered:**利用 Apache Lucene 进行全文搜索和索引。
- **RESTful API:**提供与服务器交互的 RESTful API。
- 文档管理:
- **Upsert:**在 Lucene 索引中添加或更新文档。
- **删除:**从 Lucene 索引中删除文档。
- **列表:**从索引中检索文档列表。
- 查询:
- 支持使用 Lucene 查询语法的复杂查询。
- 过滤:根据文档元数据过滤查询。
- **状态:**检查服务器状态。
- **Spring Boot:**使用 Spring Boot 构建,可轻松设置和部署。
- **Dockerization:**包括使用 Docker 对应用程序进行容器化的说明。
目录
入门
先决条件
- Java: Java 11 或更高版本。
- Maven: Maven 3.6.0 或更高版本。
- **Docker:**如果您计划使用 Docker 镜像,请安装 Docker 。
安装
- 克隆存储库:(将Copy
your-username
替换为您的 GitHub 用户名) - 使用 Maven 构建项目:Copy
运行服务器
没有 Docker
- 运行 Spring Boot 应用程序:(Copy
.jar
文件的确切名称可能会根据项目版本的不同而略有不同。) - 服务器将默认在端口
8080
上启动。
使用 Docker
- **确保已安装 Docker:**按照 Docker 官方网站上的说明进行操作: https://docs.docker.com/get-docker/
- **构建 Docker 镜像:**在终端中导航到项目的根目录并运行:Copy
- 运行 Docker 容器:这会将主机上的端口Copy
8080
映射到容器内的端口8080
。
用法
API 端点
服务器提供以下 API 端点:
GET /mcp/v1/status
- 返回服务器的状态。
POST /mcp/v1/upsert
- 更新(插入或更新)一个或多个文档。
- 请求正文:Copy
POST /mcp/v1/query
- 查询 Lucene 索引。
- 请求正文:Copy
query
:Lucene 查询字符串。top_k
:(可选)要返回的最大结果数(默认值:10)。filter
:(可选)要过滤的元数据字段和值的映射。
POST /mcp/v1/delete
- 从 Lucene 索引中删除文档。
- 请求正文:Copy
GET /mcp/v1/list
- 列出 Lucene 索引中的文档。
- 请求正文:Copy
示例
获取服务器状态:
更新插入文档:
查询文件:
删除文档:
列出文件:
配置
可以使用 Spring Boot 的应用程序属性来配置服务器。以下是一些关键属性:
server.port
:服务器监听的端口(默认值:8080)。lucene.index.path
:Lucene 索引目录的路径。索引数据就存储在这里。如果未设置,则使用默认位置。强烈建议将其配置为持久存储位置。
您可以在src/main/resources
目录中的application.properties
或application.yml
文件中设置这些属性,或者使用环境变量来设置这些属性。
示例application.properties
:
服务器.端口=8080 lucene.index.path=/路径/到/lucene/索引
执照
该项目采用Apache 2.0 许可证进行授权。
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol (MCP) server that provides search and crawl functionality using Search1API.Last updated -5206111TypeScriptMIT License
- AsecurityAlicenseAqualityAn MCP server implementation that integrates the Tavily Search API, providing optimized search capabilities for LLMs.Last updated -1TypeScriptMIT License
- AsecurityAlicenseAqualityProvides an MCP protocol interface for interacting with Elasticsearch 7.x databases, supporting comprehensive search functionality including aggregations, highlighting, and sorting.Last updated -31PythonApache 2.0
- -securityFlicense-qualityAn MCP server that integrates with SerpApi to retrieve search results from multiple search engines including Google, Bing, Yahoo, and others, enabling fast access to both live and archived search data.Last updated -Python