mcpField
E
Elasticsearch MCP Server

Elasticsearch MCP Server

Local
github.com/awesimonDatabases24Updated 64w ago

About Elasticsearch MCP Server

Elasticsearch MCP Server is an MCP server that connects to an Elasticsearch cluster, letting MCP clients query and manage index data through natural language. It covers cluster health, indices, mappings, search and templates, and is aimed at users who want Elasticsearch available inside AI clients.

Key features

  1. 01Check cluster health status
  2. 02List, create and reindex indices
  3. 03Get and create field mappings
  4. 04Run search queries using query DSL
  5. 05Bulk write data into indices
  6. 06Manage index templates

Use cases

  1. 01Query Elasticsearch data using natural language
  2. 02Check cluster health and index status
  3. 03Create index templates or update field mappings

MCP support

This project is an MCP server that exposes tools such as elasticsearch_health, search, bulk and create_index to MCP clients for operating an Elasticsearch cluster.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"elasticsearch": {
"command": "npx",
"args": [
"-y",
"@awesome-ai/elasticsearch-mcp"
],
"env": {
"ES_HOST": "<ES_HOST>",
"ES_API_KEY": "<ES_API_KEY>"
}
}
}
}
Run commandnpx -y @awesome-ai/elasticsearch-mcp
Environment variables to set
ES_HOST
ES_API_KEYSecret

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@awesome-ai/elasticsearch-mcp

Tools

11

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
patternstringNoOptional regex pattern to filter indices by name

Details

From the project README

Elasticsearch MCP Server

English | 中文

smithery badge

MCP Server for connecting to your Elasticsearch cluster directly from any MCP Client (like Claude Desktop, Cursor).

This server connects agents to your Elasticsearch data using the Model Context Protocol. It allows you to interact with your Elasticsearch indices through natural language conversations.

Demo

Elasticsearch MCP Demo

Feature Overview

Available Features
Cluster Management
  • elasticsearch_health: Get Elasticsearch cluster health status, optionally including index-level details
Index Operations
  • list_indices: List available Elasticsearch indices, support regex
  • create_index: Create Elasticsearch index with optional settings and mappings
  • reindex: Reindex data from a source index to a target index with optional query and script
Mapping Management
  • get_mappings: Get field mappings for a specific Elasticsearch index
  • create_mapping: Create or update mapping structure for an Elasticsearch index
Search & Data Operations
  • search: Perform an Elasticsearch search with the provided query DSL
  • bulk: Bulk data into an Elasticsearch index
Template Management
  • create_index_template: Create or update an index template
  • get_index_template: Get information about index templates
  • delete_index_template: Delete an index template
How It Works
  1. The MCP Client analyzes your request and determines which Elasticsearch operations are needed.
  2. The MCP server carries out these operations (listing indices, fetching mappings, performing searches).
  3. The MCP Client processes the results and presents them in a user-friendly format.

Getting Started

Prerequisites
  • An Elasticsearch instance
  • Elasticsearch authentication credentials (API key or username/password)
  • MCP Client (e.g. Claude Desktop, Cursor)
Installation & Setup
Using the Published NPM Package

Tip

The easiest way to use Elasticsearch MCP Server is through the published npm package.

  1. Configure MCP Client

    • Open your MCP Client. See the list of MCP Clients, here we are configuring Claude Desktop.
    • Go to Settings > Developer > MCP Servers
    • Click Edit Config and add a new MCP Server with the following configuration:
    {
      "mcpServers": {
        "elasticsearch-mcp": {
          "command": "npx",
          "args": [
            "-y",
            "@awesome-ai/elasticsearch-mcp"
          ],
          "env": {
            "ES_HOST": "your-elasticsearch-host",
            "ES_API_KEY": "your-api-key"
          }
        }
      }
    }
    
  2. Start a Conversation

    • Open a new conversation in your MCP Client.
    • The MCP server should connect automatically.
    • You can now ask questions about your Elasticsearch data.
Configuration Options

The Elasticsearch MCP Server supports configuration options to connect to your Elasticsearch:

Note

You must provide either an API key or both username and password for authentication.

Environment VariableDescriptionRequired
ES_HOSTYour Elasticsearch instance URL(s) - supports single URL or comma-separated multiple URLs (also supports legacy HOST)Yes
ES_API_KEYElasticsearch API key for authentication (also supports legacy API_KEY)No
ES_USERNAMEElasticsearch username for basic authentication (also supports legacy USERNAME)No
ES_PASSWORDElasticsearch password for basic authentication (also supports legacy PASSWORD)No
ES_CA_CERTPath to custom CA certificate for Elasticsearch SSL/TLS (also supports legacy CA_CERT)No
Multiple URLs Configuration

You can configure multiple Elasticsearch nodes for high availability and load balancing:

{
  "mcpServers": {
    "elasticsearch-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@awesome-ai/elasticsearch-mcp"
      ],
      "env": {
        "ES_HOST": "https://es-node1:9200,https://es-node2:9200,https://es-node3:9200",
        "ES_API_KEY": "your-api-key"
      }
    }
  }
}

The client will automatically handle failover and load balancing between the configured nodes.

Local Development

Note

If you want to modify or extend the MCP Server, follow these local development steps.

  1. Use the correct Node.js version

    nvm use
    
  2. Install Dependencies

    npm install
    
  3. Build the Project

    npm run build
    
  4. Run locally in Claude Desktop App

    • Open Claude Desktop App
    • Go to Settings > Developer > MCP Servers
    • Click Edit Config and add a new MCP Server with the following configuration:
    {
      "mcpServers": {
        "elasticsearch-mcp": {
          "command": "node",
          "args": [
            "/path/to/your/project/dist/index.js"
          ],
          "env": {
            "ES_HOST": "your-elasticsearch-host",
            "ES_API_KEY": "your-api-key"
          }
        }
      }
    }
    
  5. Run locally in Cursor Editor

    • Open Cursor Editor
    • Go to Cursor Settings > MCP
    • Click Add new global MCP Server and add a new MCP Server with the following configuration:
    {
      "mcpServers": {
        "elasticsearch-mcp": {
          "command": "node",
          "args": [
            "/path/to/your/project/dist/index.js"
          ],
          "env": {
            "ES_HOST": "your-elasticsearch-host",
            "ES_API_KEY": "your-api-key"
          }
        }
      }
    }
    
  6. Debugging with MCP Inspector

    ES_HOST=your-elasticsearch-url ES_API_KEY=your-api-key npm run inspector
    

    This will start the MCP Inspector, allowing you to debug and analyze requests. You should see:

    Starting MCP inspector...
    ⚙️ Proxy server listening on port 6277
    🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀
    

Example Queries

Tip

Here are some natural language queries you can try with your MCP Client.

Cluster Management
  • "What is the health status of my Elasticsearch cluster?"
  • "How many active nodes are in my cluster?"
Index Operations
  • "What indices do I have in my Elasticsearch cluster?"
  • "Create a new index called 'users' with 3 shards and 1 replica."
  • "Reindex data from 'old_index' to 'new_index'."
Mapping Management
  • "Show me the field mappings for the 'products' index."
  • "Add a keyword type field called 'tags' to the 'products' index."
Search & Data Operations
  • "Find all orders over $500 from last month."
  • "Which products received the most 5-star reviews?"
  • "Bulk import these customer records into the 'customers' index."
Template Management
  • "Create an index template for logs with pattern 'logs-*'."
  • "Show me all my index templates."
  • "Delete the 'outdated_template' index template."

If you encounter issues, feel free to open an issue on the GitHub repository.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.