Skip to main content
MCP server CX Codex

Elasticsearch — Claude Code MCP server

Connects an Elasticsearch cluster to an AI agent for data queries, field checks, and security event analysis.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env ES_URL=<ES_URL> --env ES_API_KEY=<ES_API_KEY> --env ES_USERNAME=<ES_USERNAME> --env ES_PASSWORD=<ES_PASSWORD> --env ES_CA_CERT=<ES_CA_CERT> --transport stdio elasticsearch -- npx -y @tocharianou/elasticsearch-mcp
Open on GitHub

What Elasticsearch does

This MCP server gives an agent access to Elasticsearch APIs through natural-language requests. It detects Elasticsearch versions from 5.x through 9.x, loads the matching client, and registers tools that the cluster can support.

A query harness checks requested fields against the live cluster before a query runs. It can correct some mapping mistakes, suggest real fields after an error, and let a call bypass validation with skip_lint for runtime fields. Setup requires an Elasticsearch instance and credentials: ES_API_KEY, or ES_USERNAME with ES_PASSWORD. The connection cannot start without ES_URL.

What it helps with

  • search Elasticsearch indexes for security events
  • validate field names before sending a query
  • investigate failed login activity
  • trace related events during an incident

Example prompts for the agent

  • Find failed logins by user in Elasticsearch and show which fields the query used.
  • Check this index query against the live mappings and fix an unnecessary .keyword suffix.
  • Investigate these security events and connect them into an attack chain.

How to install Elasticsearch

Platform CLI

claude mcp add --env ES_URL=<ES_URL> --env ES_API_KEY=<ES_API_KEY> --env ES_USERNAME=<ES_USERNAME> --env ES_PASSWORD=<ES_PASSWORD> --env ES_CA_CERT=<ES_CA_CERT> --transport stdio elasticsearch -- npx -y @tocharianou/elasticsearch-mcp

Replace <…> with your own values. 5 more environment variables are in the server README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Elasticsearch

How do I install Elasticsearch in Claude Code?

Run `claude mcp add elasticsearch -e ES_URL=<ES_URL> -e ES_API_KEY=<ES_API_KEY> -e ES_PASSWORD=<ES_PASSWORD> -- npx -y @tocharianou/elasticsearch-mcp`.

What does the Elasticsearch MCP server do?

It connects Claude Code to Elasticsearch, selects a client for the cluster version, and checks query fields against live mappings.

Which Elasticsearch versions does it support?

It automatically supports Elasticsearch 5.x–9.x. Older releases receive a smaller set of available tools.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor