opensearch-mcp-server 2.0.1__tar.gz → 2.0.3__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.
Files changed (73) hide show
  1. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/.gitignore +4 -0
  2. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/Makefile +2 -0
  3. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/PKG-INFO +14 -9
  4. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/README.md +4 -0
  5. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/pyproject.toml +10 -9
  6. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/base.py +35 -2
  7. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/common/client.py +2 -1
  8. opensearch_mcp_server-2.0.3/src/clients/common/general.py +10 -0
  9. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/server.py +6 -2
  10. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/tools/__init__.py +8 -6
  11. opensearch_mcp_server-2.0.3/src/tools/general.py +20 -0
  12. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/uv.lock +317 -306
  13. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/checksums/checksums.lock +0 -0
  14. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/checksums/md5-checksums.bin +0 -0
  15. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/checksums/sha1-checksums.bin +0 -0
  16. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/executionHistory/executionHistory.bin +0 -0
  17. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/executionHistory/executionHistory.lock +0 -0
  18. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileChanges/last-build.bin +0 -0
  19. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileHashes/fileHashes.bin +0 -0
  20. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileHashes/fileHashes.lock +0 -0
  21. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/fileHashes/resourceHashesCache.bin +0 -0
  22. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/8.13/gc.properties +0 -0
  23. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  24. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/buildOutputCleanup/cache.properties +0 -2
  25. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  26. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/file-system.probe +0 -0
  27. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/.gradle/vcs-1/gc.properties +0 -0
  28. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/build/classes/java/main/spring/ai/mcp/spring_ai_mcp/Application.class +0 -0
  29. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/build/reports/problems/problems-report.html +0 -663
  30. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/build/resolvedMainClassName +0 -1
  31. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/build/resources/main/mcp-servers-config.json +0 -18
  32. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/build/tmp/compileJava/previous-compilation-data.bin +0 -0
  33. opensearch_mcp_server-2.0.1/mcp_client/spring-ai/src/main/resources/application.yml +0 -16
  34. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/.env.example +0 -0
  35. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/.github/workflows/pypi-publish.yaml +0 -0
  36. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/.github/workflows/release.yml +0 -0
  37. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/.python-version +0 -0
  38. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/CONTRIBUTING.md +0 -0
  39. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/Dockerfile +0 -0
  40. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/LICENSE +0 -0
  41. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/cliff.toml +0 -0
  42. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/docker-compose-elasticsearch.yml +0 -0
  43. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/docker-compose-opensearch.yml +0 -0
  44. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/python-sdk-anthropic/.gitignore +0 -0
  45. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/python-sdk-anthropic/__init__.py +0 -0
  46. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/python-sdk-anthropic/client.py +0 -0
  47. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/python-sdk-anthropic/config.py +0 -0
  48. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/README.md +0 -0
  49. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/build.gradle +0 -0
  50. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/gradle/wrapper/gradle-wrapper.jar +0 -0
  51. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/gradle/wrapper/gradle-wrapper.properties +0 -0
  52. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/gradle.properties +0 -0
  53. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/gradlew +0 -0
  54. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/gradlew.bat +0 -0
  55. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/settings.gradle +0 -0
  56. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/src/main/java/spring/ai/mcp/spring_ai_mcp/Application.java +0 -0
  57. {opensearch_mcp_server-2.0.1/mcp_client/spring-ai/build/resources/main → opensearch_mcp_server-2.0.3/mcp_client/spring-ai/src/main/resources}/application.yml +0 -0
  58. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/src/main/resources/mcp-servers-config.json +0 -0
  59. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/mcp_client/spring-ai/src/test/java/spring/ai/mcp/spring_ai_mcp/SpringAiMcpApplicationTests.java +0 -0
  60. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/smithery.yaml +0 -0
  61. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/__init__.py +0 -0
  62. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/__init__.py +0 -0
  63. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/common/__init__.py +0 -0
  64. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/common/alias.py +0 -0
  65. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/common/cluster.py +0 -0
  66. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/common/document.py +0 -0
  67. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/common/index.py +0 -0
  68. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/clients/exceptions.py +0 -0
  69. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/tools/alias.py +0 -0
  70. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/tools/cluster.py +0 -0
  71. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/tools/document.py +0 -0
  72. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/tools/index.py +0 -0
  73. {opensearch_mcp_server-2.0.1 → opensearch_mcp_server-2.0.3}/src/tools/register.py +0 -0
@@ -10,3 +10,7 @@ __pycache__
10
10
 
11
11
  # Configuration and Credentials
12
12
  .env
13
+
14
+ # Spring AI
15
+ .gradle/
16
+ build
@@ -11,6 +11,8 @@ release:
11
11
  data["project"]["version"] = "$(version:v%=%)"; \
12
12
  tomli_w.dump(data, open("pyproject.toml", "wb"))'
13
13
  @git add pyproject.toml
