elasticsearch7
elasticsearch7 mcp server
claude mcp add --transport stdio imlewc-elasticsearch7-mcp-server python -m elasticsearch7_mcp_server \ --env MCP_PORT="Optional) MCP server listening port, defaults to 9999" \ --env ELASTIC_HOST="Elasticsearch host address (e.g., http://localhost:9200)" \ --env ELASTIC_PASSWORD="Elasticsearch password" \ --env ELASTIC_USERNAME="Elasticsearch username"
How to use
This MCP server provides a protocol wrapper around Elasticsearch 7.x, exposing common Elasticsearch operations through the MCP interface. It supports basic health and metadata endpoints (es-ping, es-info) as well as full text search capabilities via es-search, including support for aggregations, highlighting, sorting, and source filtering. Clients can connect using any MCP client and issue commands like es-ping to verify connectivity, es-info to fetch cluster details, and es-search to perform queries against specified indices. The server is designed for Elasticsearch 7.x clusters and aims to make Elasticsearch functionality accessible through MCP without requiring direct Elasticsearch client libraries.
To get started, configure the required environment variables (ELASTIC_HOST, ELASTIC_USERNAME, ELASTIC_PASSWORD) and run the MCP server. Then, connect with an MCP client to localhost on the configured port (default 9999) and invoke methods such as es-ping, es-info, or es-search. The README provides example client usage demonstrating a typical flow for performing a search or a more advanced query with aggregations and highlighting.
How to install
Prerequisites:
- Python 3.10+ installed on the host
- Access to an Elasticsearch 7.x cluster (7.17.x recommended)
- Python package manager (pip)
Installation steps:
-
Install Python dependencies in your environment (optional but recommended to use a virtual environment):
- python -m venv venv
- source venv/bin/activate (Linux/macOS) or venv\Scripts\activate (Windows)
-
Install the MCP server package in development mode (as per the project README):
- pip install -e .
-
Configure environment variables before running:
- ELASTIC_HOST=http://localhost:9200
- ELASTIC_USERNAME=your_username
- ELASTIC_PASSWORD=your_password
- MCP_PORT=9999 (optional; defaults to 9999 if not set)
-
Run the server (by module name defined in your package):
- python -m elasticsearch7_mcp_server
If you prefer a quick start, you can also explore running via Smithery if the project supports it, as described in the README: use npx -y @smithery/cli install @imlewc/elasticsearch7-mcp-server --client claude to install for Claude Desktop, though this is optional for local development.
Additional notes
Tips and common issues:
- Ensure the Elasticsearch cluster is reachable at ELASTIC_HOST and that the credentials (ELASTIC_USERNAME, ELASTIC_PASSWORD) are correct.
- If MCP_PORT is in use, choose an available port or stop the conflicting service.
- When using Docker Compose, ensure the environment file (.env) defines ELASTIC_PASSWORD and that ELASTIC_HOST points to the correct Elasticsearch endpoint.
- The es-search endpoint supports a variety of query structures, including full-text search, term queries, range filters, and aggregations. Refer to the README examples for building complex queries.
- If you encounter connection issues, verify network access between the MCP server and Elasticsearch and check Elasticsearch cluster health.
- The server runs on Python; avoid mixing incompatible Python environments if using virtual environments.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP