opensearch-mcp-server 2.0.5__py3-none-any.whl → 2.0.7__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.5
3
+ Version: 2.0.7
4
4
  Summary: MCP Server for interacting with Elasticsearch and OpenSearch
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -375,22 +375,56 @@ Using `uv` requires cloning the repository locally and specifying the path to th
375
375
 
376
376
  ## SSE
377
377
 
378
+ ### Option 1: Using uvx
379
+
380
+ ```bash
381
+ # export environment variables
382
+ export ELASTICSEARCH_HOSTS="https://localhost:9200"
383
+ export ELASTICSEARCH_USERNAME="elastic"
384
+ export ELASTICSEARCH_PASSWORD="test123"
385
+
386
+ # By default, the SSE MCP server will serve on http://127.0.0.1:8000/sse
387
+ uvx elasticsearch-mcp-server --transport sse
388
+
389
+ # The host, port, and path can be specified using the --host, --port, and --path options
390
+ uvx elasticsearch-mcp-server --transport sse --host 0.0.0.0 --port 8000 --path /sse
391
+ ```
392
+
393
+ ### Option 2: Using uv
394
+
378
395
  ```bash
379
396
  # 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
397
+ uv run src/server.py elasticsearch-mcp-server --transport sse
381
398
 
382
399
  # 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
400
+ uv run src/server.py elasticsearch-mcp-server --transport sse --host 0.0.0.0 --port 8000 --path /sse
384
401
  ```
385
402
 
386
403
  ## Streamable HTTP
387
404
 
405
+ ### Option 1: Using uvx
406
+
407
+ ```bash
408
+ # export environment variables
409
+ export ELASTICSEARCH_HOSTS="https://localhost:9200"
410
+ export ELASTICSEARCH_USERNAME="elastic"
411
+ export ELASTICSEARCH_PASSWORD="test123"
412
+
413
+ # By default, the Streamable HTTP MCP server will serve on http://127.0.0.1:8000/mcp
414
+ uvx elasticsearch-mcp-server --transport streamable-http
415
+
416
+ # The host, port, and path can be specified using the --host, --port, and --path options
417
+ uvx elasticsearch-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp
418
+ ```
419
+
420
+ ### Option 2: Using uv
421
+
388
422
  ```bash
389
423
  # 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
424
+ uv run src/server.py elasticsearch-mcp-server --transport streamable-http
391
425
 
392
426
  # 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
427
+ uv run src/server.py elasticsearch-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp
394
428
  ```
395
429
 
396
430
  ## License
@@ -1,6 +1,6 @@
1
1
  src/__init__.py,sha256=aNKcThftSLh9IjOTA-UUpoRzIm4R0WwXKGAzykwecmU,211
2
- src/server.py,sha256=UTRN7Wk1njdLpF2Aa7G-dAyq04FOU3cGK1wNZGqSw3U,4154
3
- src/version.py,sha256=xEb7Z4b8xalXXExBg42XPAhbJKniHzcsEPjp-6S3ppg,22
2
+ src/server.py,sha256=BfMAgXTFV9C4waCWRro8Sfl6yXEXr2vJ7YoGY7HhMPY,5072
3
+ src/version.py,sha256=L4aOgvDE9n_eqL_mM_j5bO3bQ73q6ulNpnVuG8OmqWE,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.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,,
21
+ opensearch_mcp_server-2.0.7.dist-info/METADATA,sha256=Q5XUQGbTdSnuUbE1WokgN6FPR5c8siII_EwvyLjdly8,19863
22
+ opensearch_mcp_server-2.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ opensearch_mcp_server-2.0.7.dist-info/entry_points.txt,sha256=ImfJnUwMpQUBmu-1MeBG_P0dwamfXKQh82mBKW7tWNY,138
24
+ opensearch_mcp_server-2.0.7.dist-info/licenses/LICENSE,sha256=DBsjuP5FR51d9kaUdXlVBuBv3cQ_I_adq9gefYQ9FcY,11339
25
+ opensearch_mcp_server-2.0.7.dist-info/RECORD,,
src/server.py CHANGED
@@ -17,7 +17,7 @@ class SearchMCPServer:
17
17
  def __init__(self, engine_type):
18
18
  # Set engine type
19
19
  self.engine_type = engine_type
20
- self.name = f"{self.engine_type}_mcp_server"
20
+ self.name = f"{self.engine_type}-mcp-server"
21
21
  self.mcp = FastMCP(self.name)
22
22
  self.logger = logging.getLogger()
23
23
  self.logger.info(f"Initializing {self.name}, Version: {VERSION}")
@@ -65,24 +65,13 @@ def run_search_server(engine_type, transport, host, port, path):
65
65
  server.logger.info(f"Starting {server.name} with {transport} transport")
66
66
  server.mcp.run(transport=transport)
67
67
 
68
- def elasticsearch_mcp_server():
69
- """Entry point for Elasticsearch MCP server."""
70
- run_search_server(engine_type="elasticsearch")
71
-
72
- def opensearch_mcp_server():
73
- """Entry point for OpenSearch MCP server."""
74
- run_search_server(engine_type="opensearch")
75
-
76
- if __name__ == "__main__":
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
- )
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()
86
75
  parser.add_argument(
87
76
  "--transport", "-t",
88
77
  default="stdio",
@@ -113,12 +102,57 @@ if __name__ == "__main__":
113
102
  args.path = "/sse"
114
103
  else:
115
104
  args.path = "/mcp"
105
+
106
+ return args
107
+
108
+ def elasticsearch_mcp_server():
109
+ """Entry point for Elasticsearch MCP server."""
110
+ args = parse_server_args()
116
111
 
117
112
  # Run the server with the specified options
118
113
  run_search_server(
119
- engine_type=args.engine_type,
114
+ engine_type="elasticsearch",
120
115
  transport=args.transport,
121
116
  host=args.host,
122
117
  port=args.port,
123
118
  path=args.path
124
- )
119
+ )
120
+
121
+ def opensearch_mcp_server():
122
+ """Entry point for OpenSearch MCP server."""
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
+ )
133
+
134
+ if __name__ == "__main__":
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)
147
+
148
+ # Parse command line arguments
149
+ args = parse_server_args()
150
+
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.5"
1
+ __version__ = "2.0.7"