14
+ @uv sync
15
+ @git add uv.lock
14
16
  @git commit -m "release: update version to $(version:v%=%)"
15
17
  @git push origin main
16
18
  @git tag $(version)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensearch-mcp-server
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: MCP Server for interacting with Elasticsearch and OpenSearch
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -205,14 +205,15 @@ 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
209
- Requires-Dist: elasticsearch>=8.0.0
210
- Requires-Dist: fastmcp>=0.4.0
211
- Requires-Dist: mcp>=1.0.0
212
- Requires-Dist: opensearch-py>=2.0.0
213
- Requires-Dist: python-dotenv>=1.0.0
214
- Requires-Dist: tomli-w>=1.2.0
215
- Requires-Dist: tomli>=2.2.1
208
+ Requires-Dist: anthropic==0.49.0
209
+ Requires-Dist: elasticsearch==8.17.2
210
+ Requires-Dist: fastmcp==0.4.1
211
+ Requires-Dist: mcp==1.6.0
212
+ Requires-Dist: opensearch-py==2.8.0
213
+ Requires-Dist: python-dotenv==1.1.0
214
+ Requires-Dist: toml==0.10.2
215
+ Requires-Dist: tomli-w==1.2.0
216
+ Requires-Dist: tomli==2.2.1
216
217
  Description-Content-Type: text/markdown
217
218
 
218
219
  # Elasticsearch/OpenSearch MCP Server
@@ -231,6 +232,10 @@ https://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15
231
232
 
232
233
  ## Features
233
234
 
235
+ ### General Operations
236
+
237
+ - `general_api_request`: Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
238
+
234
239
  ### Index Operations
235
240
 
236
241
  - `list_indices`: List all indices.
@@ -14,6 +14,10 @@ https://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15
14
14
 
15
15
  ## Features
16
16
 
17
+ ### General Operations
18
+
19
+ - `general_api_request`: Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
20
+
17
21
  ### Index Operations
18
22
 
19
23
  - `list_indices`: List all indices.
@@ -1,18 +1,19 @@
1
1
  [project]
2
2
  name = "opensearch-mcp-server"
3
- version = "2.0.1"
3
+ version = "2.0.3"
4
4
  description = "MCP Server for interacting with Elasticsearch and OpenSearch"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
7
7
  dependencies = [
8
- "elasticsearch>=8.0.0",
9
- "opensearch-py>=2.0.0",
10
- "mcp>=1.0.0",
11
- "python-dotenv>=1.0.0",
12
- "fastmcp>=0.4.0",
13
- "anthropic>=0.49.0",
14
- "tomli>=2.2.1",
15
- "tomli-w>=1.2.0",
8
+ "elasticsearch==8.17.2",
9
+ "opensearch-py==2.8.0",
10
+ "mcp==1.6.0",
11
+ "python-dotenv==1.1.0",
12
+ "fastmcp==0.4.1",
13
+ "anthropic==0.49.0",
14
+ "tomli==2.2.1",
15
+ "tomli-w==1.2.0",
16
+ "toml==0.10.2",
16
17
  ]
17
18
 
18
19
  [project.license]
@@ -3,6 +3,10 @@ import logging
3
3
  import warnings
4
4
  from typing import Dict
5
5
 
6
+ from elasticsearch import Elasticsearch
7
+ import httpx
8
+ from opensearchpy import OpenSearch
9
+
6
10
  class SearchClientBase(ABC):
7
11
  def __init__(self, config: Dict, engine_type: str):
8
12
  """
@@ -35,7 +39,6 @@ class SearchClientBase(ABC):
35
39
 
36
40
  # Initialize client based on engine type
37
41
  if engine_type == "elasticsearch":
38
- from elasticsearch import Elasticsearch
39
42
  self.client = Elasticsearch(
40
43
  hosts=hosts,
41
44
  basic_auth=(username, password) if username and password else None,
@@ -43,7 +46,6 @@ class SearchClientBase(ABC):
43
46
  )
44
47
  self.logger.info(f"Elasticsearch client initialized with hosts: {hosts}")
45
48
  elif engine_type == "opensearch":
46
- from opensearchpy import OpenSearch
47
49
  self.client = OpenSearch(
48
50
  hosts=hosts,
49
51
  http_auth=(username, password) if username and password else None,
@@ -52,3 +54,34 @@ class SearchClientBase(ABC):
52
54
  self.logger.info(f"OpenSearch client initialized with hosts: {hosts}")
53
55
  else:
54
56
  raise ValueError(f"Unsupported engine type: {engine_type}")
57
+
58
+ # General REST client
59
+ base_url = hosts[0] if isinstance(hosts, list) else hosts
60
+ self.general_client = GeneralRestClient(
61
+ base_url=base_url,
62
+ username=username,
63
+ password=password,
64
+ verify_certs=verify_certs,
65
+ )
66
+
67
+ class GeneralRestClient:
68
+ def __init__(self, base_url: str, username: str, password: str, verify_certs: bool):
69
+ self.base_url = base_url.rstrip("/")
70
+ self.auth = (username, password) if username and password else None
71
+ self.verify_certs = verify_certs
72
+
73
+ def request(self, method, path, params=None, body=None):
74
+ url = f"{self.base_url}/{path.lstrip('/')}"
75
+ with httpx.Client(verify=self.verify_certs) as client:
76
+ resp = client.request(
77
+ method=method.upper(),
78
+ url=url,
79
+ params=params,
80
+ json=body,
81
+ auth=self.auth
82
+ )
83
+ resp.raise_for_status()
84
+ ct = resp.headers.get("content-type", "")
85
+ if ct.startswith("application/json"):
86
+ return resp.json()
87
+ return resp.text
@@ -3,9 +3,10 @@ from typing import Dict
3
3
  from src.clients.common.alias import AliasClient
4
4
  from src.clients.common.cluster import ClusterClient
5
5
  from src.clients.common.document import DocumentClient
6
+ from src.clients.common.general import GeneralClient
6
7
  from src.clients.common.index import IndexClient
7
8
 
8
- class SearchClient(IndexClient, DocumentClient, ClusterClient, AliasClient):
9
+ class SearchClient(IndexClient, DocumentClient, ClusterClient, AliasClient, GeneralClient):
9
10
  """
