Elasticsearch MCP Server AI
Allows AI agents to interact with an Elasticsearch cluster for searching logs, APM traces, system metrics, and performing cluster management tasks.
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., "@Elasticsearch MCP Server AIanalyze the APM trace trace-abc123 for performance bottlenecks"
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.
๐ Elasticsearch MCP Server AI
A Model Context Protocol (MCP) server that transforms your Elasticsearch cluster into an AI-powered observability engine.
Enables natural language interaction for analyzing logs, APM traces (with waterfall and RCA), and system metrics โ delivering deep performance and troubleshooting insights with minimal effort.
๐ก Demo Examples Elasticsearch MCP Server AI
Demo APM Waterfall Trace Performance Analysis, how to analyze application traces using waterfall visualization for in-depth performance insights. Quickly identify bottlenecks, latency issues, and service dependencies in real APM data.

Demo RCA APM (Root Cause Analysis), Demonstrates how to automatically identify the underlying causes of errors and performance issues in APM traces, providing actionable insights for rapid troubleshooting.

Demo Perform performance analysis by APM service, Analyze and compare the performance metrics for each APM service, identifying latency, throughput, and resource bottlenecks across your architecture.

Related MCP server: elasticsearch-mcp
๐ฏ Core Value: Advanced APM Analysis
This MCP server transforms your Elasticsearch cluster into a powerful AI-driven APM analysis platform. The key differentiator is our specialized APM analysis tools that provide automated insights impossible with basic Elasticsearch queries:
๐ฌ APM Waterfall Analysis - analyzeTracePerformance
Complete waterfall analysis of APM traces with visual timeline reconstruction
Automatic correlation with system errors and infrastructure metrics
Performance optimization recommendations based on detected patterns
Deep bottleneck detection across microservices and dependencies
Perfect for: Latency debugging, performance optimization, dependency analysis
๐ฏ APM Root Cause Analysis (RCA) - findErrorPatterns
Temporal error analysis with automatic aggregations and pattern detection
Intelligent Root Cause Analysis with specific, actionable recommendations
Anomaly detection in error frequency, types, and service impact
Automated correlation between error spikes and system events
Perfect for: Proactive troubleshooting, stability analysis, incident prevention
๐ Business Event Correlation - correlateBusinessEvents
Complete user journey reconstruction across all system touchpoints
Cross-index correlation (APM + logs + metrics + business events)
Timeline analysis of related events with business impact assessment
End-to-end transaction tracking from user action to system response
Perfect for: Business impact analysis, critical flow debugging, customer experience optimization
๐ก These tools implement specialized logic that's impossible with basic Elasticsearch queries, providing deep insights and automated analysis for SRE and DevOps teams. They represent the core value proposition of this MCP server.
๐ฏ What is this MCP Server?
This MCP server converts your Elasticsearch cluster into a powerful tool for AI assistants, enabling:
๐ Intelligent searches in logs, metrics, and documents
๐ APM analysis to detect errors and performance issues
๐ฅ๏ธ System monitoring with CPU, memory, and disk metrics
๐ง Automatic diagnosis of application problems
๐ ๏ธ Available Tools (25 Tools)
๐ง Optimized APM Tools โญ CORE VALUE
Tool | Description | Main Parameters |
| Complete performance analysis with waterfall and correlations |
|
| Error pattern detection with temporal analysis and RCA |
|
| Business event correlation to reconstruct user journeys |
|
๐ Search and Queries
Tool | Description | Main Parameters |
| Search documents across all indices with query string |
|
| Search documents in specific indices |
|
| Count documents globally with optional filters |
|
| Count documents in a specific index |
|
| Get a specific document by its ID |
|
๐ Cluster Information
Tool | Description | Main Parameters |
| Basic cluster information (name, version, UUID) | None |
| Cluster health status with detailed metrics |
|
| Complete cluster statistics for monitoring | None |
| Statistics of all nodes (CPU, memory, disk) |
|
| Active threads and JVM statistics for troubleshooting |
|
๐๏ธ Index Management
Tool | Description | Main Parameters |
| Compact list of indices with status information |
|
| Detailed information of a specific index |
|
| Field mapping and data types of an index |
|
| Configuration and settings of an index |
|
๐จ APM and Monitoring
Tool | Description | Main Parameters |
| Search traces, transactions, and spans in APM data |
|
| Count documents in APM indices (errors, traces, metrics) |
|
| Search errors and exceptions specifically in APM |
|
| Analyze performance metrics and slow transactions |
|
| System metrics (CPU, memory, disk) from Metricbeat |
|
| Search application logs from Filebeat and other sources |
|
| Search logs specifically from Filebeat indices |
|
| Elasticsearch Watcher alert history |
|
๐ Common Parameters
๐ Search Parameters
q(query): Elasticsearch query string (e.g.,"error AND @timestamp:>now-1h")size: Number of results (default: 10, recommended max: 100)from: Offset for pagination (default: 0)sort: Sorting (e.g.,"@timestamp:desc","_score:desc")_source: Specific fields to include (e.g.,"@timestamp,message,service.name")timeout: Search timeout (default: "30s")
๐ Temporal Parameters
time_range: Time range (e.g.,"now-1h","now-24h","now-7d")time_window: Time window (e.g.,"30m","1h","5m")@timestamp: Temporal filter in query (e.g.,"@timestamp:>now-2h")
๐ท๏ธ Filtering Parameters
index: Specific index or pattern (e.g.,"logs-2024","logs-apm.error-*")service_name: APM service name (e.g.,"api-users","servicio-local")error_type: Error type (e.g.,"ConnectionError","TimeoutError")level: Detail level (e.g.,"cluster","indices","shards")
๐ง Format Parameters
format: Output format (e.g.,"json","yaml","text")v: Verbose output with headers (true/false)h: Specific columns to display (e.g.,"index,health,status")s: Columns to sort by (e.g.,"index:desc")
๐ Installation
๐ฆ From Source Code (Recommended)
Option 1: Simple Installation (Recommended for users)
# Clone repository
git clone https://github.com/byviz/mcp-server-elasticsearch-ai.git
cd elasticsearch-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install ALL dependencies (production + development)
pip install -r requirements-all.txt
# Install package in development mode
pip install -e .Option 2: Minimal Installation (Run only)
# If you only want to run the server (no development)
pip install -r requirements.txt
pip install -e .Option 3: Using pyproject.toml (Advanced)
# Clone repository
git clone https://github.com/byviz/elasticsearch-mcp-ai.git
cd elasticsearch-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install directly from pyproject.toml
pip install -e .๐ Dependencies Files Summary
File | Description | When to use |
| All dependencies (production + development) | โ Recommended for most users |
| Only minimal dependencies to run | Only if you want very lightweight installation |
| Only development dependencies | For contributors who already have basics |
| Modern Python configuration | For advanced users with modern tools |
๐ Verify Installation
# Verify package was installed correctly
python -c "import elasticsearch_mcp; print('โ
Installation successful')"
# Check version
python -m elasticsearch_mcp --versionโ๏ธ Configuration
๐ Required Environment Variables
Elasticsearch
# Cluster connection
ELASTICSEARCH_URL="https://your-cluster.es.io:9243"
# Authentication (choose one option)
ELASTICSEARCH_USERNAME="your-username"
ELASTICSEARCH_PASSWORD="your-password"
# Or alternatively:
# ELASTICSEARCH_API_KEY="your-api-key"๐ง Optional Variables
Advanced Elasticsearch
ELASTICSEARCH_TIMEOUT=30 # Timeout in seconds
ELASTICSEARCH_VERIFY_CERTS=true # Verify SSL certificates
ELASTICSEARCH_CA_CERTS="/path/to/ca.crt" # CA certificates
ELASTICSEARCH_CLIENT_CERT="/path/to/client.crt" # Client certificate
ELASTICSEARCH_CLIENT_KEY="/path/to/client.key" # Private keyMCP Server
MCP_TRANSPORT=stdio # Transport (stdio/http/sse)
MCP_PORT=8000 # Port for HTTP/SSE
MCP_LOG_LEVEL=INFO # Logging level
MCP_ENABLE_SECURITY_FILTERING=true # Security filtering๐ Usage
๐ Quick Configuration
Create configuration file:
cp config.env.example .envEdit variables:
# Elasticsearch
ELASTICSEARCH_URL=https://your-cluster.es.io:9243
ELASTICSEARCH_USERNAME=your-username
ELASTICSEARCH_PASSWORD=your-passwordRun the server:
source .env
python -m elasticsearch_mcp๐ฏ Integration with Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"elasticsearch": {
"command": "python",
"args": ["-m", "elasticsearch_mcp"],
"env": {
"ELASTICSEARCH_URL": "https://your-cluster.es.io:9243",
"ELASTICSEARCH_USERNAME": "your-username",
"ELASTICSEARCH_PASSWORD": "your-password"
}
}
}
}๐ Security
By default, the server runs with security filtering enabled (MCP_ENABLE_SECURITY_FILTERING=true), which restricts operations to read-only.
โ Allowed Operations
Searches and queries (GET, POST for searches)
Reading mappings, configurations, and statistics
APM analysis and metrics
Cluster and node information
Data visualization
โ Blocked Operations
Creating, modifying, or deleting indices
Indexing, updating, or deleting documents
Modifying cluster configurations
Any destructive operations
๐ Usage Examples
๐ Basic Search
"Search for documents containing 'error' in the last 30 minutes"
โ Use searchAllIndices with q="error AND @timestamp:>now-30m"
"Count how many documents are in the 'logs-2024' index"
โ Use countDocumentsInIndex with index="logs-2024"
๐ Cluster Monitoring
"Is the cluster working well?"
โ Use getClusterHealth to check status (green/yellow/red)
"How many nodes does the cluster have and how much memory do they use?"
โ Use getNodeStats with metric="os,jvm" for detailed metrics
"Show basic cluster information"
โ Use getClusterInfo for name, version, and UUID๐๏ธ Index Management
"List all indices with their health status"
โ Use getCatIndices with format="json" and v=true
"What fields does the 'products' index have?"
โ Use getMapping with index="products" to see structure
"What is the configuration of the 'logs-app' index?"
โ Use getSettings with index="logs-app"๐จ APM and Troubleshooting
"Search for errors in the 'api-users' service from the last 2 hours"
โ Use searchAPMErrors with q="service.name:api-users AND @timestamp:>now-2h"
"What are the slowest transactions?"
โ Use searchAPMPerformance with sort="transaction.duration.us:desc"
"Analyze trace ID '430dbab7a0e0322274f076569cdc0c3d'"
โ Use analyzeTracePerformance with trace_id="430dbab7a0e0322274f076569cdc0c3d"
"Find ConnectionError patterns"
โ Use findErrorPatterns with error_type="ConnectionError"๐ฅ๏ธ System Metrics
"Show CPU usage from the last 5 minutes"
โ Use searchSystemMetrics with q="metricset.name:cpu AND @timestamp:>now-5m"
"Search for ERROR level logs"
โ Use searchLogData with q="log.level:ERROR"
"Check Watcher alerts from the last 24 hours"
โ Use searchWatcherAlerts with q="@timestamp:>now-24h"๐ง Advanced Analysis
"Find error patterns in servicio-local"
โ Use findErrorPatterns with service_name="servicio-local" and time_range="now-1h"๐ก๏ธ Troubleshooting
โ Connection Error
ERROR - Connection failedSolution: Verify ELASTICSEARCH_URL and credentials
โ Authentication Error
ERROR - Authentication failedSolution: Verify ELASTICSEARCH_USERNAME/PASSWORD or ELASTICSEARCH_API_KEY
โ Certificate Error
ERROR - SSL verification failedSolution: Configure ELASTICSEARCH_VERIFY_CERTS=false or provide certificates
๐ License
Apache 2.0 - see LICENSE file for details
๐ค Contributions
Contributions are welcome! Please:
Fork the project
Create a feature branch
Commit your changes
Push to the branch
Open a Pull Request
๐ Support
Need help, have questions, or want to suggest new features?
Join our growing community! Open an issue or contact us โ we're here to help you get the most out of AI-powered Elasticsearch.
Ivรกn Frรญas Molina
Elastic & Byviz
- ๐ง ivan.frias@elastic.co
- ๐ง ivan.frias@byviz.com
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/byviz/mcp-server-elasticsearch-ai'
If you have feedback or need assistance with the MCP directory API, please join our Discord server