Cover image
Try Now
2025-04-14

Elasticsearch MCP服务器具有可用功能,包括映射管理,搜索和索引以及索引管理等。

3 years

Works with Finder

1

Github Watches

0

Github Forks

7

Github Stars

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 Variable Description Required
ES_HOST Your Elasticsearch instance URL (also supports legacy HOST) Yes
ES_API_KEY Elasticsearch API key for authentication (also supports legacy API_KEY) No
ES_USERNAME Elasticsearch username for basic authentication (also supports legacy USERNAME) No
ES_PASSWORD Elasticsearch password for basic authentication (also supports legacy PASSWORD) No
ES_CA_CERT Path to custom CA certificate for Elasticsearch SSL/TLS (also supports legacy CA_CERT) 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

    • 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.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

    Reviews

    3 (1)
    Avatar
    user_rtQGeHTP
    2025-04-16

    Elasticsearch-mcp by awesimon is an outstanding tool for anyone leveraging Elasticsearch. The integration and additional features it provides enhance the overall search and analytics experience, making data handling and querying incredibly efficient. I highly recommend checking it out at https://github.com/awesimon/elasticsearch-mcp for a remarkable upgrade to your Elasticsearch workflow.