opensearch-mcp-server 2.0.3__py3-none-any.whl → 2.0.5__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.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/METADATA +24 -26
- {opensearch_mcp_server-2.0.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/RECORD +7 -6
- src/server.py +67 -18
- src/version.py +1 -0
- {opensearch_mcp_server-2.0.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/WHEEL +0 -0
- {opensearch_mcp_server-2.0.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/entry_points.txt +0 -0
- {opensearch_mcp_server-2.0.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: opensearch-mcp-server
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.5
|
4
4
|
Summary: MCP Server for interacting with Elasticsearch and OpenSearch
|
5
5
|
License: Apache License
|
6
6
|
Version 2.0, January 2004
|
@@ -207,19 +207,21 @@ License-File: LICENSE
|
|
207
207
|
Requires-Python: >=3.10
|
208
208
|
Requires-Dist: anthropic==0.49.0
|
209
209
|
Requires-Dist: elasticsearch==8.17.2
|
210
|
-
Requires-Dist: fastmcp==
|
211
|
-
Requires-Dist: mcp==1.
|
210
|
+
Requires-Dist: fastmcp==2.8.0
|
211
|
+
Requires-Dist: mcp==1.9.2
|
212
212
|
Requires-Dist: opensearch-py==2.8.0
|
213
213
|
Requires-Dist: python-dotenv==1.1.0
|
214
|
-
Requires-Dist: toml==0.10.2
|
215
214
|
Requires-Dist: tomli-w==1.2.0
|
216
215
|
Requires-Dist: tomli==2.2.1
|
217
216
|
Description-Content-Type: text/markdown
|
218
217
|
|
218
|
+
|
219
219
|
# Elasticsearch/OpenSearch MCP Server
|
220
220
|
|
221
221
|
[](https://smithery.ai/server/elasticsearch-mcp-server)
|
222
222
|
|
223
|
+
[](https://mseep.ai/app/cr7258-elasticsearch-mcp-server)
|
224
|
+
|
223
225
|
## Overview
|
224
226
|
|
225
227
|
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.
|
@@ -283,19 +285,11 @@ The default Elasticsearch username is `elastic` and password is `test123`. The d
|
|
283
285
|
|
284
286
|
You can access Kibana/OpenSearch Dashboards from http://localhost:5601.
|
285
287
|
|
286
|
-
##
|
287
|
-
|
288
|
-
### Option 1: Installing via Smithery
|
288
|
+
## Stdio
|
289
289
|
|
290
|
-
|
291
|
-
|
292
|
-
```bash
|
293
|
-
npx -y @smithery/cli install elasticsearch-mcp-server --client claude
|
294
|
-
```
|
290
|
+
### Option 1: Using uvx
|
295
291
|
|
296
|
-
|
297
|
-
|
298
|
-
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`.
|
292
|
+
Using `uvx` will automatically install the package from PyPI, no need to clone the repository locally. Add the following configuration to 's config file `claude_desktop_config.json`.
|
299
293
|
|
300
294
|
```json
|
301
295
|
// For Elasticsearch
|
@@ -333,7 +327,7 @@ Using `uvx` will automatically install the package from PyPI, no need to clone t
|
|
333
327
|
}
|
334
328
|
```
|
335
329
|
|
336
|
-
### Option
|
330
|
+
### Option 2: Using uv with local development
|
337
331
|
|
338
332
|
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`.
|
339
333
|
|
@@ -379,20 +373,24 @@ Using `uv` requires cloning the repository locally and specifying the path to th
|
|
379
373
|
}
|
380
374
|
```
|
381
375
|
|
382
|
-
|
383
|
-
- On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
376
|
+
## SSE
|
384
377
|
|
385
|
-
|
378
|
+
```bash
|
379
|
+
# By default, the SSE MCP server will serve on http://127.0.0.1:8000/sse
|
380
|
+
uv run src/server.py elasticsearch --transport sse
|
386
381
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
- "Show me the cluster health status"
|
382
|
+
# The host, port, and path can be specified using the --host, --port, and --path options
|
383
|
+
uv run src/server.py elasticsearch --transport sse --host 0.0.0.0 --port 8000 --path /sse
|
384
|
+
```
|
391
385
|
|
392
|
-
##
|
386
|
+
## Streamable HTTP
|
387
|
+
|
388
|
+
```bash
|
389
|
+
# By default, the Streamable HTTP MCP server will serve on http://127.0.0.1:8000/mcp
|
390
|
+
uv run src/server.py elasticsearch --transport streamable-http
|
393
391
|
|
394
|
-
|
395
|
-
uv run
|
392
|
+
# The host, port, and path can be specified using the --host, --port, and --path options
|
393
|
+
uv run src/server.py elasticsearch --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp
|
396
394
|
```
|
397
395
|
|
398
396
|
## License
|
@@ -1,5 +1,6 @@
|
|
1
1
|
src/__init__.py,sha256=aNKcThftSLh9IjOTA-UUpoRzIm4R0WwXKGAzykwecmU,211
|
2
|
-
src/server.py,sha256=
|
2
|
+
src/server.py,sha256=UTRN7Wk1njdLpF2Aa7G-dAyq04FOU3cGK1wNZGqSw3U,4154
|
3
|
+
src/version.py,sha256=xEb7Z4b8xalXXExBg42XPAhbJKniHzcsEPjp-6S3ppg,22
|
3
4
|
src/clients/__init__.py,sha256=3UezAt9422S-7BvMiCo2Y9pmATVutorwsIQXP_g_CkA,1221
|
4
5
|
src/clients/base.py,sha256=MBAGepXyHPtdbtHhxFB8CamZ2ApWCBuOi_6-ey-MqX8,3298
|
5
6
|
src/clients/exceptions.py,sha256=NYF3KVw-9aAgCViin5OuBI6miMEPS5QsdHx6bcis1wc,2493
|
@@ -17,8 +18,8 @@ src/tools/document.py,sha256=XZTVuk4di9VEwWMZN7jyDVnzoOiXkb4FBrXF44sVXTs,2052
|
|
17
18
|
src/tools/general.py,sha256=whj1spjIb8SS75h843X6c3RTsrZcSm-66KVLlY7OEh0,817
|
18
19
|
src/tools/index.py,sha256=7KNPtElTFelkjRSvdMqPBx9nx_9Uk01OnTMeVo7YeCs,1345
|
19
20
|
src/tools/register.py,sha256=wrG2P6-YPW77bTg1j_ELp8omWRYsJjFeOHUy_unHe6Y,1344
|
20
|
-
opensearch_mcp_server-2.0.
|
21
|
-
opensearch_mcp_server-2.0.
|
22
|
-
opensearch_mcp_server-2.0.
|
23
|
-
opensearch_mcp_server-2.0.
|
24
|
-
opensearch_mcp_server-2.0.
|
21
|
+
opensearch_mcp_server-2.0.5.dist-info/METADATA,sha256=7XYxNvhAvMNagGh7GpYQUWb7qqLEJy0-JM200dp8S00,18747
|
22
|
+
opensearch_mcp_server-2.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
23
|
+
opensearch_mcp_server-2.0.5.dist-info/entry_points.txt,sha256=ImfJnUwMpQUBmu-1MeBG_P0dwamfXKQh82mBKW7tWNY,138
|
24
|
+
opensearch_mcp_server-2.0.5.dist-info/licenses/LICENSE,sha256=DBsjuP5FR51d9kaUdXlVBuBv3cQ_I_adq9gefYQ9FcY,11339
|
25
|
+
opensearch_mcp_server-2.0.5.dist-info/RECORD,,
|
src/server.py
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import logging
|
2
2
|
import sys
|
3
|
+
import argparse
|
3
4
|
|
4
5
|
from fastmcp import FastMCP
|
5
|
-
import toml
|
6
6
|
|
7
7
|
from src.clients import create_search_client
|
8
8
|
from src.tools.alias import AliasTools
|
@@ -11,6 +11,7 @@ from src.tools.document import DocumentTools
|
|
11
11
|
from src.tools.general import GeneralTools
|
12
12
|
from src.tools.index import IndexTools
|
13
13
|
from src.tools.register import ToolsRegister
|
14
|
+
from src.version import __version__ as VERSION
|
14
15
|
|
15
16
|
class SearchMCPServer:
|
16
17
|
def __init__(self, engine_type):
|
@@ -19,8 +20,7 @@ class SearchMCPServer:
|
|
19
20
|
self.name = f"{self.engine_type}_mcp_server"
|
20
21
|
self.mcp = FastMCP(self.name)
|
21
22
|
self.logger = logging.getLogger()
|
22
|
-
self.
|
23
|
-
self.logger.info(f"Initializing {self.name}, Version: {self.version}")
|
23
|
+
self.logger.info(f"Initializing {self.name}, Version: {VERSION}")
|
24
24
|
|
25
25
|
# Create the corresponding search client
|
26
26
|
self.search_client = create_search_client(self.engine_type)
|
@@ -44,14 +44,26 @@ class SearchMCPServer:
|
|
44
44
|
# Register all tools
|
45
45
|
register.register_all_tools(tool_classes)
|
46
46
|
|
47
|
-
def run(self):
|
48
|
-
"""Run the MCP server."""
|
49
|
-
self.mcp.run()
|
50
47
|
|
51
|
-
def run_search_server(engine_type):
|
52
|
-
"""Run search server with specified engine type.
|
48
|
+
def run_search_server(engine_type, transport, host, port, path):
|
49
|
+
"""Run search server with specified engine type and transport options.
|
50
|
+
|
51
|
+
Args:
|
52
|
+
engine_type: Type of search engine to use ("elasticsearch" or "opensearch")
|
53
|
+
transport: Transport protocol to use ("stdio", "streamable-http", or "sse")
|
54
|
+
host: Host to bind to when using HTTP transports
|
55
|
+
port: Port to bind to when using HTTP transports
|
56
|
+
path: URL path prefix for HTTP transports
|
57
|
+
"""
|
58
|
+
|
53
59
|
server = SearchMCPServer(engine_type=engine_type)
|
54
|
-
|
60
|
+
|
61
|
+
if transport in ["streamable-http", "sse"]:
|
62
|
+
server.logger.info(f"Starting {server.name} with {transport} transport on {host}:{port}{path}")
|
63
|
+
server.mcp.run(transport=transport, host=host, port=port, path=path)
|
64
|
+
else:
|
65
|
+
server.logger.info(f"Starting {server.name} with {transport} transport")
|
66
|
+
server.mcp.run(transport=transport)
|
55
67
|
|
56
68
|
def elasticsearch_mcp_server():
|
57
69
|
"""Entry point for Elasticsearch MCP server."""
|
@@ -62,14 +74,51 @@ def opensearch_mcp_server():
|
|
62
74
|
run_search_server(engine_type="opensearch")
|
63
75
|
|
64
76
|
if __name__ == "__main__":
|
65
|
-
#
|
66
|
-
|
77
|
+
# Parse command line arguments
|
78
|
+
parser = argparse.ArgumentParser(description=f"Elasticsearch/OpenSearch MCP Server v{VERSION}")
|
79
|
+
parser.add_argument(
|
80
|
+
"engine_type",
|
81
|
+
nargs="?",
|
82
|
+
default="elasticsearch",
|
83
|
+
choices=["elasticsearch", "opensearch"],
|
84
|
+
help="Search engine type to use (default: elasticsearch)"
|
85
|
+
)
|
86
|
+
parser.add_argument(
|
87
|
+
"--transport", "-t",
|
88
|
+
default="stdio",
|
89
|
+
choices=["stdio", "streamable-http", "sse"],
|
90
|
+
help="Transport protocol to use (default: stdio)"
|
91
|
+
)
|
92
|
+
parser.add_argument(
|
93
|
+
"--host", "-H",
|
94
|
+
default="127.0.0.1",
|
95
|
+
help="Host to bind to when using HTTP transports (default: 127.0.0.1)"
|
96
|
+
)
|
97
|
+
parser.add_argument(
|
98
|
+
"--port", "-p",
|
99
|
+
type=int,
|
100
|
+
default=8000,
|
101
|
+
help="Port to bind to when using HTTP transports (default: 8000)"
|
102
|
+
)
|
103
|
+
parser.add_argument(
|
104
|
+
"--path", "-P",
|
105
|
+
help="URL path prefix for HTTP transports (default: /mcp for streamable-http, /sse for sse)"
|
106
|
+
)
|
67
107
|
|
68
|
-
|
69
|
-
if len(sys.argv) > 1:
|
70
|
-
engine_type = sys.argv[1].lower()
|
108
|
+
args = parser.parse_args()
|
71
109
|
|
72
|
-
if
|
73
|
-
|
74
|
-
|
75
|
-
|
110
|
+
# Set default path based on transport type if not specified
|
111
|
+
if args.path is None:
|
112
|
+
if args.transport == "sse":
|
113
|
+
args.path = "/sse"
|
114
|
+
else:
|
115
|
+
args.path = "/mcp"
|
116
|
+
|
117
|
+
# Run the server with the specified options
|
118
|
+
run_search_server(
|
119
|
+
engine_type=args.engine_type,
|
120
|
+
transport=args.transport,
|
121
|
+
host=args.host,
|
122
|
+
port=args.port,
|
123
|
+
path=args.path
|
124
|
+
)
|
src/version.py
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "2.0.5"
|
File without changes
|
{opensearch_mcp_server-2.0.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/entry_points.txt
RENAMED
File without changes
|
{opensearch_mcp_server-2.0.3.dist-info → opensearch_mcp_server-2.0.5.dist-info}/licenses/LICENSE
RENAMED
File without changes
|