elasticsearch-mcp-server 1.0.0__tar.gz → 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of elasticsearch-mcp-server might be problematic. Click here for more details.

Files changed (83) hide show
  1. elasticsearch_mcp_server-2.0.1/.env.example +11 -0
  2. elasticsearch_mcp_server-2.0.1/.github/workflows/pypi-publish.yaml +51 -0
  3. elasticsearch_mcp_server-2.0.1/.gitignore +12 -0
  4. elasticsearch_mcp_server-2.0.1/CONTRIBUTING.md +76 -0
  5. elasticsearch_mcp_server-2.0.1/Dockerfile +30 -0
  6. {elasticsearch_mcp_server-1.0.0 → elasticsearch_mcp_server-2.0.1}/PKG-INFO +105 -29
  7. elasticsearch_mcp_server-2.0.1/README.md +178 -0
  8. {elasticsearch_mcp_server-1.0.0 → elasticsearch_mcp_server-2.0.1}/cliff.toml +1 -1
  9. elasticsearch_mcp_server-1.0.0/docker-compose.yml → elasticsearch_mcp_server-2.0.1/docker-compose-elasticsearch.yml +9 -9
  10. elasticsearch_mcp_server-2.0.1/docker-compose-opensearch.yml +71 -0
  11. elasticsearch_mcp_server-2.0.1/mcp_client/python-sdk-anthropic/.gitignore +1 -0
  12. elasticsearch_mcp_server-2.0.1/mcp_client/python-sdk-anthropic/__init__.py +0 -0
  13. elasticsearch_mcp_server-2.0.1/mcp_client/python-sdk-anthropic/client.py +158 -0
  14. elasticsearch_mcp_server-2.0.1/mcp_client/python-sdk-anthropic/config.py +62 -0
  15. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/checksums/checksums.lock +0 -0
  16. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/checksums/md5-checksums.bin +0 -0
  17. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/checksums/sha1-checksums.bin +0 -0
  18. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/executionHistory/executionHistory.bin +0 -0
  19. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/executionHistory/executionHistory.lock +0 -0
  20. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileChanges/last-build.bin +0 -0
  21. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileHashes/fileHashes.bin +0 -0
  22. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileHashes/fileHashes.lock +0 -0
  23. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileHashes/resourceHashesCache.bin +0 -0
  24. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/gc.properties +0 -0
  25. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  26. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/buildOutputCleanup/cache.properties +2 -0
  27. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  28. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/file-system.probe +0 -0
  29. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/vcs-1/gc.properties +0 -0
  30. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/README.md +54 -0
  31. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build/classes/java/main/spring/ai/mcp/spring_ai_mcp/Application.class +0 -0
  32. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build/reports/problems/problems-report.html +663 -0
  33. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build/resolvedMainClassName +1 -0
  34. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build/resources/main/application.yml +16 -0
  35. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build/resources/main/mcp-servers-config.json +18 -0
  36. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build/tmp/compileJava/previous-compilation-data.bin +0 -0
  37. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/build.gradle +44 -0
  38. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/gradle/wrapper/gradle-wrapper.jar +0 -0
  39. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/gradle/wrapper/gradle-wrapper.properties +7 -0
  40. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/gradle.properties +1 -0
  41. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/gradlew +251 -0
  42. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/gradlew.bat +94 -0
  43. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/settings.gradle +1 -0
  44. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/src/main/java/spring/ai/mcp/spring_ai_mcp/Application.java +48 -0
  45. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/src/main/resources/application.yml +16 -0
  46. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/src/main/resources/mcp-servers-config.json +15 -0
  47. elasticsearch_mcp_server-2.0.1/mcp_client/spring-ai/src/test/java/spring/ai/mcp/spring_ai_mcp/SpringAiMcpApplicationTests.java +13 -0
  48. elasticsearch_mcp_server-2.0.1/pyproject.toml +34 -0
  49. elasticsearch_mcp_server-2.0.1/smithery.yaml +25 -0
  50. elasticsearch_mcp_server-2.0.1/src/__init__.py +6 -0
  51. elasticsearch_mcp_server-2.0.1/src/clients/__init__.py +42 -0
  52. elasticsearch_mcp_server-2.0.1/src/clients/base.py +54 -0
  53. elasticsearch_mcp_server-2.0.1/src/clients/common/__init__.py +6 -0
  54. elasticsearch_mcp_server-2.0.1/src/clients/common/alias.py +20 -0
  55. elasticsearch_mcp_server-2.0.1/src/clients/common/client.py +25 -0
  56. elasticsearch_mcp_server-2.0.1/src/clients/common/cluster.py +12 -0
  57. elasticsearch_mcp_server-2.0.1/src/clients/common/document.py +37 -0
  58. elasticsearch_mcp_server-2.0.1/src/clients/common/index.py +20 -0
  59. elasticsearch_mcp_server-2.0.1/src/clients/exceptions.py +69 -0
  60. elasticsearch_mcp_server-2.0.1/src/server.py +71 -0
  61. elasticsearch_mcp_server-2.0.1/src/tools/__init__.py +13 -0
  62. elasticsearch_mcp_server-2.0.1/src/tools/alias.py +46 -0
  63. elasticsearch_mcp_server-2.0.1/src/tools/cluster.py +17 -0
  64. elasticsearch_mcp_server-2.0.1/src/tools/document.py +64 -0
  65. elasticsearch_mcp_server-2.0.1/src/tools/index.py +44 -0
  66. elasticsearch_mcp_server-2.0.1/src/tools/register.py +41 -0
  67. elasticsearch_mcp_server-2.0.1/uv.lock +734 -0
  68. elasticsearch_mcp_server-1.0.0/.env +0 -4
  69. elasticsearch_mcp_server-1.0.0/.github/workflows/pypi-publish.yaml +0 -41
  70. elasticsearch_mcp_server-1.0.0/.gitignore +0 -6
  71. elasticsearch_mcp_server-1.0.0/README.md +0 -106
  72. elasticsearch_mcp_server-1.0.0/pyproject.toml +0 -24
  73. elasticsearch_mcp_server-1.0.0/src/elasticsearch_mcp_server/__init__.py +0 -10
  74. elasticsearch_mcp_server-1.0.0/src/elasticsearch_mcp_server/es_client.py +0 -40
  75. elasticsearch_mcp_server-1.0.0/src/elasticsearch_mcp_server/server.py +0 -41
  76. elasticsearch_mcp_server-1.0.0/src/elasticsearch_mcp_server/tools/cluster.py +0 -38
  77. elasticsearch_mcp_server-1.0.0/src/elasticsearch_mcp_server/tools/document.py +0 -25
  78. elasticsearch_mcp_server-1.0.0/src/elasticsearch_mcp_server/tools/index.py +0 -51
  79. elasticsearch_mcp_server-1.0.0/uv.lock +0 -445
  80. {elasticsearch_mcp_server-1.0.0 → elasticsearch_mcp_server-2.0.1}/.github/workflows/release.yml +0 -0
  81. {elasticsearch_mcp_server-1.0.0 → elasticsearch_mcp_server-2.0.1}/.python-version +0 -0
  82. {elasticsearch_mcp_server-1.0.0 → elasticsearch_mcp_server-2.0.1}/LICENSE +0 -0
  83. {elasticsearch_mcp_server-1.0.0 → elasticsearch_mcp_server-2.0.1}/Makefile +0 -0