10
11
  Unified search client that combines all search functionality.
11
12
 
@@ -0,0 +1,10 @@
1
+ from typing import Dict, Optional
2
+
3
+ from src.clients.base import SearchClientBase
4
+
5
+ class GeneralClient(SearchClientBase):
6
+ def general_api_request(self, method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None):
7
+ """Perform a general HTTP API request.
8
+ Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
9
+ """
10
+ return self.general_client.request(method, path, params, body)
@@ -2,11 +2,13 @@ import logging
2
2
  import sys
3
3
 
4
4
  from fastmcp import FastMCP
5
+ import toml
5
6
 
6
7
  from src.clients import create_search_client
7
8
  from src.tools.alias import AliasTools
8
9
  from src.tools.cluster import ClusterTools
9
10
  from src.tools.document import DocumentTools
11
+ from src.tools.general import GeneralTools
10
12
  from src.tools.index import IndexTools
11
13
  from src.tools.register import ToolsRegister
12
14
 
@@ -17,7 +19,8 @@ class SearchMCPServer:
17
19
  self.name = f"{self.engine_type}_mcp_server"
18
20
  self.mcp = FastMCP(self.name)
19
21
  self.logger = logging.getLogger()
20
- self.logger.info(f"Initializing {self.name}...")
22
+ self.version = toml.load("pyproject.toml")["project"]["version"]
23
+ self.logger.info(f"Initializing {self.name}, Version: {self.version}")
21
24
 
22
25
  # Create the corresponding search client
23
26
  self.search_client = create_search_client(self.engine_type)
@@ -35,7 +38,8 @@ class SearchMCPServer:
35
38
  IndexTools,
36
39
  DocumentTools,
37
40
  ClusterTools,
38
- AliasTools
41
+ AliasTools,
42
+ GeneralTools,
39
43
  ]
40
44
  # Register all tools
41
45
  register.register_all_tools(tool_classes)
@@ -1,13 +1,15 @@
1
- from src.tools.index import IndexTools
2
- from src.tools.document import DocumentTools
3
- from src.tools.cluster import ClusterTools
4
1
  from src.tools.alias import AliasTools
2
+ from src.tools.cluster import ClusterTools
3
+ from src.tools.document import DocumentTools
4
+ from src.tools.general import GeneralTools
5
+ from src.tools.index import IndexTools
5
6
  from src.tools.register import ToolsRegister
6
7
 
7
8
  __all__ = [
8
- 'IndexTools',
9
- 'DocumentTools',
10
- 'ClusterTools',
11
9
  'AliasTools',
10
+ 'ClusterTools',
11
+ 'DocumentTools',
12
+ 'GeneralTools',
13
+ 'IndexTools',
12
14
  'ToolsRegister',
13
15
  ]
@@ -0,0 +1,20 @@
1
+ from typing import Dict, Optional
2
+
3
+ from fastmcp import FastMCP
4
+
5
+ class GeneralTools:
6
+ def __init__(self, search_client):
7
+ self.search_client = search_client
8
+ def register_tools(self, mcp: FastMCP):
9
+ @mcp.tool()
10
+ def general_api_request(method: str, path: str, params: Optional[Dict] = None, body: Optional[Dict] = None):
11
+ """Perform a general HTTP API request.
12
+ Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.
13
+
14
+ Args:
15
+ method: HTTP method (GET, POST, PUT, DELETE, etc.)
16
+ path: API endpoint path
17
+ params: Query parameters
18
+ body: Request body
19
+ """
20
+ return self.search_client.general_api_request(method, path, params, body)