opensearch-mcp-server 2.0.8__py3-none-any.whl → 2.0.9__py3-none-any.whl
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.
- {opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/METADATA +1 -1
- {opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/RECORD +7 -7
- src/clients/base.py +37 -5
- src/version.py +1 -1
- {opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/WHEEL +0 -0
- {opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/entry_points.txt +0 -0
- {opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,8 +1,8 @@
|
|
1
1
|
src/__init__.py,sha256=aNKcThftSLh9IjOTA-UUpoRzIm4R0WwXKGAzykwecmU,211
|
2
2
|
src/server.py,sha256=BfMAgXTFV9C4waCWRro8Sfl6yXEXr2vJ7YoGY7HhMPY,5072
|
3
|
-
src/version.py,sha256=
|
3
|
+
src/version.py,sha256=pZib55qStLeBfZabni1F1OCNxdT02xP-5e34LjIBswQ,22
|
4
4
|
src/clients/__init__.py,sha256=3UezAt9422S-7BvMiCo2Y9pmATVutorwsIQXP_g_CkA,1221
|
5
|
-
src/clients/base.py,sha256=
|
5
|
+
src/clients/base.py,sha256=dKO18Wcq4gBc3j5Q1KbQ63heIir7jcX2Fl58uG7abyE,4674
|
6
6
|
src/clients/exceptions.py,sha256=NYF3KVw-9aAgCViin5OuBI6miMEPS5QsdHx6bcis1wc,2493
|
7
7
|
src/clients/common/__init__.py,sha256=VgvgxFpESn2wAuJmH0XM_Ej2izI7dxK7QJe9wG4fmW0,211
|
8
8
|
src/clients/common/alias.py,sha256=rB53TSld5x2vZyDNAwyEdnh1KWUXMSD7h5fSv_ubR2Q,759
|
@@ -18,8 +18,8 @@ src/tools/document.py,sha256=XZTVuk4di9VEwWMZN7jyDVnzoOiXkb4FBrXF44sVXTs,2052
|
|
18
18
|
src/tools/general.py,sha256=whj1spjIb8SS75h843X6c3RTsrZcSm-66KVLlY7OEh0,817
|
19
19
|
src/tools/index.py,sha256=7KNPtElTFelkjRSvdMqPBx9nx_9Uk01OnTMeVo7YeCs,1345
|
20
20
|
src/tools/register.py,sha256=wrG2P6-YPW77bTg1j_ELp8omWRYsJjFeOHUy_unHe6Y,1344
|
21
|
-
opensearch_mcp_server-2.0.
|
22
|
-
opensearch_mcp_server-2.0.
|
23
|
-
opensearch_mcp_server-2.0.
|
24
|
-
opensearch_mcp_server-2.0.
|
25
|
-
opensearch_mcp_server-2.0.
|
21
|
+
opensearch_mcp_server-2.0.9.dist-info/METADATA,sha256=bin99eLiAa5zNKjqcBjokOclRhJj9VMVjX7YZPrrqXA,19863
|
22
|
+
opensearch_mcp_server-2.0.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
23
|
+
opensearch_mcp_server-2.0.9.dist-info/entry_points.txt,sha256=ImfJnUwMpQUBmu-1MeBG_P0dwamfXKQh82mBKW7tWNY,138
|
24
|
+
opensearch_mcp_server-2.0.9.dist-info/licenses/LICENSE,sha256=DBsjuP5FR51d9kaUdXlVBuBv3cQ_I_adq9gefYQ9FcY,11339
|
25
|
+
opensearch_mcp_server-2.0.9.dist-info/RECORD,,
|
src/clients/base.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from abc import ABC
|
2
2
|
import logging
|
3
3
|
import warnings
|
4
|
-
from typing import Dict
|
4
|
+
from typing import Dict, Optional
|
5
5
|
|
6
6
|
from elasticsearch import Elasticsearch
|
7
7
|
import httpx
|
@@ -39,10 +39,13 @@ class SearchClientBase(ABC):
|
|
39
39
|
|
40
40
|
# Initialize client based on engine type
|
41
41
|
if engine_type == "elasticsearch":
|
42
|
+
# Get auth parameters based on elasticsearch package version
|
43
|
+
auth_params = self._get_elasticsearch_auth_params(username, password)
|
44
|
+
|
42
45
|
self.client = Elasticsearch(
|
43
46
|
hosts=hosts,
|
44
|
-
|
45
|
-
|
47
|
+
verify_certs=verify_certs,
|
48
|
+
**auth_params
|
46
49
|
)
|
47
50
|
self.logger.info(f"Elasticsearch client initialized with hosts: {hosts}")
|
48
51
|
elif engine_type == "opensearch":
|
@@ -64,9 +67,38 @@ class SearchClientBase(ABC):
|
|
64
67
|
verify_certs=verify_certs,
|
65
68
|
)
|
66
69
|
|
70
|
+
def _get_elasticsearch_auth_params(self, username: Optional[str], password: Optional[str]) -> Dict:
|
71
|
+
"""
|
72
|
+
Get authentication parameters for Elasticsearch client based on package version.
|
73
|
+
|
74
|
+
Args:
|
75
|
+
username: Username for authentication
|
76
|
+
password: Password for authentication
|
77
|
+
|
78
|
+
Returns:
|
79
|
+
Dictionary with appropriate auth parameters for the ES version
|
80
|
+
"""
|
81
|
+
if not username or not password:
|
82
|
+
return {}
|
83
|
+
|
84
|
+
# Check Elasticsearch package version to determine auth parameter name
|
85
|
+
try:
|
86
|
+
from elasticsearch import __version__ as es_version
|
87
|
+
major_version = int(es_version.split('.')[0])
|
88
|
+
|
89
|
+
if major_version >= 8:
|
90
|
+
# ES 8+ uses basic_auth
|
91
|
+
return {"basic_auth": (username, password)}
|
92
|
+
else:
|
93
|
+
# ES 7 and below use http_auth
|
94
|
+
return {"http_auth": (username, password)}
|
95
|
+
except (ImportError, ValueError, AttributeError):
|
96
|
+
# If we can't detect version, try basic_auth first (ES 8+ default)
|
97
|
+
return {"basic_auth": (username, password)}
|
98
|
+
|
67
99
|
class GeneralRestClient:
|
68
|
-
def __init__(self, base_url: str, username: str, password: str, verify_certs: bool):
|
69
|
-
self.base_url = base_url.rstrip("/")
|
100
|
+
def __init__(self, base_url: Optional[str], username: Optional[str], password: Optional[str], verify_certs: bool):
|
101
|
+
self.base_url = base_url.rstrip("/") if base_url else ""
|
70
102
|
self.auth = (username, password) if username and password else None
|
71
103
|
self.verify_certs = verify_certs
|
72
104
|
|
src/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.0.
|
1
|
+
__version__ = "2.0.9"
|
File without changes
|
{opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/entry_points.txt
RENAMED
File without changes
|
{opensearch_mcp_server-2.0.8.dist-info → opensearch_mcp_server-2.0.9.dist-info}/licenses/LICENSE
RENAMED
File without changes
|