es7-data-access-gateway
Facilitates robust interaction with Elasticsearch version 7.x instances via a unified MCP interface, abstracting complex direct API invocation for fundamental tasks and advanced analytical queries like aggregations, result highlighting, and structured sorting.
Author

imlewc
Quick Info
Actions
Tags
Elasticsearch 7.x Data Access Gateway (MCP)
This service layer bridges clients to Elasticsearch 7.x environments, ensuring protocol conformity.
Core Capabilities
- Exposes an MCP service layer endpoint for seamless integration with ES 7.x data stores.
- Handles routine cluster health checks and metadata retrieval.
- Enables full spectrum querying, including complex pipeline aggregations, result snippet generation (highlighting), result ordering, and other sophisticated search parameters.
- Simplifies feature consumption for any connected MCP client application.
Prerequisites
- Runtime environment: Python version 3.10 or newer.
- Target Data Store: Elasticsearch cluster running version 7.x (7.17.x recommended).
Deployment Instructions
Automated Installation via Smithery
For effortless setup in environments like Claude Desktop using Smithery:
bash npx -y @smithery/cli install @imlewc/elasticsearch7-mcp-server --client claude
Local Setup
bash pip install -e .
Configuration Variables
The following environment variables are mandatory for operation:
ELASTIC_HOST: The URI endpoint for the Elasticsearch cluster (e.g., http://data-node:9200).ELASTIC_USERNAME: Credentials for cluster authentication.ELASTIC_PASSWORD: Secret key for cluster authentication.MCP_PORT: (Optional) The network port for the MCP server to listen on; defaults to 9999.
Containerized Orchestration
- Establish a
.envconfiguration file defining your security credentials:
ELASTIC_PASSWORD=your_highly_secret_password_here
- Launch the services via Docker Compose:
bash docker-compose up -d
This command initiates a robust, three-member ES 7.17.10 cluster, the associated Kibana instance, and this MCP interface service.
Client Interaction Example
Any standard MCP client library can connect to this gateway:
python from mcp import MCPClient
client = MCPClient("gateway-address:9999") status_check = client.call("es-ping") print(status_check) # Expected output: {"success": true}
Available Remote Procedures (RPCs)
Currently supported methods callable via the MCP client:
es-ping: Verifies connectivity to the Elasticsearch backend.es-info: Fetches metadata regarding the cluster status.es-search: Executes document retrieval and analytical queries against a specified index.
Query Examples
Standard Retrieval
python
Execution of a simple keyword matching query
retrieval_results = client.call("es-search", { "index": "product_catalog", "query": { "match": { "description": "premium widgets" } }, "size": 10, "from": 0 })
Analytical Aggregation
python
Requesting only statistical summaries without document payloads
stats_summary = client.call("es-search", {
"index": "sales_data",
"size": 0,
"aggs": {
"product_groups": {
"terms": {
"field": "department.keyword",
"size": 10
}
},
"revenue_total": {
"sum": {
"field": "transaction_value"
}
}
}
})
Complex Filtered Search with Presentation Tuning
python
Advanced query combining boolean logic, range filtering, result ordering, and field masking
complex_retrieval = client.call("es-search", { "index": "article_archive", "query": { "bool": { "must": [ {"match": {"body_text": "machine learning concepts"}} ], "filter": [ {"range": {"publish_year": {"gte": 2020}}} ] } }, "sort": [ {"relevance_score": {"order": "desc"}}, "_doc_id" ], "highlight": { "fields": { "body_text": {}, "title": {} } }, "_source": ["article_id", "publish_year", "title"] })
Contribution Guidelines
- Clone the source repository.
- Install required development packages.
- Execute the server executable:
elasticsearch7-mcp-server
Governing Agreement
[See LICENSE file for terms of use]
中文文档
WIKIPEDIA: XMLHttpRequest (XHR) represents an Application Programming Interface standard, implemented as a JavaScript object, designed for dispatching HTTP requests asynchronously between a web client and a remote server. This capability allows browser-based applications to fetch or submit data post-initial page load without causing a full page refresh. XHR is foundational to the Ajax programming paradigm. Before its widespread adoption, server communication typically relied on full-page navigation triggered by form submissions or hyperlink clicks.
== Genesis ==
XMLHttpRequest was initially conceptualized in 2000 by engineers working on Microsoft Outlook. Its first realization appeared in Internet Explorer 5 (released in 1999). Notably, the initial syntax did not utilize the standardized XMLHttpRequest identifier; instead, proprietary forms like ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP") were employed. By the release of Internet Explorer 7 (2006), all major browsers had adopted the common XMLHttpRequest identifier, establishing it as the universal standard.
The identifier is now universally recognized across all principal browser engines, including Mozilla's Gecko (adopted 2002), Apple's Safari 1.2 (2004), and Opera 8.0 (2005).
=== Standardization Trajectory === The World Wide Web Consortium (W3C) published the initial specification draft for the XMLHttpRequest object on April 5, 2006. A subsequent Level 2 specification draft was issued on February 25, 2008, introducing enhancements such as event progress monitoring, support for cross-origin requests, and binary stream handling. By the close of 2011, the Level 2 features were integrated back into the primary specification document. Development stewardship transferred to the WHATWG near the end of 2012, which now maintains the specification as a living document using Web IDL definitions.
== Operational Workflow == Generally, performing a network transaction using XMLHttpRequest mandates several sequential programming operations:
- Instantiate an XMLHttpRequest object via its constructor.
- Invoke the
open()method to define the request methodology (GET/POST), specify the target Uniform Resource Identifier (URI), and select between synchronous or asynchronous execution mode. - If using asynchronous mode, attach an event handler function to monitor the request's state transitions.
- Initiate the transmission by calling the
send()method, optionally passing data to be uploaded. - Process state changes within the registered event listener. Upon successful server response, data is typically accessible via the
responseTextproperty. The object signals completion when its state transitions to 4 (the 'done' state).
Beyond these foundational steps, XHR offers numerous configuration options. Custom request headers can be affixed to influence server handling. Payload data can be transferred during the send() call. Received data can be automatically deserialized from formats like JSON into native JavaScript objects, or processed incrementally as byte chunks arrive, rather than waiting for full payload completion. Furthermore, requests can be terminated prematurely or subjected to time-out restrictions.

