MCP Elasticsearch Server

MCP Elasticsearch Server

mcp-elasticsearch•bysonirico

A Model Context Protocol server that gives AI assistants and other MCP clients the ability to query Elasticsearch clusters through a standardized interface.

License: MIT License•Runtime: Awaiting documentation review•Category: databases storage

WHAT IT DOES

  • •Lists Elasticsearch indices with optional pattern filtering, returning total index count and index details such as name, health, status, document count, and size.
  • •Retrieves complete field mappings for one or more Elasticsearch indices to reveal their schema structure.
  • •Executes Elasticsearch search queries with full DSL support, including aggregations, sorting, and configurable result size and total hit tracking.
  • •Supports both API key authentication and username/password basic authentication against Elasticsearch clusters.

BEST FOR

  • •AI assistants that need to explore and inspect Elasticsearch index structures and mappings.
  • •Running log searches against Elasticsearch indices through an MCP client.
  • •Performing advanced Elasticsearch searches with aggregations and sorting from an AI assistant.

ABOUT MCP-ELASTICSEARCH

MCP Elasticsearch Server is cataloged as an MCP server attributed to sonirico. A Model Context Protocol server that gives AI assistants and other MCP clients the ability to query Elasticsearch clusters through a standardized interface. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP Elasticsearch Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What authentication methods does the server support for connecting to Elasticsearch?

It supports API key authentication via ES_API_KEY, or basic authentication using both ES_USERNAME and ES_PASSWORD.

How large a result set can a search return?

The size parameter defaults to 10 documents and accepts a maximum of 10000.

Upstream README

View this exact version on GitHub

README.md · 5d042c3e97fd · Fetched 2026-11-13 12:34:47 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

MCP Elasticsearch Server 🔍

A Model Context Protocol (MCP) server that provides Elasticsearch integration capabilities to AI assistants and other MCP clients. This server enables querying Elasticsearch clusters through a standardized interface.

Features

  • 🔐 Multiple Authentication Methods: Supports both API key and username/password authentication
  • 📊 Index Management: List indices with health status and document counts
  • 🗺️ Schema Discovery: Retrieve field mappings to understand index structure
  • 🔍 Advanced Search: Execute complex Elasticsearch queries with aggregations and sorting
  • 📋 Structured Responses: JSON-formatted output with search metadata
  • ⚡ Performance Monitoring: Query execution time tracking
  • 🎯 Context Aware: Supports search execution with proper context cancellation

Tools

list_indices

List all Elasticsearch indices with optional pattern filtering.

Parameters:

  • pattern (string, optional): Index pattern filter (default: "*")

Returns:

  • Total index count
  • Index details (name, health, status, document count, size)

get_index_mappings

Get field mappings for one or more Elasticsearch indices.

Parameters:

  • index (string, required): Index name or pattern

Returns:

  • Complete field mappings for the specified indices

Execute Elasticsearch search queries with full DSL support.

Parameters:

  • index (string, required): Index name or pattern to search
  • query (string, optional): Elasticsearch query DSL as JSON (default: "{}")
  • size (number, optional): Maximum documents to return (default: 10, max: 10000)
  • sort (string, optional): Sort specification as JSON
  • track_total_hits (boolean, optional): Track total hit count (default: true)

Returns:

  • Search results with hits, aggregations, and metadata

Configuration

Environment Variables

Elasticsearch Configuration

  • ES_URL: Elasticsearch cluster URL (required)
  • ES_API_KEY: API key for authentication (optional)
  • ES_USERNAME: Username for basic authentication (optional)
  • ES_PASSWORD: Password for basic authentication (optional)

Server Configuration

  • MCP_ES_SERVER_NAME: Server name (default: "mcp-elasticsearch 🔍")

Logging Configuration

  • MCP_ES_LOG_LEVEL: Log level (debug, info, warn, error, fatal)
  • MCP_ES_LOG_FORMAT: Log format (json, console)
  • MCP_ES_LOG_OUTPUT: Log output (stdout, stderr)

Authentication

