Skip to main content
Glama
rishab2404

Elasticsearch MCP Server

by rishab2404

Elasticsearch MCP Server

This repository contains experimental features intended for research and evaluation and are not production-ready.

Connect to your Elasticsearch data directly from any MCP Client (like Claude Desktop) using the Model Context Protocol (MCP).

This server connects agents to your Elasticsearch data using the Model Context Protocol. It allows you to interact with your Elasticsearch indices through natural language conversations.

Available Tools

  • list_indices: List all available Elasticsearch indices

  • get_mappings: Get field mappings for a specific Elasticsearch index

  • search: Perform an Elasticsearch search with the provided query DSL

  • get_shards: Get shard information for all or specific indices

Related MCP server: Elasticsearch MCP Server

Prerequisites

  • An Elasticsearch instance

  • Elasticsearch authentication credentials (API key or username/password)

  • MCP Client (e.g. Claude Desktop)

Demo

https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c

Installation & Setup

Using the Published NPM Package

TIP

The easiest way to use Elasticsearch MCP Server is through the published npm package.

  1. Configure MCP Client

    • Open your MCP Client. See the list of MCP Clients, here we are configuring Claude Desktop.

    • Go to Settings > Developer > MCP Servers

    • Click Edit Config and add a new MCP Server with the following configuration:

    {
      "mcpServers": {
        "elasticsearch-mcp-server": {
          "command": "npx",
          "args": [
            "-y",
            "@elastic/mcp-server-elasticsearch"
          ],
          "env": {
            "ES_URL": "your-elasticsearch-url",
            "ES_API_KEY": "your-api-key"
          }
        }
      }
    }
  2. Start a Conversation

    • Open a new conversation in your MCP Client

    • The MCP server should connect automatically

    • You can now ask questions about your Elasticsearch data

Configuration Options

The Elasticsearch MCP Server supports configuration options to connect to your Elasticsearch:

NOTE

You must provide either an API key or both username and password for authentication.

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

Developing Locally

NOTE

If you want to modify or extend the MCP Server, follow these local development steps.

  1. Use the correct Node.js version

    nvm use
  2. Install Dependencies

    npm install
  3. Build the Project

    npm run build
  4. Run locally in Claude Desktop App

    • Open Claude Desktop App

    • Go to Settings > Developer > MCP Servers

    • Click Edit Config and add a new MCP Server with the following configuration:

    {
      "mcpServers": {
        "elasticsearch-mcp-server-local": {
          "command": "node",
          "args": [
            "/path/to/your/project/dist/index.js"
          ],
          "env": {
            "ES_URL": "your-elasticsearch-url",
            "ES_API_KEY": "your-api-key"
          }
        }
      }
    }
  5. Debugging with MCP Inspector

    ES_URL=your-elasticsearch-url ES_API_KEY=your-api-key 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 šŸš€

Contributing

We welcome contributions from the community! For details on how to contribute, please see Contributing Guidelines.

Example Questions

TIP

Here are some natural language queries you can try with your MCP Client.

  • "What indices do I have in my Elasticsearch cluster?"

  • "Show me the field mappings for the 'products' index."

  • "Find all orders over $500 from last month."

  • "Which products received the most 5-star reviews?"

How It Works

  1. The MCP Client analyzes your request and determines which Elasticsearch operations are needed.

  2. The MCP server carries out these operations (listing indices, fetching mappings, performing searches).

  3. The MCP Client processes the results and presents them in a user-friendly format.

Security Best Practices

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.

You can create a dedicated Elasticsearch API key with minimal permissions to control access to your data:

POST /_security/api_key
{
  "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"
          ]
        }
      ]
    }
  }
}

License

This project is licensed under the Apache License 2.0.

Troubleshooting

  • Ensure your MCP configuration is correct.

  • Verify that your Elasticsearch URL is accessible from your machine.

  • Check that your authentication credentials (API key or username/password) have the necessary permissions.

  • If using SSL/TLS with a custom CA, verify that the certificate path is correct and the file is readable.

  • Look at the terminal output for error messages.

If you encounter issues, feel free to open an issue on the GitHub repository.

Available Tools

4 tools
get_mappingsB

Get field mappings for a specific Elasticsearch index

