Supports deployment using Docker containers, allowing users to run the MCP server with proper environment configuration for connecting to Elasticsearch.
Provides tools for interacting with Elasticsearch data through natural language, including listing indices, getting field mappings, performing searches with query DSL, and retrieving shard information.
Offers deployment via NPM package, allowing users to run the MCP server using Node.js with the required environment variables for Elasticsearch connectivity.
Elasticsearch MCP Server
This repository contains experimental features intended for research and evaluation and are not production-ready.
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.
Available Tools
list_indices
: List all available Elasticsearch indicesget_mappings
: Get field mappings for a specific Elasticsearch indexsearch
: Perform an Elasticsearch search with the provided query DSL. Supports highlighting, query profiling, and query explanation.get_shards
: Get shard information for all or specific indices
Prerequisites
- An Elasticsearch instance
- Elasticsearch authentication credentials (API key or username/password)
- Docker (or an OCI runtime)
- MCP Client (e.g. Claude Desktop)
Demo
https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c
Installation & Setup
Using Docker
- 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:
- 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
Using the Published NPM Package
- 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:
- 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 |
ES_SSL_SKIP_VERIFY | Set to '1' or 'true' to skip SSL certificate verification | No |
ES_PATH_PREFIX | Path prefix for Elasticsearch instance exposed at a non-root path | No |
ES_VERSION | Server assumes Elasticsearch 9.x. Set to 8 target Elasticsearch 8.x | No |
Developing Locally
Note
If you want to modify or extend the MCP Server, follow these local development steps.
- Use the correct Node.js version
- Install Dependencies
- Build the Project
- 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:
- Debugging with MCP InspectorThis will start the MCP Inspector, allowing you to debug and analyze requests. You should see:
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
- The MCP Client analyzes your request and determines which Elasticsearch operations are needed.
- The MCP server carries out these operations (listing indices, fetching mappings, performing searches).
- 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:
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.
This server cannot be installed
Connects agents to Elasticsearch data using the Model Context Protocol, allowing natural language interaction with Elasticsearch indices through tools for listing indices, getting field mappings, performing searches, and viewing shard information.
Related MCP Servers
- AsecurityAlicenseAqualityFacilitates interaction with Elasticsearch clusters by allowing users to perform index operations, document searches, and cluster management via a Model Context Protocol server and natural language commands.Last updated -6178PythonApache 2.0
- AsecurityAlicenseAqualityEnables interaction with esa.io's API through the Model Context Protocol, supporting article search and retrieval with a compliant MCP interface.Last updated -354833TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables LLMs to interact with Elasticsearch clusters, allowing them to manage indices and execute search queries using natural language.Last updated -2JavaScript
- AsecurityAlicenseAqualityConnects agents to Elasticsearch data using the Model Context Protocol, allowing natural language interaction with Elasticsearch indices through MCP Clients like Claude Desktop and Cursor.Last updated -116112TypeScriptMIT License