Cover image

3 years

Works with Finder

7

Github Watches

13

Github Forks

91

Github Stars

Elasticsearch MCP Server

Connect to your Elasticsearch data directly from any MCP Client (like Claude Desktop) using the Model Context Protocol (MCP).

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.

Elasticsearch Server MCP server

Available Tools

  • list_indices: List all available Elasticsearch indices
  • get_mappings: Get field mappings for a specific Elasticsearch index
  • search: Perform an Elasticsearch search with the provided query DSL
  • get_shards: Get shard information for all or specific indices

Prerequisites

  • An Elasticsearch instance
  • Elasticsearch authentication credentials (API key or username/password)
  • MCP Client (e.g. Claude Desktop)

Demo

https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c

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-server": {
          "command": "npx",
          "args": [
            "-y",
            "@elastic/mcp-server-elasticsearch"
          ],
          "env": {
            "ES_URL": "your-elasticsearch-url",
            "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_URL Your Elasticsearch instance URL Yes
ES_API_KEY Elasticsearch API key for authentication No
ES_USERNAME Elasticsearch username for basic authentication No
ES_PASSWORD Elasticsearch password for basic authentication No
ES_CA_CERT Path to custom CA certificate for Elasticsearch SSL/TLS No

Developing Locally

[!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-server-local": {
          "command": "node",
          "args": [
            "/path/to/your/project/dist/index.js"
          ],
          "env": {
            "ES_URL": "your-elasticsearch-url",
            "ES_API_KEY": "your-api-key"
          }
        }
      }
    }
    
  5. Debugging with MCP Inspector

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

Contributing

We welcome contributions from the community! For details on how to contribute, please see Contributing Guidelines.

Example Questions

[!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?"

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.

Security Best Practices

[!WARNING] Avoid using cluster-admin privileges. Create dedicated API keys with limited scope and apply fine-grained access control at the index level to prevent unauthorized data access.

You can create a dedicated Elasticsearch API key with minimal permissions to control access to your data:

POST /_security/api_key
{
  "name": "es-mcp-server-access",
  "role_descriptors": {
    "mcp_server_role": {
      "cluster": [
        "monitor"
      ],
      "indices": [
        {
          "names": [
            "index-1",
            "index-2",
            "index-pattern-*"
          ],
          "privileges": [
            "read",
            "view_index_metadata"
          ]
        }
      ]
    }
  }
}

License

This project is licensed under the Apache License 2.0.

Troubleshooting

  • Ensure your MCP configuration is correct.
  • Verify that your Elasticsearch URL is accessible from your machine.
  • Check that your authentication credentials (API key or username/password) have the necessary permissions.
  • If using SSL/TLS with a custom CA, verify that the certificate path is correct and the file is readable.
  • Look at the terminal output for error messages.

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.

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

  • apappascs
  • Entdecken Sie die umfassendste und aktuellste Sammlung von MCP-Servern auf dem Markt. Dieses Repository dient als zentraler Hub und bietet einen umfangreichen Katalog von Open-Source- und Proprietary MCP-Servern mit Funktionen, Dokumentationslinks und Mitwirkenden.

  • pontusab
  • Die Cursor & Windsurf -Community finden Regeln und MCPs

  • ravitemer
  • Ein leistungsstarkes Neovim -Plugin für die Verwaltung von MCP -Servern (Modellkontextprotokoll)

  • jae-jae
  • MCP -Server für den Fetch -Webseiteninhalt mit dem Headless -Browser von Dramatikern.

  • patruff
  • Brücke zwischen Ollama und MCP -Servern und ermöglicht es lokalen LLMs, Modellkontextprotokoll -Tools zu verwenden

  • av
  • Führen Sie mühelos LLM -Backends, APIs, Frontends und Dienste mit einem Befehl aus.

  • appcypher
  • Awesome MCP -Server - eine kuratierte Liste von Modellkontext -Protokollservern für Modellkontext

  • chongdashu
  • Aktivieren Sie KI -Assistenten -Clients wie Cursor, Windsurf und Claude -Desktop, um Unreal Engine durch natürliche Sprache mit dem Modellkontextprotokoll (MCP) zu steuern.

  • wgpsec
  • 一款基于各大企业信息 API 的工具 , 解决在遇到的各种针对国内企业信息收集难题。一键收集控股公司 ICP 备案、 app 、小程序、微信公众号等信息聚合导出。支持 MCP 接入

    Reviews

    4 (1)
    Avatar
    user_Nt2SRcvm
    2025-04-17

    As a dedicated user of mcp-server-elasticsearch, I can confidently say this tool is a game-changer for data management and search optimization. Created by Elastic, its robust features and seamless integration with Elasticsearch have significantly improved our server performance. The clear documentation and supportive community make it an indispensable asset for developers. Highly recommend checking it out on GitHub!