ParametersJSON Schema
NameRequiredDescriptionDefault
indexYesName of the Elasticsearch index to get mappings for

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves field mappings but doesn't describe traits like whether it's read-only (implied by 'Get'), error handling for non-existent indices, rate limits, or response format. This leaves significant gaps for a tool with no structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for a simple tool, making it highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavior, usage context, or output, which would be needed for higher completeness in the absence of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'index' fully documented in the schema. The description adds no additional meaning beyond what the schema provides (e.g., no extra context about index naming conventions or examples), so it meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('field mappings for a specific Elasticsearch index'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'list_indices' or 'search', which might also involve index operations, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'list_indices' or 'search'. It lacks context about prerequisites (e.g., index existence) or exclusions, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_shardsC

Get shard information for all or specific indices

ParametersJSON Schema
NameRequiredDescriptionDefault
indexNoOptional index name to get shard information for

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects like whether this is a read-only operation, what format the shard information returns, whether it includes cluster health status, or any performance considerations for large indices.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality without unnecessary words. It's appropriately sized for a simple tool with one optional parameter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what shard information includes (primary/replica status, node assignments, size, etc.), doesn't mention error conditions, and provides no context about how this tool fits into broader index management workflows with the sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the optional 'index' parameter. The description adds minimal value by mentioning 'specific indices' which aligns with the parameter, but doesn't provide additional context about index naming conventions, wildcard support, or what happens when no index is specified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('shard information'), and specifies scope options ('for all or specific indices'). It doesn't explicitly differentiate from sibling tools like get_mappings or list_indices, but the focus on shard information provides reasonable distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like list_indices or get_mappings. It mentions scope options but doesn't explain when to filter by index versus getting all indices, or how this tool relates to other index-related operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_indicesC

List all available Elasticsearch indices

ParametersJSON Schema
NameRequiredDescriptionDefault
indexPatternYesIndex pattern of Elasticsearch indices to list

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('List all available Elasticsearch indices') but doesn't describe what 'available' means, whether it's a read-only operation, if there are rate limits, or what the output format looks like. This leaves significant gaps for a tool that interacts with a database system.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple tool and front-loaded with the core action, making it easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of interacting with Elasticsearch indices and the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'available' entails, how results are structured, or potential errors, which are crucial for an agent to use the tool effectively in a real-world context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'indexPattern' fully documented in the schema. The description doesn't add any meaning beyond what the schema provides, such as explaining pattern syntax or examples. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('all available Elasticsearch indices'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_mappings' or 'get_shards' which might also involve listing indices with different scopes or details.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_mappings' or 'search'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updates
    • First observedget_mappings
    • First observedget_shards
    • First observedlist_indices
    • First observedsearch

TDQS

B3.2/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose targeting different aspects of Elasticsearch operations: get_mappings for field structure, get_shards for infrastructure details, list_indices for inventory, and search for querying data. There is no overlap or ambiguity between these functions.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern (get_mappings, get_shards, list_indices, search) with clear, descriptive verbs. The naming is uniform and predictable throughout the set.

Tool Count3/5

With only 4 tools, the set feels thin for an Elasticsearch server, lacking essential operations like create/update/delete indices or documents. While the tools are well-scoped, the count is borderline low for the domain's typical scope.

Completeness2/5

The tool surface has significant gaps for an Elasticsearch domain: it includes read-only operations (get, list, search) but completely misses write operations (e.g., index, update, delete), configuration management, or cluster operations. This will likely cause agent failures in common workflows.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Facilitates interaction with Elasticsearch clusters by allowing users to perform index operations, document searches, and cluster management via a Model Context Protocol server and natural language commands.
    20
    305
    Apache 2.0
  • A
    license
    B
    quality
    D
    maintenance
    Connects Claude and other MCP clients to Elasticsearch data, allowing users to interact with their Elasticsearch indices through natural language conversations.
    3
    2,174
    709
    Apache 2.0
  • A
    license
    B
    quality
    C
    maintenance
    Connects agents to Elasticsearch data using the Model Context Protocol, allowing natural language interaction with Elasticsearch indices through MCP Clients like Claude Desktop and Cursor.
    11
    64
    23
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Connects agents to Elasticsearch data using the Model Context Protocol, allowing natural language interaction with Elasticsearch indices through tools for listing indices, getting field mappings, performing searches, and viewing shard information.
    2,174
    Apache 2.0

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/rishab2404/mcp_es'

If you have feedback or need assistance with the MCP directory API, please join our Discord server