elasticsearch
极易部署 • 高性能 • 低内存占用 • 云原生支持 •Java版本的Elasticsearch MCP服务
claude mcp add --transport stdio gokeep-projects-elasticsearch-mcp-server java -jar elasticsearch-mcp-server-runner.jar \ --env ELASTICSEARCH_HOST="http://localhost:9200" \ --env ELASTICSEARCH_PASSWORD="" \ --env ELASTICSEARCH_USERNAME=""
How to use
This Elasticsearch MCP Server provides a high-performance MCP (Model Context Protocol) service built on Quarkus to interact with Elasticsearch data sources through AI-assisted tooling. It exposes a set of core Elasticsearch operations via MCP tools, including health checks, indexing management, mapping queries, SQL-like queries, DSL search, and document retrieval. The server is designed to run in cloud-native environments and can be deployed as a JVM-based executable or native binary. After starting, the server will listen for MCP connections over SSE and Streamable HTTP protocols, enabling clients to interact with Elasticsearch through standardized MCP tool calls and receive structured responses.
How to install
Prerequisites:
- Java 21 (or a compatible JDK compatible with Quarkus-based builds)
- Maven 3.8+ for building from source (optional if using prebuilt jar)
- Elasticsearch 7.x/8.x/9.x (as target data source)
- Obtain the server artifacts
- Option A: Download the prebuilt runner jar (recommended for quick start):
- elasticsearch-mcp-server-runner.jar
- Option B: Build from source (requires Maven):
- git clone <repository-url>/elasticsearch-mcp-server
- cd elasticsearch-mcp-server
- ./mvnw clean package (or mvn clean package)
- Use target/elasticsearch-mcp-server-runner.jar (or the native image if you built with -Dnative)
- Run the server
- JVM mode (recommended for general use):
java -jar elasticsearch-mcp-server-runner.jar
By default connects to http://localhost:9200 with no authentication. See启动参数 for how to customize via CLI or env vars.
- Configure connection to Elasticsearch
- You can set the following via command-line or environment variables:
- elasticsearch.host (e.g., http://localhost:9200)
- elasticsearch.username
- elasticsearch.password
- Optional: Run with Docker (if provided in future releases)
- When a Docker image is available, you would typically run a command like: docker run -d -p 19000:19000 -e ELASTICSEARCH_HOST=http://localhost:9200 elasticsearch-mcp-server:latest
- Verify the server is up
- Check the logs for startup completion and endpoints. The MCP server should expose SSE at /mcp/sse and Streamable HTTP at /mcp once running.
Additional notes
Tips and common considerations:
- Endpoint details: SSE endpoint is /mcp/sse and Streamable HTTP endpoint is /mcp. The default listening interface is 0.0.0.0:19000 when started with default config.
- Environment variables: Use ELASTICSEARCH_HOST, ELASTICSEARCH_USERNAME, and ELASTICSEARCH_PASSWORD to configure remote Elasticsearch connections without command-line parameters.
- If you plan to run in cloud-native environments, consider using the native image build for reduced startup time and memory footprint.
- When upgrading Elasticsearch versions, ensure compatibility with the MCP tooling and the Quarkus-based server. Check the project docs for any changes in supported Elasticsearch versions.
- If you need to add new tools, modify ElasticsearchMcpServer.java and Router constants as described in the repository's developer section, then re-build.
- For production deployments, tune JVM options and enable native-mode only if you require extreme performance and have GraalVM available.