MCP Elasticsearch Server πŸ”

by sonirico

369 downloads
Not rated
GitHub

About

MCP server connecting AI systems to Elasticsearch clusters

Details

Author
sonirico
Downloads
369
Categories
Database

- Multiple authentication methods (API key or username/password)
- List indices with health status and document counts
- Retrieve field mappings to understand index structure
- Execute complex Elasticsearch queries with aggregations and sorting
- JSON-formatted output with search metadata
- Query execution time tracking

Install by cloning the repository, building with Go, and installing the binary. Configure with the ES_URL environment variable and either an ES_API_KEY or ES_USERNAME/ES_PASSWORD. Run directly or integrate with clients like Claude Desktop or ApMentor by adding a mcpServers entry.

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

search

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

```bash

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.