
cr7258/elasticsearch-mcp-server 是从 https://github.com/cr7258/elasticsearch-mcp-server. 导入的 MCP 服务器候选
概览
cr7258/elasticsearch-mcp-server 是从 https://github.com/cr7258/elasticsearch-mcp-server. 导入的 MCP 服务器候选
概述(AI 翻译)
概述
一个模型上下文协议(MCP)服务器实现,提供 Elasticsearch 和 OpenSearch 交互。该服务器支持文档搜索、索引分析和集群管理,通过一系列工具实现。
演示
https://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15
特色
综合行动
general_api_request:执行通用的HTTP API请求。对于没有专用工具的任何Elasticsearch/OpenSearch API,使用此工具。
索引操作
list_indices:列出所有索引。get_index:返回关于一个或多个索引的信息(映射、设置、别名)。create_index:创建一个新的索引。delete_index:删除索引。create_data_stream:创建新数据流(需要匹配的索引模板)。get_data_stream:获取一个或多个数据流的信息。delete_data_stream:删除一个或多个数据流及其支持索引。
文档操作
search_documents:搜索文档。index_document:创建或更新索引中的文档。get_document:通过身份证获取文件。delete_document:通过ID删除文档。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Elasticsearch/OpenSearch MCP Server
Overview
A Model Context Protocol (MCP) server implementation that provides Elasticsearch and OpenSearch interaction. This server enables searching documents, analyzing indices, and managing cluster through a set of tools.
Demo
https://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15
Features
General Operations
general_api_request: Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
Index Operations
list_indices: List all indices.get_index: Returns information (mappings, settings, aliases) about one or more indices.create_index: Create a new index.delete_index: Delete an index.create_data_stream: Create a new data stream (requires matching index template).get_data_stream: Get information about one or more data streams.delete_data_stream: Delete one or more data streams and their backing indices.
Document Operations
search_documents: Search for documents.index_document: Creates or updates a document in the index.get_document: Get a document by ID.delete_document: Delete a document by ID.delete_by_query: Deletes documents matching the provided query.
Cluster Operations
get_cluster_health: Returns basic information about the health of the cluster.get_cluster_stats: Returns high-level overview of cluster statistics.
Alias Operations
list_aliases: List all aliases.get_alias: Get alias information for a specific index.put_alias: Create or update an alias for a specific index.delete_alias: Delete an alias for a specific index.
Analyzer Operations
analyze_text: Analyze text using a specified analyzer or custom analysis chain. Useful for debugging search queries and understanding how text is tokenized.
Configure Environment Variables
The MCP server supports the following environment variables:
Basic Authentication (Username/Password)
ELASTICSEARCH_USERNAME: Username for basic authenticationELASTICSEARCH_PASSWORD: Password for basic authenticationOPENSEARCH_USERNAME: Username for OpenSearch basic authenticationOPENSEARCH_PASSWORD: Password for OpenSearch basic authentication
API Key Authentication (Elasticsearch only) - Recommended
安装
uvx elasticsearch-mcp-server配置
{
"mcpServers": {
"elasticsearch-mcp-server": {
"command": "uvx",
"args": [
"elasticsearch-mcp-server"
],
"env": {
"ELASTICSEARCH_CLUSTERS": "{\"prod\": {\"hosts\": [\"https://prod-es:9200\"], \"api_key\": \"<PROD_API_KEY>\", \"verify_certs\": true}, \"staging\": {\"hosts\": [\"https://staging-es:9200\"], \"username\": \"elastic\", \"password\": \"<STAGING_PASSWORD>\"}}",
"DEFAULT_CLUSTER": "prod"
}
}
}
}