Back to MCP Catalog

Elasticsearch/OpenSearch Integration MCP Server

DatabasesPython
Interact with Elasticsearch and OpenSearch clusters through a comprehensive set of tools
Available Tools

general_api_request

Perform a general HTTP API request to Elasticsearch/OpenSearch for operations without a dedicated tool

list_indices

List all indices in the Elasticsearch/OpenSearch cluster

get_index

Returns information (mappings, settings, aliases) about one or more indices

create_index

Create a new index with optional settings and mappings

delete_index

Delete an index from the cluster

search_documents

Search for documents matching specific criteria

index_document

Creates or updates a document in an index

get_document

Get a document by its ID

delete_document

Delete a document by its ID

delete_by_query

Deletes documents matching the provided query

get_cluster_health

Returns basic information about the health of the cluster

get_cluster_stats

Returns high-level overview of cluster statistics

list_aliases

List all aliases in the cluster

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

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.

Installation

There are multiple ways to install and use the Elasticsearch/OpenSearch Integration:

Option 1: Installing via Smithery

The easiest way to install is through Smithery:

npx -y @smithery/cli install elasticsearch-mcp-server --client claude

Option 2: Using uvx

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"
      }
    }
  }
}

Option 3: Manual Installation

  1. Clone the repository:
git clone https://github.com/cr7258/elasticsearch-mcp-server.git
cd elasticsearch-mcp-server
  1. Install dependencies:
pip install -e .
  1. Configure environment variables by copying .env.example to .env and updating the values.

  2. 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"
    }
  }
}

Setting Up Elasticsearch/OpenSearch

Before using the integration, you need a running Elasticsearch or OpenSearch cluster:

Using Docker Compose

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:

  • Username: elastic
  • Password: test123

For OpenSearch:

  • Username: admin
  • Password: admin

You can access Kibana or OpenSearch Dashboards at http://localhost:5601.

Configuration

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 authentication
  • ELASTICSEARCH_PASSWORD: Password for authentication
  • VERIFY_CERTS: Whether to verify SSL certificates (default: "true")
  • CA_CERTS: Path to CA certificate bundle
  • CLIENT_CERT: Path to client certificate
  • CLIENT_KEY: Path to client key
  • MCP_SERVER_PORT: Port for the MCP server (default: 8080)

Usage Examples

Once installed, you can use the integration to interact with your Elasticsearch or OpenSearch cluster. Here are some examples:

  1. Search for documents:
Can you search for documents in the "products" index that contain "smartphone" in their description?
  1. Create a new index:
Create a new index called "customers" with a mapping for fields "name" as text and "age" as integer
  1. Get cluster health:
What's the current health status of my Elasticsearch cluster?
  1. Analyze index information:
Show me the mapping for the "orders" index

Related MCPs

Milvus Vector Database
DatabasesPython

Connect to Milvus vector database for semantic search and vector operations

MotherDuck DuckDB
DatabasesPython

SQL analytics with DuckDB and MotherDuck for AI assistants

Alibaba Cloud Tablestore
DatabasesJava, Python

Connect to Alibaba Cloud Tablestore for vector search and RAG applications

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.