Elasticsearch MCP Server
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Provides access to Elasticsearch indices, allowing users to list indices, inspect field mappings, and execute search queries using full Query DSL capabilities with automatic highlighting.
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.
Features
- List Indices: View all available Elasticsearch indices
- Get Mappings: Inspect field mappings for specific indices
- Search: Execute Elasticsearch queries using full Query DSL capabilities with automatic highlighting
Prerequisites
- An Elasticsearch instance
- Elasticsearch API key with appropriate permissions
- 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.
- 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:
Copy - 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
Developing Locally
Note
If you want to modify or extend the MCP Server, follow these local development steps.
- Use the correct Node.js versionCopy
- Install DependenciesCopy
- Build the ProjectCopy
- 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:
Copy - Debugging with MCP InspectorThis will start the MCP Inspector, allowing you to debug and analyze requests. Ensure that the necessary environment variables (Copy
ES_URL
andES_API_KEY
) are exposed when starting the inspector. You should see output similar to:Copy
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:
Troubleshooting
- Ensure your MCP configuration is correct.
- Verify that your Elasticsearch URL is accessible from your machine.
- Check that your API key has the necessary permissions.
- Look at the terminal output for error messages.
If you encounter issues, feel free to open an issue on the GitHub repository.
You must be authenticated.
Connects Claude and other MCP clients to Elasticsearch data, allowing users to interact with their Elasticsearch indices through natural language conversations.