opensearch-mcp-server 2.0.4__py3-none-any.whl → 2.0.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensearch-mcp-server
3
- Version: 2.0.4
3
+ Version: 2.0.6
4
4
  Summary: MCP Server for interacting with Elasticsearch and OpenSearch
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -207,18 +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==0.4.1
211
- Requires-Dist: mcp==1.6.0
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
214
  Requires-Dist: tomli-w==1.2.0
215
215
  Requires-Dist: tomli==2.2.1
216
216
  Description-Content-Type: text/markdown
217
217
 
218
+
218
219
  # Elasticsearch/OpenSearch MCP Server
219
220
 
220
221
  [![smithery badge](https://smithery.ai/badge/elasticsearch-mcp-server)](https://smithery.ai/server/elasticsearch-mcp-server)
221
222
 
223
+ [![MseeP.ai Security Assessment Badge](https://mseep.net/pr/cr7258-elasticsearch-mcp-server-badge.png)](https://mseep.ai/app/cr7258-elasticsearch-mcp-server)
224
+
222
225
  ## Overview
223
226
 
224
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.
@@ -282,19 +285,11 @@ The default Elasticsearch username is `elastic` and password is `test123`. The d
282
285
 
283
286
  You can access Kibana/OpenSearch Dashboards from http://localhost:5601.
284
287
 
285
- ## Usage with Claude Desktop
286
-
287
- ### Option 1: Installing via Smithery
288
+ ## Stdio
288
289
 
289
- To install Elasticsearch Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/elasticsearch-mcp-server):
290
-
291
- ```bash
292
- npx -y @smithery/cli install elasticsearch-mcp-server --client claude
293
- ```
290
+ ### Option 1: Using uvx
294
291
 
295
- ### Option 2: Using uvx
296
-
297
- 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`.
298
293
 
299
294
  ```json
300
295
  // For Elasticsearch
@@ -332,7 +327,7 @@ Using `uvx` will automatically install the package from PyPI, no need to clone t
332
327
  }
333
328
  ```
334
329
 
335
- ### Option 3: Using uv with local development
330
+ ### Option 2: Using uv with local development
336
331
 
337
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`.
338
333
 
@@ -378,20 +373,24 @@ Using `uv` requires cloning the repository locally and specifying the path to th
378
373
  }
379
374
  ```
380
375
 
381
- - On macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
382
- - On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
376
+ ## SSE
383
377
 
384
- Restart Claude Desktop to load the new MCP server.
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-mcp-server --transport sse
385
381
 
386
- Now you can interact with your Elasticsearch/OpenSearch cluster through Claude using natural language commands like:
387
- - "List all indices in the cluster"
388
- - "How old is the student Bob?"
389
- - "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-mcp-server --transport sse --host 0.0.0.0 --port 8000 --path /sse
384
+ ```
390
385
 
391
- ## Usage with Anthropic MCP Client
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-mcp-server --transport streamable-http
392
391
 
393
- ```python
394
- uv run mcp_client/client.py src/server.py
392
+ # The host, port, and path can be specified using the --host, --port, and --path options
393
+ uv run src/server.py elasticsearch-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp
395
394
  ```
396
395
 
397
396
  ## License
@@ -1,6 +1,6 @@
1
1
  src/__init__.py,sha256=aNKcThftSLh9IjOTA-UUpoRzIm4R0WwXKGAzykwecmU,211
2
- src/server.py,sha256=Gf5sPXmuG4Jos82ks0LPFNWWbMGEIUfoKm8ibOHmx_A,2287
3
- src/version.py,sha256=ZOg41aCgKEuObK5WhegikXektFWPJaeZ-TMDh0Ke95M,22
2
+ src/server.py,sha256=BfMAgXTFV9C4waCWRro8Sfl6yXEXr2vJ7YoGY7HhMPY,5072
3
+ src/version.py,sha256=4Yxft_MNOtwQG58mZpa8eoM0XBHa8VNkTPH9_i0gDaM,22
4
4
  src/clients/__init__.py,sha256=3UezAt9422S-7BvMiCo2Y9pmATVutorwsIQXP_g_CkA,1221
5
5
  src/clients/base.py,sha256=MBAGepXyHPtdbtHhxFB8CamZ2ApWCBuOi_6-ey-MqX8,3298
6
6
  src/clients/exceptions.py,sha256=NYF3KVw-9aAgCViin5OuBI6miMEPS5QsdHx6bcis1wc,2493
@@ -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.4.dist-info/METADATA,sha256=L_fxn1Xf85fqRa4eRfxOct1WJCdnVZA3fDT9SwxUtdc,18688
22
- opensearch_mcp_server-2.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- opensearch_mcp_server-2.0.4.dist-info/entry_points.txt,sha256=ImfJnUwMpQUBmu-1MeBG_P0dwamfXKQh82mBKW7tWNY,138
24
- opensearch_mcp_server-2.0.4.dist-info/licenses/LICENSE,sha256=DBsjuP5FR51d9kaUdXlVBuBv3cQ_I_adq9gefYQ9FcY,11339
25
- opensearch_mcp_server-2.0.4.dist-info/RECORD,,
21
+ opensearch_mcp_server-2.0.6.dist-info/METADATA,sha256=szezVrGvLMf08Ajp-9r7Cww0m4VBKDbD3zU2KJC9wgQ,18791
22
+ opensearch_mcp_server-2.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ opensearch_mcp_server-2.0.6.dist-info/entry_points.txt,sha256=ImfJnUwMpQUBmu-1MeBG_P0dwamfXKQh82mBKW7tWNY,138
24
+ opensearch_mcp_server-2.0.6.dist-info/licenses/LICENSE,sha256=DBsjuP5FR51d9kaUdXlVBuBv3cQ_I_adq9gefYQ9FcY,11339
25
+ opensearch_mcp_server-2.0.6.dist-info/RECORD,,
src/server.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import sys
3
+ import argparse
3
4
 
4
5
  from fastmcp import FastMCP
5
6
 
@@ -16,7 +17,7 @@ class SearchMCPServer:
16
17
  def __init__(self, engine_type):
17
18
  # Set engine type
18
19
  self.engine_type = engine_type
19
- self.name = f"{self.engine_type}_mcp_server"
20
+ self.name = f"{self.engine_type}-mcp-server"
20
21
  self.mcp = FastMCP(self.name)
21
22
  self.logger = logging.getLogger()
22
23
  self.logger.info(f"Initializing {self.name}, Version: {VERSION}")
@@ -43,32 +44,115 @@ class SearchMCPServer:
43
44
  # Register all tools
44
45
  register.register_all_tools(tool_classes)
45
46
 
46
- def run(self):
47
- """Run the MCP server."""
48
- self.mcp.run()
49
47
 
50
- def run_search_server(engine_type):
51
- """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
+
52
59
  server = SearchMCPServer(engine_type=engine_type)
53
- server.run()
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)
67
+
68
+ def parse_server_args():
69
+ """Parse command line arguments for the MCP server.
70
+
71
+ Returns:
72
+ Parsed arguments
73
+ """
74
+ parser = argparse.ArgumentParser()
75
+ parser.add_argument(
76
+ "--transport", "-t",
77
+ default="stdio",
78
+ choices=["stdio", "streamable-http", "sse"],
79
+ help="Transport protocol to use (default: stdio)"
80
+ )
81
+ parser.add_argument(
82
+ "--host", "-H",
83
+ default="127.0.0.1",
84
+ help="Host to bind to when using HTTP transports (default: 127.0.0.1)"
85
+ )
86
+ parser.add_argument(
87
+ "--port", "-p",
88
+ type=int,
89
+ default=8000,
90
+ help="Port to bind to when using HTTP transports (default: 8000)"
91
+ )
92
+ parser.add_argument(
93
+ "--path", "-P",
94
+ help="URL path prefix for HTTP transports (default: /mcp for streamable-http, /sse for sse)"
95
+ )
96
+
97
+ args = parser.parse_args()
98
+
99
+ # Set default path based on transport type if not specified
100
+ if args.path is None:
101
+ if args.transport == "sse":
102
+ args.path = "/sse"
103
+ else:
104
+ args.path = "/mcp"
105
+
106
+ return args
54
107
 
55
108
  def elasticsearch_mcp_server():
56
109
  """Entry point for Elasticsearch MCP server."""
57
- run_search_server(engine_type="elasticsearch")
110
+ args = parse_server_args()
111
+
112
+ # Run the server with the specified options
113
+ run_search_server(
114
+ engine_type="elasticsearch",
115
+ transport=args.transport,
116
+ host=args.host,
117
+ port=args.port,
118
+ path=args.path
119
+ )
58
120
 
59
121
  def opensearch_mcp_server():
60
122
  """Entry point for OpenSearch MCP server."""
61
- run_search_server(engine_type="opensearch")
123
+ args = parse_server_args()
124
+
125
+ # Run the server with the specified options
126
+ run_search_server(
127
+ engine_type="opensearch",
128
+ transport=args.transport,
129
+ host=args.host,
130
+ port=args.port,
131
+ path=args.path
132
+ )
62
133
 
63
134
  if __name__ == "__main__":
64
- # Default to Elasticsearch
65
- engine_type = "elasticsearch"
135
+ # Require elasticsearch-mcp-server or opensearch-mcp-server as the first argument
136
+ if len(sys.argv) <= 1 or sys.argv[1] not in ["elasticsearch-mcp-server", "opensearch-mcp-server"]:
137
+ print("Error: First argument must be 'elasticsearch-mcp-server' or 'opensearch-mcp-server'")
138
+ sys.exit(1)
139
+
140
+ # Determine engine type based on the first argument
141
+ engine_type = "elasticsearch" # Default
142
+ if sys.argv[1] == "opensearch-mcp-server":
143
+ engine_type = "opensearch"
144
+
145
+ # Remove the first argument so it doesn't interfere with argparse
146
+ sys.argv.pop(1)
66
147
 
67
- # If command line arguments are provided, use the first argument as the engine type
68
- if len(sys.argv) > 1:
69
- engine_type = sys.argv[1].lower()
148
+ # Parse command line arguments
149
+ args = parse_server_args()
70
150
 
71
- if engine_type == "opensearch":
72
- opensearch_mcp_server()
73
- else:
74
- elasticsearch_mcp_server()
151
+ # Run the server with the specified options
152
+ run_search_server(
153
+ engine_type=engine_type,
154
+ transport=args.transport,
155
+ host=args.host,
156
+ port=args.port,
157
+ path=args.path
158
+ )
src/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.0.4"
1
+ __version__ = "2.0.6"