# Elasticsearch (MCP Server)

> Deprecated Elastic MCP server for querying Elasticsearch indices

- Type: MCP server
- Publisher: Elastic (official)
- Categories: Data & Analytics, DevOps & Cloud
- Website: https://github.com/elastic/mcp-server-elasticsearch
- Source: https://github.com/elastic/mcp-server-elasticsearch
- Transport: stdio
- Launch command: docker run -i --rm -e ES_URL -e ES_API_KEY docker.elastic.co/mcp/elasticsearch stdio
- Sign-in: api-key
- Environment variables: ES_URL, ES_API_KEY
- GitHub stars: 718
- Listed: 2025-03-24

## About

Elastic's Elasticsearch MCP server lets agents list indices, read mappings, run Query DSL searches and ES|QL queries. It is deprecated and receives only critical security updates; Elastic recommends the Agent Builder MCP endpoint in Elastic 9.2+.

## Install

1. **Add the server to Codex**

   Codex CLI:

   ```bash
   codex mcp add elasticsearch --env ES_URL=YOUR_ES_URL --env ES_API_KEY=YOUR_ES_API_KEY -- docker run -i --rm -e ES_URL -e ES_API_KEY docker.elastic.co/mcp/elasticsearch stdio
   ```

   config.toml:

   ```toml
   [mcp_servers.elasticsearch]
   command = "docker"
   args = ["run", "-i", "--rm", "-e", "ES_URL", "-e", "ES_API_KEY", "docker.elastic.co/mcp/elasticsearch", "stdio"]
   
   [mcp_servers.elasticsearch.env]
   ES_URL = "YOUR_ES_URL"
   ES_API_KEY = "YOUR_ES_API_KEY"
   ```

   Agents SDK:

   ```python
   from agents import Agent, Runner
   from agents.mcp import MCPServerStdio
   
   async with MCPServerStdio(
       name="Elasticsearch",
       params={"command": "docker", "args": ["run", "-i", "--rm", "-e", "ES_URL", "-e", "ES_API_KEY", "docker.elastic.co/mcp/elasticsearch", "stdio"]},
   ) as server:
       agent = Agent(name="Assistant", mcp_servers=[server])
       result = await Runner.run(agent, "List all indices in my cluster")
       print(result.final_output)
   ```

## Tools

- `list_indices`
- `get_mappings`
- `search`
- `esql`
- `get_shards`

## Example prompts

- "List all indices in my cluster"
- "Show the mappings for the logs-* index"
- "Find error logs from the last hour"
- "Run an ES|QL query counting events by host"

## Related

- [GitHub](https://chatgptplugins.directory/mcp/github.md): Manage repos, issues, pull requests and Actions from your AI agent
- [Supabase](https://chatgptplugins.directory/mcp/supabase.md): Manage Supabase databases, migrations, edge functions and logs
- [Sentry](https://chatgptplugins.directory/mcp/sentry.md): Search Sentry errors, issues and traces and debug them with Seer
- [Graphiti MCP](https://chatgptplugins.directory/mcp/graphiti.md): Temporal knowledge graph memory for agents, by Zep
- [Cloudflare API](https://chatgptplugins.directory/mcp/cloudflare-api.md): Access 2,500+ Cloudflare API endpoints through two Code Mode tools
- [Vercel](https://chatgptplugins.directory/mcp/vercel.md): Manage Vercel projects, deployments, logs and docs from AI tools

---
Source: https://chatgptplugins.directory/mcp/elasticsearch · Index: https://chatgptplugins.directory/llms.txt · Independent and community-run. Not affiliated with or endorsed by OpenAI. ChatGPT is a trademark of OpenAI.
