Provides a comprehensive set of tools for security management, search operations, index management, and cluster monitoring within an Elasticsearch instance, allowing for management of users, roles, API keys, and execution of complex queries.
Provides a comprehensive set of tools for security management, search operations, index management, and cluster monitoring within an Elasticsearch instance, allowing for management of users, roles, API keys, and execution of complex queries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Elastic MCP Servershow me the health status of my elasticsearch cluster"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Elastic MCP Server
A comprehensive MCP (Model Context Protocol) server for Elasticsearch with InfoSec-focused tools for security management, search operations, index management, and cluster monitoring.
Features
Security Management: Users, roles, API keys, privileges
Search & Query: Full-text search, ES|QL, aggregations
Index Operations: List, create, delete, mappings, settings
Cluster Monitoring: Health, stats, nodes, shards
Cross-Platform: Works on Windows, macOS, and Linux
Quick Start
1. Install Dependencies
2. Configure Environment
Copy .env.example to .env and configure your Elasticsearch connection:
Edit .env with your credentials:
3. Build
4. Run
Configuration
Environment Variables
Variable | Required | Description |
| Yes | Elasticsearch cluster URL |
| Yes* | Pre-encoded API key (base64) |
| Yes* | API key ID (alternative to encoded) |
| Yes* | API key secret (use with ID) |
| Yes* | Basic auth username |
| Yes* | Basic auth password |
| No | Skip SSL verification (default: false) |
| No | Request timeout in ms (default: 30000) |
| No | Logging level (default: info) |
*One authentication method is required: encoded API key, ID+secret, or username+password.
Authentication Methods
API Key (Recommended)
Use the pre-encoded API key from the Elasticsearch API key creation response:
Separate ID and Secret
If you have the raw ID and secret:
Basic Auth (Not Recommended)
Available Tools
Search Tools (5 tools)
Tool | Description |
| Execute search queries using Elasticsearch Query DSL |
| Execute ES|QL queries for data analysis |
| Retrieve a specific document by ID |
| Count documents matching a query |
| Execute multiple search queries in one request |
Security Tools (12 tools)
Tool | Description |
| List all users in the security realm |
| Get detailed user information |
| Create a new user with roles |
| Delete a user |
| Enable or disable a user |
| List all defined roles |
| Get role details |
| Create or update a role |
| Delete a role |
| List API keys |
| Create a new API key |
| Invalidate API keys |
| Get current user privileges |
| Check specific privileges |
| Get current authenticated user info |
Index Tools (9 tools)
Tool | Description |
| List all indices with health and stats |
| Get index details |
| Get field mappings |
| Get index settings |
| Create a new index |
| Delete an index (requires confirmation) |
| Refresh an index |
| Get index statistics |
| Get index aliases |
Cluster Tools (8 tools)
Tool | Description |
| Get cluster health status |
| Get comprehensive cluster statistics |
| Get basic cluster info and version |
| Get node information |
| Get node statistics |
| List pending cluster tasks |
| Explain shard allocation |
| Get shard allocation details |
Usage Examples
Search for Security Events
List All Users
Check Cluster Health
Create an API Key
Development
Run Tests
Run Tests with Coverage
Lint
Watch Mode
Claude Desktop Integration
macOS / Linux
Config location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or ~/.config/claude/claude_desktop_config.json (Linux)
Windows
Config location: %APPDATA%\Claude\claude_desktop_config.json
Windows Notes:
Use double backslashes (
\\) in JSON paths, or forward slashes (/) which also workEnsure Node.js is installed and available in your PATH
Run
npm installandnpm run buildbefore first use
Security Considerations
API keys are never logged or exposed in responses
All credentials must be provided via environment variables
SSL certificate verification is enabled by default
The
delete_indextool requires explicit confirmationCreated API keys return the encoded value but not the raw secret
License
MIT