@@ -0,0 +1,11 @@
1
+ # Elasticsearch connection settings
2
+ ELASTICSEARCH_HOSTS=https://localhost:9200
3
+ ELASTICSEARCH_USERNAME=elastic
4
+ ELASTICSEARCH_PASSWORD=test123
5
+ ELASTICSEARCH_VERIFY_CERTS=false
6
+
7
+ # OpenSearch connection settings
8
+ OPENSEARCH_HOSTS=https://localhost:9200
9
+ OPENSEARCH_USERNAME=admin
10
+ OPENSEARCH_PASSWORD=admin
11
+ OPENSEARCH_VERIFY_CERTS=false
@@ -0,0 +1,51 @@
1
+ # This workflow will upload Python Packages using uv when a release is created
2
+ # It builds and publishes two separate packages: elasticsearch-mcp-server and opensearch-mcp-server
3
+
4
+ name: PyPI Publish
5
+
6
+ on:
7
+ workflow_run:
8
+ workflows: ["Release"]
9
+ types:
10
+ - completed
11
+
12
+ env:
13
+ UV_PUBLISH_TOKEN: '${{ secrets.PYPI_API_TOKEN }}'
14
+
15
+ jobs:
16
+ deploy:
17
+ runs-on: ubuntu-latest
18
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+
22
+ - name: Set up Python
23
+ uses: actions/setup-python@v2
24
+ with:
25
+ python-version: '3.10.x'
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ python -m pip install uv
30
+ uv sync
31
+
32
+ # First build and publish elasticsearch-mcp-server
33
+ - name: Build elasticsearch-mcp-server package
34
+ run: uv build
35
+
36
+ - name: Publish elasticsearch-mcp-server package
37
+ run: uv publish
38
+
39
+ # Clean up dist directory
40
+ - name: Clean dist directory
41
+ run: rm -rf dist/*
42
+
43
+ # Then build and publish opensearch-mcp-server
44
+ - name: Build opensearch-mcp-server package
45
+ run: |
46
+ # Change package name to opensearch-mcp-server
47
+ sed -i 's/^name = .*$/name = "opensearch-mcp-server"/' pyproject.toml
48
+ uv build
49
+
50
+ - name: Publish opensearch-mcp-server package
51
+ run: uv publish
@@ -0,0 +1,12 @@
1
+ # IDE
2
+ .idea
3
+ .vscode
4
+
5
+ # Python
6
+ .venv
7
+ dist
8
+ __pycache__
9
+ *.egg-info
10
+
11
+ # Configuration and Credentials
12
+ .env
@@ -0,0 +1,76 @@
1
+ # Contributing to Elasticsearch/OpenSearch MCP Server
2
+
3
+ Thank you for your interest in contributing to the Elasticsearch/OpenSearch MCP Server! All kinds of contributions are welcome.
4
+
5
+ ## Bug reports
6
+
7
+ If you think you've found a bug in the Elasticsearch/OpenSearch MCP Server, we welcome your report. It's very helpful if you can provide steps to reproduce the bug, as it makes it easier to identify and fix the issue.
8
+
9
+ ## Feature requests
10
+
11
+ If you find yourself wishing for a feature that doesn't exist in the Elasticsearch/OpenSearch MCP Server, you are probably not alone. Don't be hesitate to open an issue which describes the feature you would like to see, why you need it, and how it should work.
12
+
13
+ ## Pull requests
14
+
15
+ If you have a fix or a new feature, we welcome your pull requests. You can follow the following steps:
16
+
17
+ 1. Fork your own copy of the repository to your GitHub account by clicking on
18
+ `Fork` button on [elasticsearch-mcp-server's GitHub repository](https://github.com/cr7258/elasticsearch-mcp-server).
19
+ 2. Clone the forked repository on your local setup.
20
+
21
+ ```bash
22
+ git clone https://github.com/$user/elasticsearch-mcp-server
23
+ ```
24
+
25
+ Add a remote upstream to track upstream `elasticsearch-mcp-server` repository.
26
+
27
+ ```bash
28
+ git remote add upstream https://github.com/cr7258/elasticsearch-mcp-server
29
+ ```
30
+
31
+ 3. Create a topic branch.
32
+
33
+ ```bash
34
+ git checkout -b <branch-name>
35
+ ```
36
+
37
+ 4. Make changes and commit it locally.
38
+
39
+ ```bash
40
+ git add <modifiedFile>
41
+ git commit
42
+ ```
43
+
44
+ Commit message could help reviewers better understand what is the purpose of submitted PR. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type:
45
+ - Features: commit message start with `feat`, For example: "feat: add user authentication module"
46
+ - Bug Fixes: commit message start with `fix`, For example: "fix: resolve null pointer exception in user service"
47
+ - Documentation, commit message start with `doc`, For example: "doc: update API documentation for user endpoints"
48
+ - Performance: commit message start with `perf`, For example: "perf: improve the performance of user service"
49
+ - Refactor: commit message start with `refactor`, For example: "refactor: refactor user service to improve code readability"
50
+ - Test: commit message start with `test`, For example: "test: add unit test for user service"
51
+ - Chore: commit message start with `chore`, For example: "chore: update dependencies in pom.xml"
52
+ - Style: commit message start with `style`, For example: "style: format the code in user service"
53
+ - Revert: commit message start with `revert`, For example: "revert: revert the changes in user service"
54
+
55
+ 5. Push local branch to your forked repository.
56
+
57
+ ```bash
58
+ git push
59
+ ```
60
+
61
+ 6. Create a Pull request on GitHub.
62
+ Visit your fork at `https://github.com/$user/elasticsearch-mcp-server` and click
63
+ `Compare & Pull Request` button next to your `<branch-name>`.
64
+
65
+
66
+ ## Keeping branch in sync with upstream
67
+
68
+ Click `Sync fork` button on your forked repository to keep your forked repository in sync with the upstream repository.
69
+
70
+ If you have already created a branch and want to keep it in sync with the upstream repository, follow the below steps:
71
+
72
+ ```bash
73
+ git checkout <branch-name>
74
+ git fetch upstream
75
+ git rebase upstream/main
76
+ ```
@@ -0,0 +1,30 @@
1
+ # Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
2
+ # Start with a Python base image
3
+ FROM python:3.10-slim
4
+
5
+ # Set working directory
6
+ WORKDIR /app
7
+
8
+ # Copy necessary files
9
+ COPY . .
10
+
11
+ # Install hatch to handle the build
12
+ RUN pip install hatch
13
+
14
+ # Clean dist directory before build
15
+ RUN rm -rf dist/*
16
+
17
+ # Use hatch to build the package and install it
18
+ RUN hatch build && pip install dist/*.whl
19
+
20
+ # Set environment variables required for the MCP server
21
+ # These can be overridden at runtime with docker run --env
22
+ ENV ELASTICSEARCH_HOST="https://localhost:9200"
23
+ ENV ELASTICSEARCH_USERNAME="elastic"
24
+ ENV ELASTICSEARCH_PASSWORD="test123"
25
+
26
+ # Expose the port the server is running on (if applicable)
27
+ EXPOSE 8000
28
+
29
+ # Command to run the server
30
+ ENTRYPOINT ["elasticsearch-mcp-server"]
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elasticsearch-mcp-server
3
- Version: 1.0.0
4
- Summary: MCP Server for interacting with Elasticsearch
3
+ Version: 2.0.1
4
+ Summary: MCP Server for interacting with Elasticsearch and OpenSearch
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
7
7
  http://www.apache.org/licenses/
@@ -205,17 +205,23 @@ License: Apache License
205
205
  limitations under the License.
206
206
  License-File: LICENSE
207
207
  Requires-Python: >=3.10
208
+ Requires-Dist: anthropic>=0.49.0
208
209
  Requires-Dist: elasticsearch>=8.0.0
209
210
  Requires-Dist: fastmcp>=0.4.0
210
211
  Requires-Dist: mcp>=1.0.0
212
+ Requires-Dist: opensearch-py>=2.0.0
211
213
  Requires-Dist: python-dotenv>=1.0.0
214
+ Requires-Dist: tomli-w>=1.2.0
215
+ Requires-Dist: tomli>=2.2.1
212
216
  Description-Content-Type: text/markdown
213
217
 
214
- # Elasticsearch MCP Server
218
+ # Elasticsearch/OpenSearch MCP Server
219
+
220
+ [![smithery badge](https://smithery.ai/badge/elasticsearch-mcp-server)](https://smithery.ai/server/elasticsearch-mcp-server)
215
221
 
216
222
  ## Overview
217
223
 
218
- A Model Context Protocol (MCP) server implementation that provides Elasticsearch interaction. This server enables searching documents, analyzing indices, and managing cluster through a set of tools.
224
+ A Model Context Protocol (MCP) server implementation that provides Elasticsearch and OpenSearch interaction. This server enables searching documents, analyzing indices, and managing cluster through a set of tools.
219
225
 
220
226
  <a href="https://glama.ai/mcp/servers/b3po3delex"><img width="380" height="200" src="https://glama.ai/mcp/servers/b3po3delex/badge" alt="Elasticsearch MCP Server" /></a>
221
227
 
@@ -227,41 +233,67 @@ https://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15
227
233
 
228
234
  ### Index Operations
229
235
 
230
- - `list_indices`: List all indices in the Elasticsearch cluster.
231
- - `get_mapping`: Retrieve the mapping configuration for a specific index.
232
- - `get_settings`: Get the settings configuration for a specific index.
236
+ - `list_indices`: List all indices.
237
+ - `get_index`: Returns information (mappings, settings, aliases) about one or more indices.
238
+ - `create_index`: Create a new index.
239
+ - `delete_index`: Delete an index.
233
240
 
234
241
  ### Document Operations
235
242
 
236
- - `search_documents`: Search documents in an index using Elasticsearch Query DSL.
243
+ - `search_documents`: Search for documents.
244
+ - `index_document`: Creates or updates a document in the index.
245
+ - `get_document`: Get a document by ID.
246
+ - `delete_document`: Delete a document by ID.
247
+ - `delete_by_query`: Deletes documents matching the provided query.
237
248
 
238
249
  ### Cluster Operations
239
250
 
240
- - `get_cluster_health`: Get health status of the cluster.
241
- - `get_cluster_stats`: Get statistical information about the cluster.
251
+ - `get_cluster_health`: Returns basic information about the health of the cluster.
252
+ - `get_cluster_stats`: Returns high-level overview of cluster statistics.
253
+
254
+ ### Alias Operations
255
+
256
+ - `list_aliases`: List all aliases.
257
+ - `get_alias`: Get alias information for a specific index.
258
+ - `put_alias`: Create or update an alias for a specific index.
259
+ - `delete_alias`: Delete an alias for a specific index.
242
260
 
261
+ ## Configure Environment Variables
243
262
 
244
- ## Start Elasticsearch Cluster
263
+ Copy the `.env.example` file to `.env` and update the values accordingly.
245
264
 
246
- Start the Elasticsearch cluster using Docker Compose:
265
+ ## Start Elasticsearch/OpenSearch Cluster
266
+
267
+ Start the Elasticsearch/OpenSearch cluster using Docker Compose:
247
268
 
248
269
  ```bash
249
- docker-compose up -d
270
+ # For Elasticsearch
271
+ docker-compose -f docker-compose-elasticsearch.yml up -d
272
+
273
+ # For OpenSearch
274
+ docker-compose -f docker-compose-opensearch.yml up -d
250
275
  ```
251
276
 
252
- This will start a 3-node Elasticsearch cluster and Kibana. Default Elasticsearch username `elastic`, password `test123`.
277
+ The default Elasticsearch username is `elastic` and password is `test123`. The default OpenSearch username is `admin` and password is `admin`.
253
278
 
254
- You can access Kibana from http://localhost:5601.
279
+ You can access Kibana/OpenSearch Dashboards from http://localhost:5601.
255
280
 
256
281
  ## Usage with Claude Desktop
257
282
 
258
- Add the following configuration to Claude Desktop's config file `claude_desktop_config.json`.
283
+ ### Option 1: Installing via Smithery
259
284
 
260
- ### Option 1: Using uvx (Recommended)
285
+ To install Elasticsearch Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/elasticsearch-mcp-server):
261
286
 
262
- Using `uvx` will automatically install the package from PyPI, no need to clone the repository locally
287
+ ```bash
288
+ npx -y @smithery/cli install elasticsearch-mcp-server --client claude
289
+ ```
290
+
291
+ ### Option 2: Using uvx
292
+
293
+ Using `uvx` will automatically install the package from PyPI, no need to clone the repository locally. Add the following configuration to Claude Desktop's config file `claude_desktop_config.json`.
263
294
 
264
295
  ```json
296
+ // For Elasticsearch
265
297
  {
266
298
  "mcpServers": {
267
299
  "elasticsearch-mcp-server": {
@@ -270,23 +302,41 @@ Using `uvx` will automatically install the package from PyPI, no need to clone t
270
302
  "elasticsearch-mcp-server"
271
303
  ],
272
304
  "env": {
273
- "ELASTIC_HOST": "https://localhost:9200",
274
- "ELASTIC_USERNAME": "elastic",
275
- "ELASTIC_PASSWORD": "test123"
305
+ "ELASTICSEARCH_HOSTS": "https://localhost:9200",
306
+ "ELASTICSEARCH_USERNAME": "elastic",
307
+ "ELASTICSEARCH_PASSWORD": "test123"
308
+ }
309
+ }
310
+ }
311
+ }
312
+
313
+ // For OpenSearch
314
+ {
315
+ "mcpServers": {
316
+ "opensearch-mcp-server": {
317
+ "command": "uvx",
318
+ "args": [
319
+ "opensearch-mcp-server"
320
+ ],
321
+ "env": {
322
+ "OPENSEARCH_HOSTS": "https://localhost:9200",
323
+ "OPENSEARCH_USERNAME": "admin",
324
+ "OPENSEARCH_PASSWORD": "admin"
276
325
  }
277
326
  }
278
327
  }
279
328
  }
280
329
  ```
281
330
 
282
- ### Option 2: Using uv with local development
331
+ ### Option 3: Using uv with local development
283
332
 
284
- Using `uv` requires cloning the repository locally and specifying the path to the source code.
333
+ Using `uv` requires cloning the repository locally and specifying the path to the source code. Add the following configuration to Claude Desktop's config file `claude_desktop_config.json`.
285
334
 
286
335
  ```json
336
+ // For Elasticsearch
287
337
  {
288
338
  "mcpServers": {
289
- "elasticsearch": {
339
+ "elasticsearch-mcp-server": {
290
340
  "command": "uv",
291
341
  "args": [
292
342
  "--directory",
@@ -295,9 +345,29 @@ Using `uv` requires cloning the repository locally and specifying the path to th
295
345
  "elasticsearch-mcp-server"
296
346
  ],
297
347
  "env": {
298
- "ELASTIC_HOST": "https://localhost:9200",
299
- "ELASTIC_USERNAME": "elastic",
300
- "ELASTIC_PASSWORD": "test123"
348
+ "ELASTICSEARCH_HOSTS": "https://localhost:9200",
349
+ "ELASTICSEARCH_USERNAME": "elastic",
350
+ "ELASTICSEARCH_PASSWORD": "test123"
351
+ }
352
+ }
353
+ }
354
+ }
355
+
356
+ // For OpenSearch
357
+ {
358
+ "mcpServers": {
359
+ "opensearch-mcp-server": {
360
+ "command": "uv",
361
+ "args": [
362
+ "--directory",
363
+ "path/to/src/elasticsearch_mcp_server",
364
+ "run",
365
+ "opensearch-mcp-server"
366
+ ],
367
+ "env": {
368
+ "OPENSEARCH_HOSTS": "https://localhost:9200",
369
+ "OPENSEARCH_USERNAME": "admin",
370
+ "OPENSEARCH_PASSWORD": "admin"
301
371
  }
302
372
  }
303
373
  }
@@ -309,11 +379,17 @@ Using `uv` requires cloning the repository locally and specifying the path to th
309
379
 
310
380
  Restart Claude Desktop to load the new MCP server.
311
381
 
312
- Now you can interact with your Elasticsearch cluster through Claude using natural language commands like:
382
+ Now you can interact with your Elasticsearch/OpenSearch cluster through Claude using natural language commands like:
313
383
  - "List all indices in the cluster"
314
384
  - "How old is the student Bob?"
315
385
  - "Show me the cluster health status"
316
386
 
387
+ ## Usage with Anthropic MCP Client
388
+
389
+ ```python
390
+ uv run mcp_client/client.py src/server.py
391
+ ```
392
+
317
393
  ## License
318
394
 
319
- This project is licensed under the Apache License Version 2.0 - see the [LICENSE](LICENSE) file for details.
395
+ This project is licensed under the Apache License Version 2.0 - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,178 @@
1
+ # Elasticsearch/OpenSearch MCP Server
2
+
3
+ [![smithery badge](https://smithery.ai/badge/elasticsearch-mcp-server)](https://smithery.ai/server/elasticsearch-mcp-server)
4
+
5
+ ## Overview
6
+
7
+ A Model Context Protocol (MCP) server implementation that provides Elasticsearch and OpenSearch interaction. This server enables searching documents, analyzing indices, and managing cluster through a set of tools.
8
+
9
+ <a href="https://glama.ai/mcp/servers/b3po3delex"><img width="380" height="200" src="https://glama.ai/mcp/servers/b3po3delex/badge" alt="Elasticsearch MCP Server" /></a>
10
+
11
+ ## Demo
12
+
13
+ https://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15
14
+
15
+ ## Features
16
+
17
+ ### Index Operations
18
+
19
+ - `list_indices`: List all indices.
20
+ - `get_index`: Returns information (mappings, settings, aliases) about one or more indices.
21
+ - `create_index`: Create a new index.
22
+ - `delete_index`: Delete an index.
23
+
24
+ ### Document Operations
25
+
26
+ - `search_documents`: Search for documents.
27
+ - `index_document`: Creates or updates a document in the index.
28
+ - `get_document`: Get a document by ID.
29
+ - `delete_document`: Delete a document by ID.
30
+ - `delete_by_query`: Deletes documents matching the provided query.
31
+
32
+ ### Cluster Operations
33
+
34
+ - `get_cluster_health`: Returns basic information about the health of the cluster.
35
+ - `get_cluster_stats`: Returns high-level overview of cluster statistics.
36
+
37
+ ### Alias Operations
38
+
39
+ - `list_aliases`: List all aliases.
40
+ - `get_alias`: Get alias information for a specific index.
41
+ - `put_alias`: Create or update an alias for a specific index.
42
+ - `delete_alias`: Delete an alias for a specific index.
43
+
44
+ ## Configure Environment Variables
45
+
46
+ Copy the `.env.example` file to `.env` and update the values accordingly.
47
+
48
+ ## Start Elasticsearch/OpenSearch Cluster
49
+
50
+ Start the Elasticsearch/OpenSearch cluster using Docker Compose:
51
+
52
+ ```bash
53
+ # For Elasticsearch
54
+ docker-compose -f docker-compose-elasticsearch.yml up -d
55
+
56
+ # For OpenSearch
57
+ docker-compose -f docker-compose-opensearch.yml up -d
58
+ ```
59
+
60
+ The default Elasticsearch username is `elastic` and password is `test123`. The default OpenSearch username is `admin` and password is `admin`.
61
+
62
+ You can access Kibana/OpenSearch Dashboards from http://localhost:5601.
63
+
64
+ ## Usage with Claude Desktop
65
+
66
+ ### Option 1: Installing via Smithery
67
+
68
+ To install Elasticsearch Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/elasticsearch-mcp-server):
69
+
70
+ ```bash
71
+ npx -y @smithery/cli install elasticsearch-mcp-server --client claude
72
+ ```
73
+
74
+ ### Option 2: Using uvx
75
+
76
+ Using `uvx` will automatically install the package from PyPI, no need to clone the repository locally. Add the following configuration to Claude Desktop's config file `claude_desktop_config.json`.
77
+
78
+ ```json
79
+ // For Elasticsearch
80
+ {
81
+ "mcpServers": {
82
+ "elasticsearch-mcp-server": {
83
+ "command": "uvx",
84
+ "args": [
85
+ "elasticsearch-mcp-server"
86
+ ],
87
+ "env": {
88
+ "ELASTICSEARCH_HOSTS": "https://localhost:9200",
89
+ "ELASTICSEARCH_USERNAME": "elastic",
90
+ "ELASTICSEARCH_PASSWORD": "test123"
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ // For OpenSearch
97
+ {
98
+ "mcpServers": {
99
+ "opensearch-mcp-server": {
100
+ "command": "uvx",
101
+ "args": [
102
+ "opensearch-mcp-server"
103
+ ],
104
+ "env": {
105
+ "OPENSEARCH_HOSTS": "https://localhost:9200",
106
+ "OPENSEARCH_USERNAME": "admin",
107
+ "OPENSEARCH_PASSWORD": "admin"
108
+ }
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Option 3: Using uv with local development
115
+
116
+ Using `uv` requires cloning the repository locally and specifying the path to the source code. Add the following configuration to Claude Desktop's config file `claude_desktop_config.json`.
117
+
118
+ ```json
119
+ // For Elasticsearch
120
+ {
121
+ "mcpServers": {
122
+ "elasticsearch-mcp-server": {
123
+ "command": "uv",
124
+ "args": [
125
+ "--directory",
126
+ "path/to/src/elasticsearch_mcp_server",
127
+ "run",
128
+ "elasticsearch-mcp-server"
129
+ ],
130
+ "env": {
131
+ "ELASTICSEARCH_HOSTS": "https://localhost:9200",
132
+ "ELASTICSEARCH_USERNAME": "elastic",
133
+ "ELASTICSEARCH_PASSWORD": "test123"
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ // For OpenSearch
140
+ {
141
+ "mcpServers": {
142
+ "opensearch-mcp-server": {
143
+ "command": "uv",
144
+ "args": [
145
+ "--directory",
146
+ "path/to/src/elasticsearch_mcp_server",
147
+ "run",
148
+ "opensearch-mcp-server"
149
+ ],
150
+ "env": {
151
+ "OPENSEARCH_HOSTS": "https://localhost:9200",
152
+ "OPENSEARCH_USERNAME": "admin",
153
+ "OPENSEARCH_PASSWORD": "admin"
154
+ }
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ - On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
161
+ - On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
162
+
163
+ Restart Claude Desktop to load the new MCP server.
164
+
165
+ Now you can interact with your Elasticsearch/OpenSearch cluster through Claude using natural language commands like:
166
+ - "List all indices in the cluster"
167
+ - "How old is the student Bob?"
168
+ - "Show me the cluster health status"
169
+
170
+ ## Usage with Anthropic MCP Client
171
+
172
+ ```python
173
+ uv run mcp_client/client.py src/server.py
174
+ ```
175
+
176
+ ## License
177
+
178
+ This project is licensed under the Apache License Version 2.0 - see the [LICENSE](LICENSE) file for details.
@@ -97,4 +97,4 @@ git_path = "git"
97
97
  # whether to use relaxed or strict semver parsing
98
98
  relaxed_semver = true
99
99
  # only show the changes for the current version
100
- tag_range = true
100
+ tag_range = true
@@ -1,13 +1,13 @@
1
1
  services:
2
2
  setup:
3
- image: docker.elastic.co/elasticsearch/elasticsearch:8.6.1
3
+ image: docker.elastic.co/elasticsearch/elasticsearch:8.17.2
4
4
  volumes:
5
5
  - certs:/usr/share/elasticsearch/config/certs
6
6
  user: "0"
7
7
  command: >
8
8
  bash -c '
9
- if [ x${ELASTIC_PASSWORD} == x ]; then
10
- echo "Set the ELASTIC_PASSWORD environment variable in the .env file";
9
+ if [ x${ELASTICSEARCH_PASSWORD} == x ]; then
10
+ echo "Set the ELASTICSEARCH_PASSWORD environment variable in the .env file";
11
11
  exit 1;
12
12
  fi;
13
13
  if [ ! -f config/certs/ca.zip ]; then
@@ -48,7 +48,7 @@ services:
48
48
  echo "Waiting for Elasticsearch availability";
49
49
  until curl -s --cacert config/certs/ca/ca.crt https://es01:9200 | grep -q "missing authentication credentials"; do sleep 30; done;
50
50
  echo "Setting kibana_system password";
51
- until curl -s -X POST --cacert config/certs/ca/ca.crt -u "elastic:${ELASTIC_PASSWORD}" -H "Content-Type: application/json" https://es01:9200/_security/user/kibana_system/_password -d "{\"password\":\"kibana123\"}" | grep -q "^{}"; do sleep 10; done;
51
+ until curl -s -X POST --cacert config/certs/ca/ca.crt -u "elastic:${ELASTICSEARCH_PASSWORD}" -H "Content-Type: application/json" https://es01:9200/_security/user/kibana_system/_password -d "{\"password\":\"kibana123\"}" | grep -q "^{}"; do sleep 10; done;
52
52
  echo "All done!";
53
53
  '
54
54
  healthcheck:
@@ -61,7 +61,7 @@ services:
61
61
  depends_on:
62
62
  setup:
63
63
  condition: service_healthy
64
- image: docker.elastic.co/elasticsearch/elasticsearch:8.6.1
64
+ image: docker.elastic.co/elasticsearch/elasticsearch:8.17.2
65
65
  volumes:
66
66
  - certs:/usr/share/elasticsearch/config/certs
67
67
  - esdata01:/usr/share/elasticsearch/data
@@ -72,7 +72,7 @@ services:
72
72
  - cluster.name=es-mcp-cluster
73
73
  - cluster.initial_master_nodes=es01,es02,es03
74
74
  - discovery.seed_hosts=es02,es03
75
- - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
75
+ - ELASTIC_PASSWORD=${ELASTICSEARCH_PASSWORD}
76
76
  - bootstrap.memory_lock=true
77
77
  - xpack.security.enabled=true
78
78
  - xpack.security.http.ssl.enabled=true
@@ -106,7 +106,7 @@ services:
106
106
  es02:
107
107
  depends_on:
108
108
  - es01
109
- image: docker.elastic.co/elasticsearch/elasticsearch:8.6.1
109
+ image: docker.elastic.co/elasticsearch/elasticsearch:8.17.2
110
110
  volumes:
111
111
  - certs:/usr/share/elasticsearch/config/certs
112
112
  - esdata02:/usr/share/elasticsearch/data
@@ -148,7 +148,7 @@ services:
148
148
  es03:
149
149
  depends_on:
150
150
  - es02
151
- image: docker.elastic.co/elasticsearch/elasticsearch:8.6.1
151
+ image: docker.elastic.co/elasticsearch/elasticsearch:8.17.2
152
152
  volumes:
153
153
  - certs:/usr/share/elasticsearch/config/certs
154
154
  - esdata03:/usr/share/elasticsearch/data
@@ -195,7 +195,7 @@ services:
195
195
  condition: service_healthy
196
196
  es03:
197
197
  condition: service_healthy
198
- image: docker.elastic.co/kibana/kibana:8.6.1
198
+ image: docker.elastic.co/kibana/kibana:8.17.2
199
199
  volumes:
200
200
  - certs:/usr/share/kibana/config/certs
201
201
  - kibanadata:/usr/share/kibana/data