Elasticsearch MCP Server

Elasticsearch MCP Server

Connects agents to Elasticsearch data using the Model Context Protocol, allowing natural language interaction with Elasticsearch indices through MCP Clients like Claude Desktop and Cursor.

Category
Visit Server

Tools

list_indices

List all available Elasticsearch indices, support regex

get_mappings

Get field mappings for a specific Elasticsearch index

search

Perform an Elasticsearch search with the provided query DSL. Highlights are always enabled.

elasticsearch_health

Get the health status of the Elasticsearch cluster, optionally include index-level details

create_index

Create an Elasticsearch index, optionally configure settings and mappings

create_mapping

Create or update the mapping structure of an Elasticsearch index

bulk

Bulk data into an Elasticsearch index

reindex

Reindex data from a source index to a target index

create_index_template

Create or update an Elasticsearch index template

get_index_template

Get information about Elasticsearch index templates

delete_index_template

Delete an Elasticsearch index template

README

Elasticsearch MCP Server

English | 中文

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

  • list_indices: List available Elasticsearch indices, support regex
  • get_mappings: Get field mappings for a specific Elasticsearch index
  • search: Perform an Elasticsearch search with the provided query DSL
  • elasticsearch_health: Get Elasticsearch cluster health status, optionally including index-level details
  • create_index: Create Elasticsearch index with optional settings and mappings
  • create_mapping: Create or update mapping structure for an Elasticsearch index
  • bulk: Bulk data into an Elasticsearch index
  • reindex: Reindex data from a source index to a target index with optional query and script
  • 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 (coming soon)

[!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": {
            "HOST": "your-elasticsearch-host",
            "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 Variable Description Required
HOST Your Elasticsearch instance URL Yes
API_KEY Elasticsearch API key for authentication No
USERNAME Elasticsearch username for basic authentication No
PASSWORD Elasticsearch password for basic authentication No
CA_CERT Path to custom CA certificate for Elasticsearch SSL/TLS No

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, (also support Cusor)

    • 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": {
            "HOST": "your-elasticsearch-host",
            "API_KEY": "your-api-key"
          }
        }
      }
    }
    
  5. Debugging with MCP Inspector

    HOST=your-elasticsearch-url 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 3000
    
    🔍 MCP Inspector is up and running at http://localhost:5173 🚀
    

Example Queries

[!TIP] Here are some natural language queries you can try with your MCP Client.

  • "What indices do I have in my Elasticsearch cluster?"
  • "Show me the field mappings for the 'products' index."
  • "Find all orders over $500 from last month."
  • "Which products received the most 5-star reviews?"
  • "What is the health status of my Elasticsearch cluster?"
  • "Create a new index called 'users' with 3 shards and 1 replica."
  • "Add a keyword type field called 'tags' to the 'products' index."
  • "Bulk import these customer records into the 'customers' index."
  • "Reindex data from 'old_index' to 'new_index'."
  • "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.

Inspired by

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured