
Elasticsearch
STDIOElasticsearch数据处理与搜索MCP服务器
Elasticsearch数据处理与搜索MCP服务器
Spring AI MCP-based Elasticsearch Data Processing and Search Server
The Elasticsearch Model Context Protocol (MCP) Server is a server application developed based on Spring AI MCP. It is designed to easily define various data processing workflows through MCP and efficiently index and search the results in an Elasticsearch cluster.
@Tool
annotation in a Spring Boot environment are automatically registered with the MCP server. This allows external clients (e.g., Claude, FastMCP CLI) to call these functions via standard JSON-RPC based communication.get_cluster_health
: Returns basic information about the status of the Elasticsearch cluster.get_cluster_statistics
: Retrieves comprehensive cluster statistics including cluster name, UUID, status, node roles, OS and JVM resource usage, index count, and shard metrics.get_cat_mappings
: Retrieves field mapping information for a specific Elasticsearch index.get_cat_indices
: Retrieves a list of all indices in Elasticsearch.get_cat_indices_by_name
: Retrieves a list of indices that match the specified index name or wildcard pattern.get_cat_aliases
: Retrieves a list of all aliases in Elasticsearch.get_cat_aliases_by_name
: Retrieves a list of aliases that match the specified alias name or wildcard pattern.get_document_search_by_index
: Searches for documents within an Elasticsearch index using AI-generated queryDSL.get_shard_allocation
: Returns information about shard allocation in the Elasticsearch cluster.get_shard_allocation_for_node
: Returns information about shard allocation for a specific node in the Elasticsearch cluster.The following software is required to build and run this project:
Here's how to set up and run the project in your local environment:
git clone https://github.com/silbaram/elasticsearch-mcp-server.git cd elasticsearch-mcp-server
application.yml
in the mcp-server
moduleOpen the application.yml
file located in mcp-server/src/main/resources/application.yml
to set up your Elasticsearch cluster information.
elasticsearch: version: "8.6.1" # Specifies the version of the Elasticsearch cluster to connect to. search: hosts: - http://localhost:9200 # Specifies the access address of the Elasticsearch cluster.
Use the following command to build the project:
./gradlew build
mcp-server/build/libs/
directory.{ "mcpServers": { "elasticsearch-server": { "command": "java", "args": [ "-Dusername=YOUR_USERNAME", "-Dpassword=YOUR_PASSWORD", "-jar", "/path/to/your/mcp-server.jar" ] } } }
-Dusername
(Optional): Specifies the user ID required to access the Elasticsearch cluster. (e.g., -Dusername=elastic
)-Dpassword
(Optional): Specifies the password required to access the Elasticsearch cluster. (e.g., -Dpassword=yoursecurepassword
)/path/to/your/mcp-server.jar
: This must be replaced with the actual full path to your built mcp-server.jar
file.