Perform a general HTTP API request to Elasticsearch/OpenSearch for operations without a dedicated tool
List all indices in the Elasticsearch/OpenSearch cluster
Returns information (mappings, settings, aliases) about one or more indices
Create a new index with optional settings and mappings
Delete an index from the cluster
Search for documents matching specific criteria
Creates or updates a document in an index
Get a document by its ID
Delete a document by its ID
Deletes documents matching the provided query
Returns basic information about the health of the cluster
Returns high-level overview of cluster statistics
List all aliases in the cluster
Get alias information for a specific index
Create or update an alias for a specific index
Delete an alias for a specific index
The Elasticsearch/OpenSearch Integration provides a powerful interface for interacting with Elasticsearch and OpenSearch clusters. It enables searching documents, analyzing indices, and managing cluster operations through a set of specialized tools. This integration supports a wide range of operations including document search and manipulation, index management, cluster health monitoring, and alias operations. It's designed to work seamlessly with both Elasticsearch and OpenSearch, giving you flexibility in your search infrastructure choices.
There are multiple ways to install and use the Elasticsearch/OpenSearch Integration:
The easiest way to install is through Smithery:
npx -y @smithery/cli install elasticsearch-mcp-server --client claude
You can use uvx
to automatically install the package from PyPI. Add the following configuration to your client's config file:
{
"mcpServers": {
"elasticsearch-mcp-server": {
"command": "uvx",
"args": [
"elasticsearch-mcp-server"
],
"env": {
"ELASTICSEARCH_HOSTS": "https://localhost:9200",
"ELASTICSEARCH_USERNAME": "elastic",
"ELASTICSEARCH_PASSWORD": "test123",
"VERIFY_CERTS": "false"
}
}
}
}
git clone https://github.com/cr7258/elasticsearch-mcp-server.git
cd elasticsearch-mcp-server
pip install -e .
Configure environment variables by copying .env.example
to .env
and updating the values.
Add the following to your client's configuration:
{
"mcpServers": {
"elasticsearch-mcp-server": {
"command": "python",
"args": [
"-m",
"elasticsearch_mcp_server"
],
"cwd": "/path/to/elasticsearch-mcp-server"
}
}
}
Before using the integration, you need a running Elasticsearch or OpenSearch cluster:
Start an Elasticsearch cluster:
docker-compose -f docker-compose-elasticsearch.yml up -d
Or start an OpenSearch cluster:
docker-compose -f docker-compose-opensearch.yml up -d
The default credentials for Elasticsearch are:
elastic
test123
For OpenSearch:
admin
admin
You can access Kibana or OpenSearch Dashboards at http://localhost:5601.
The integration can be configured using environment variables:
ELASTICSEARCH_HOSTS
: Comma-separated list of Elasticsearch/OpenSearch hosts (default: "http://localhost:9200")ELASTICSEARCH_USERNAME
: Username for authenticationELASTICSEARCH_PASSWORD
: Password for authenticationVERIFY_CERTS
: Whether to verify SSL certificates (default: "true")CA_CERTS
: Path to CA certificate bundleCLIENT_CERT
: Path to client certificateCLIENT_KEY
: Path to client keyMCP_SERVER_PORT
: Port for the MCP server (default: 8080)Once installed, you can use the integration to interact with your Elasticsearch or OpenSearch cluster. Here are some examples:
Can you search for documents in the "products" index that contain "smartphone" in their description?
Create a new index called "customers" with a mapping for fields "name" as text and "age" as integer
What's the current health status of my Elasticsearch cluster?
Show me the mapping for the "orders" index