Elasticsearch MCP Server with multi-version support (ES 5.x-9.x) and comprehensive API access
Elasticsearch MCP Server with multi-version support (ES 5.x-9.x) and comprehensive API access
Valid MCP server (1 strong, 2 medium validity signals). 4 known CVEs in dependencies (0 critical, 3 high severity) Package registry verified. Imported from the Official MCP Registry. Trust signals: trusted author (2/3 approved).
4 files analyzed · 5 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Set these up before or after installing:
Environment variable: ES_URL
Environment variable: ES_API_KEY
Environment variable: ES_USERNAME
Environment variable: ES_PASSWORD
Environment variable: ES_CA_CERT
Environment variable: NODE_TLS_REJECT_UNAUTHORIZED
Environment variable: MAX_TOKEN_CALL
Environment variable: MCP_TRANSPORT
Environment variable: MCP_HTTP_PORT
Environment variable: MCP_HTTP_HOST
Add this to your MCP configuration file:
{
"mcpServers": {
"io-github-tocharianou-elasticsearch": {
"env": {
"ES_URL": "your-es-url-here",
"ES_API_KEY": "your-es-api-key-here",
"ES_CA_CERT": "your-es-ca-cert-here",
"ES_PASSWORD": "your-es-password-here",
"ES_USERNAME": "your-es-username-here",
"MCP_HTTP_HOST": "your-mcp-http-host-here",
"MCP_HTTP_PORT": "your-mcp-http-port-here",
"MCP_TRANSPORT": "your-mcp-transport-here",
"MAX_TOKEN_CALL": "your-max-token-call-here",
"NODE_TLS_REJECT_UNAUTHORIZED": "your-node-tls-reject-unauthorized-here"
},
"args": [
"-y",
"@tocharianou/elasticsearch-mcp"
],
"command": "npx"
}
}
}From the project's GitHub README.
Enhanced Elasticsearch MCP Server Solution - Security & Threat Analysis Focused
This is a professional security-focused solution maintained by TocharianOU. It enables comprehensive interaction with all Elasticsearch APIs, specifically optimized for security analysis, threat detection, and incident investigation. Features include advanced security monitoring, anomaly detection, threat hunting, root cause analysis, and comprehensive audit capabilities.
Key Security Features:
Note: This solution requires a valid Elasticsearch license (trial, platinum, or enterprise) and is designed for security professionals, SOC teams, and threat analysts.
Connect to your Elasticsearch data directly from any MCP Client (such as Claude Desktop) using the Model Context Protocol (MCP). Interact with your Elasticsearch security data through natural language queries for advanced threat analysis and incident response.
⚠️ This project requires your Elasticsearch cluster to have a valid license. If you do not have a license, you can activate a trial license as shown below.
Automatically supports Elasticsearch 5.x - 9.x with intelligent version detection:
| Version | Status | Client | Notes |
|---|---|---|---|
| ES 5.x | ✅ | 5.6.22 | EOL - Basic tools only |
| ES 6.x | ✅ | 6.8.8 | EOL - ILM available (6.6+) |
| ES 7.x | ✅ | 7.17.14 | LTS - Full features |
| ES 8.x | ✅ | 8.19.1 | Recommended - Latest features, ES|QL (8.11+) |
| ES 9.x+ | ✅ | Auto-fallback | Future-ready |
Key Features:
What happens:
Connect → Detect ES version → Load matching client → Register compatible tools
To connect to Elasticsearch with a self-signed certificate or in a test environment, you can set the following environment variable:
NODE_TLS_REJECT_UNAUTHORIZED=0
⚠️ This disables Node.js SSL certificate validation. Use only in development or testing environments. For production, always use a trusted CA certificate.
The Elasticsearch MCP Server supports the following configuration options:
| 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 |
NODE_TLS_REJECT_UNAUTHORIZED | Set to 0 to disable SSL certificate validation | No |
| Environment Variable | Description | Default | Values |
|---|---|---|---|
MCP_TRANSPORT | Transport mode selection | stdio | stdio, http |
MCP_HTTP_PORT | HTTP server port (when using HTTP transport) | 3000 | 1-65535 |
MCP_HTTP_HOST | HTTP server host (when using HTTP transport) | localhost | Any valid host |
Transport Mode Details:
Install globally via NPM
npm install -g @tocharianou/elasticsearch-mcp
Run directly
npx @tocharianou/elasticsearch-mcp
Download release package
.tar.gz file and its checksum files (.sha256 and .sha512)Verify package integrity
shasum -a 256 -c elasticsearch-mcp-v*.tar.gz.sha256
# Should output: elasticsearch-mcp-v*.tar.gz: OK
Extract and use
mkdir elasticsearch-mcp && cd elasticsearch-mcp
tar -xzf ../elasticsearch-mcp-v*.tar.gz
# Run with your Elasticsearch credentials
ES_URL=https://localhost:9200 ES_API_KEY=your-key node dist/index.js
Clone the repository
git clone https://github.com/TocharianOU/elasticsearch-mcp.git
cd elasticsearch-mcp
Install Dependencies
npm install
Build the Project
npm run build
Configure Claude Desktop App
Edit Config and add a new MCP Server with the following configuration:For NPM Installation:
{
"mcpServers": {
"elasticsearch-mcp-server": {
"command": "npx",
"args": [
"@tocharianou/elasticsearch-mcp"
],
"env": {
"ES_URL": "your-elasticsearch-url",
"ES_USERNAME": "elastic",
"ES_PASSWORD": "your_pass",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
}
}
}
}
For Source Installation:
{
"mcpServers": {
"elasticsearch-mcp-server-local": {
"command": "node",
"args": [
"/path/to/your/elasticsearch-mcp/dist/index.js"
],
"env": {
"ES_URL": "your-elasticsearch-url",
"ES_USERNAME": "elastic",
"ES_PASSWORD": "your_pass",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
}
}
}
}
Debugging with MCP Inspector
ES_URL=your-elasticsearch-url ES_USERNAME=elastic ES_PASSWORD=your_pass npm run inspector
This will start the MCP Inspector, allowing you to debug and analyze requests. You should see:
Starting MCP inspector...
Proxy server listening on port 3000
MCP Inspector is up and running at http://localhost:5173
Run the server as a standalone HTTP service for remote access and API integration:
# Start HTTP server (default port 3000)
MCP_TRANSPORT=http \
ES_URL=your-elasticsearch-url \
ES_USERNAME=elastic \
ES_PASSWORD=your_pass \
npx @tocharianou/elasticsearch-mcp
# Or with custom port and host
MCP_TRANSPORT=http \
MCP_HTTP_PORT=9000 \
MCP_HTTP_HOST=0.0.0.0 \
ES_URL=your-elasticsearch-url \
ES_USERNAME=elastic \
ES_PASSWORD=your_pass \
npx @tocharianou/elasticsearch-mcp
HTTP Streamable Mode Features:
http://host:port/mcp endpointhttp://host:port/healthExample HTTP client usage:
// Initialize connection
const response = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'my-client', version: '1.0.0' }
},
id: 1
})
});
const sessionId = response.headers.get('mcp-session-id');
// Subsequent requests include session ID
const toolsResponse = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'mcp-session-id': sessionId
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'tools/list',
params: {},
id: 2
})
});
// Call a tool (e.g., list_indices)
const indicesResponse = await fetch('http://localhost:3000/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'mcp-session-id': sessionId
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'tools/call',
params: {
name: 'list_indices',
arguments: {}
},
id: 3
})
});
| Tool | Description | Min Version |
|---|---|---|
list_indices | List indices with pattern filter, health filter, sorting and token-aware summary | ES 5.x+ |
get_mappings | Get field mappings with flat/tree/raw modes, field filtering and multi-index compare | ES 5.x+ |
es_search | Full Query DSL search with auto-highlight on text/vector fields | ES 5.x+ |
execute_es_api | Execute any ES REST endpoint directly (GET/POST/PUT/DELETE/HEAD) | ES 5.x+ |
get_shards | Shard info with health analysis, problem detection and recommendations | ES 5.x+ |
list_data_streams | List and analyze Data Streams with ILM info and backing index details | ES 7.9+ |
esql_query | Execute ES|QL pipe-based queries with tabular output and parameterised support | ES 8.11+ |
Tools not supported by your cluster version are automatically skipped at startup.
esql_query)ES|QL is Elasticsearch's modern pipe-based query language, ideal for analytics and data exploration without complex JSON DSL.
Example queries:
FROM logs-* | WHERE level == "error" | STATS count = COUNT(*) BY service | SORT count DESC | LIMIT 20
FROM metrics-* | WHERE @timestamp > NOW() - 1 hour | STATS avg_cpu = AVG(cpu.usage) BY host.name
FROM auditbeat-* | WHERE event.action == "user_login" AND event.outcome == "failure" | LIMIT 50
Parameters:
query — the ES|QL string (required)params — positional parameters replacing ? placeholders (optional)include_types — include column type info in output (optional, default false)break_token_rule — bypass token limit for large results (optional, default false)Automatically registered only on ES 8.11+ clusters.
We welcome contributions from the community! For details on how to contribute, please see Contributing Guidelines.
[!TIP] Here are security-focused queries you can try with your MCP Client.
Threat Detection:
Root Cause Analysis:
Threat Intelligence:
Real-time Monitoring:
[!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.
When downloading release packages, always verify checksums to ensure integrity:
# Verify SHA256 checksum
shasum -a 256 -c elasticsearch-mcp-vX.Y.Z.tar.gz.sha256
# Verify SHA512 checksum
shasum -a 512 -c elasticsearch-mcp-vX.Y.Z.tar.gz.sha512
This protects against:
You can create a dedicated Elasticsearch API key with minimal permissions to control access to your data:
{
"name": "es-mcp-server-access",
"role_descriptors": {
"mcp_server_role": {
"cluster": [
"monitor"
],
"indices": [
{
"names": [
"index-1",
"index-2",
"index-pattern-*"
],
"privileges": [
"read",
"view_index_metadata"
]
}
]
}
}
}
This project is licensed under the Apache License 2.0.
If you encounter issues, feel free to open an issue on the GitHub repository.
If your Elasticsearch cluster does not have a valid license, you can activate a 30-day trial license with the following command:
curl -X POST -u elastic:your_password \
-k "https://your-es-host:9200/_license/start_trial?acknowledge=true"
your_password and your-es-host with your actual credentials and host.Note: This project will not start if your cluster does not have a valid license (trial, platinum, enterprice etc.).
Be the first to review this server!
by Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
by mcp-marketplace · Developer Tools
Create, build, and publish Python MCP servers to PyPI — conversationally.
by Microsoft · Content & Media
Convert files (PDF, Word, Excel, images, audio) to Markdown for LLM consumption
by mcp-marketplace · Developer Tools
Scaffold, build, and publish TypeScript MCP servers to npm — conversationally
by mcp-marketplace · Finance
Free stock data and market news for any MCP-compatible AI assistant.
by Taylorwilsdon · Productivity
Control Gmail, Calendar, Docs, Sheets, Drive, and more from your AI