Get the FREE Ultimate OpenClaw Setup Guide →

mcp -elasticsearch

MCP server from da1y/mcp-server-elasticsearch

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio da1y-mcp-server-elasticsearch npx -y @modelcontextprotocol/server-elasticsearch http://localhost:9200

How to use

This MCP server provides a Model Context Protocol interface to manage and query Elasticsearch clusters. It exposes tools to search indices, create indices, list existing indices, and index documents. Specifically, the available tools are: search, which executes Elasticsearch queries against a specified index and returns matching hits; create_index, which creates a new index with optional mappings and settings; list_indices, which returns information about all indices; and index_document, which indexes a document into a given index. The server also exposes index mappings metadata at elasticsearch://<host>/<index>/schema, providing field types and configurations discovered from metadata. To integrate with Claude Desktop, you can add the server entry to your claude_desktop_config.json under mcpServers, pointing to the npx package @modelcontextprotocol/server-elasticsearch and the Elasticsearch endpoint you wish to use (for example http://localhost:9200). Once configured, you can issue commands through Claude to create indices, push documents, and run complex search queries, with the results returned to your LLM workflow for interpretation and response generation.

How to install

Prerequisites:

  • Node.js and npm installed on your machine
  • Access to a running Elasticsearch endpoint (default http://localhost:9200)

Installation steps:

  1. Install Node.js if not already installed. Visit https://nodejs.org/ and follow the installation instructions for your OS.
  2. Bootstrap and run the MCP server via npx (no local install required):
    • Ensure you have access to the internet
    • Run the server with the following command to point to your Elasticsearch endpoint: npx -y @modelcontextprotocol/server-elasticsearch http://localhost:9200
  3. Optional: If you prefer to install a local copy for repeated runs:
    • Run: npm install -g @modelcontextprotocol/server-elasticsearch
    • Then start using: npx -y @modelcontextprotocol/server-elasticsearch http://localhost:9200
  4. If you want to run through Docker (alternative): pull and run an Elasticsearch container as described in the README, then ensure the server points to the container's endpoint.

Notes:

  • The server defaults to using the provided Elasticsearch endpoint; adjust the URL to your environment as needed.

Additional notes

Tips and considerations:

  • Make sure Elasticsearch is reachable from the environment running the MCP server (firewalls, TLS, and authentication may affect connectivity).
  • If you enable security in Elasticsearch, you may need to provide credentials or a token in the endpoint URI (for example, https://user:pass@host:9200).
  • The mapping metadata endpoint elasticsearch://<host>/<index>/schema is automatically discovered from index metadata by the server; ensure your indices have appropriate mappings for optimal results.
  • When using Claude Desktop, ensure the mcpServers entry uses the exact package name and endpoint you intend to connect to; you can override http://localhost:9200 with your remote ES URL.
  • If you encounter version compatibility issues, verify that the server-elasticsearch package version supports your Elasticsearch cluster version.

Related MCP Servers

Sponsor this space

Reach thousands of developers