You must provide either:

  1. API Key authentication: Set ES_API_KEY
  2. Basic authentication: Set both ES_USERNAME and ES_PASSWORD

Installation

# Clone and build
git clone <repository>
cd mcp-elasticsearch
go mod download
go build -o bin/mcp-elasticsearch .

# Install to system
sudo install bin/mcp-elasticsearch /usr/local/bin/

Usage

Direct Execution

# With API key
ES_URL="https://your-cluster.com" ES_API_KEY="your-api-key" mcp-elasticsearch

# With basic auth
ES_URL="https://your-cluster.com" ES_USERNAME="user" ES_PASSWORD="pass" mcp-elasticsearch

# With custom logging
ES_URL="https://your-cluster.com" ES_API_KEY="key" MCP_ES_LOG_LEVEL=debug mcp-elasticsearch

Integration with Claude Desktop

Add to your Claude configuration:

{
  "mcpServers": {
    "elasticsearch": {
      "command": "mcp-elasticsearch",
      "env": {
        "ES_URL": "https://your-cluster.com",
        "ES_API_KEY": "your-api-key",
        "MCP_ES_LOG_LEVEL": "info"
      }
    }
  }
}

Integration with ApMentor

Update your config.json:

{
  "mcpServers": {
    "elasticsearch-go": {
      "command": "/usr/local/bin/mcp-elasticsearch",
      "env": {
        "ES_URL": "https://atani.es.eu-west-1.aws.found.io",
        "ES_API_KEY": "your-api-key",
        "MCP_ES_LOG_LEVEL": "info"
      }
    }
  }
}

Example Queries

List All Indices

{
  "tool": "list_indices",
  "parameters": {
    "pattern": "*"
  }
}

List Log Indices Only

{
  "tool": "list_indices", 
  "parameters": {
    "pattern": "logs-*"
  }
}

Get Index Mappings

{
  "tool": "get_index_mappings",
  "parameters": {
    "index": "logs-apm.error-*"
  }
}
{
  "tool": "search",
  "parameters": {
    "index": "logs-*",
    "query": "{\"match\": {\"service.name\": \"broker-api-b2b\"}}",
    "size": 50
  }
}

Complex Search with Aggregations

{
  "tool": "search",
  "parameters": {
    "index": "logs-*",
    "query": "{\"bool\": {\"must\": [{\"term\": {\"service.name\": \"broker-api-b2b\"}}, {\"range\": {\"@timestamp\": {\"gte\": \"now-24h\"}}}]}}",
    "size": 0,
    "aggs": "{\"error_types\": {\"terms\": {\"field\": \"error.type.keyword\", \"size\": 10}}}"
  }
}

Search with Sorting

{
  "tool": "search",
  "parameters": {
    "index": "logs-*",
    "query": "{\"match\": {\"log.level\": \"ERROR\"}}",
    "sort": "[{\"@timestamp\": {\"order\": \"desc\"}}]",
    "size": 20
  }
}

Development

# Install dependencies
go mod download

# Format code
gofmt -w .

# Run tests
go test -v ./...

# Build
go build -o bin/mcp-elasticsearch .

# Run with debug logging
MCP_ES_LOG_LEVEL=debug go run .

Error Handling

The server provides detailed error messages for common issues:

  • Authentication failures: Check your API key or credentials
  • Index not found: Verify index names and patterns
  • Query syntax errors: Validate your Elasticsearch query JSON
  • Connection issues: Ensure Elasticsearch is accessible

Security Considerations

  • Store API keys and credentials securely
  • Use environment variables for sensitive configuration
  • Consider network security for Elasticsearch access
  • Monitor query patterns and resource usage

License

MIT License - See LICENSE file for details.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP Elasticsearch Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-elasticsearch)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related databases storage MCP Servers

Alternative and complementary servers in the same category

View all in databases storage →
AIStor MCP server
mcp-server-aistor•minio

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

Repository stats unavailable
Databases & Storage
InfluxDB v2 MCP Server
influxdb-mcp-server•idoru

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.

Repository stats unavailable
Databases & Storage