escloud-mcp-server 0.0.1__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.
@@ -0,0 +1,8 @@
1
+ from escloud_mcp_server import server
2
+
3
+
4
+ def main():
5
+ """
6
+ Main entry point for the package.
7
+ """
8
+ server.main()
@@ -0,0 +1,3 @@
1
+ if __name__ == "__main__":
2
+ from escloud_mcp_server import main
3
+ main()
@@ -0,0 +1,22 @@
1
+ import os
2
+ import volcenginesdkcore
3
+ import volcenginesdkescloud
4
+ from dotenv import load_dotenv
5
+
6
+
7
+ def create_escloud_client(region_id: str) -> volcenginesdkescloud.ESCLOUDApi:
8
+ """创建火山引擎云搜索服务客户端"""
9
+ load_dotenv()
10
+ config = {
11
+ "ak": os.getenv("VOLC_ACCESS_KEY"),
12
+ "sk": os.getenv("VOLC_SECRET_KEY"),
13
+ }
14
+ if region_id is not None:
15
+ config["region"] = region_id
16
+
17
+ configuration = volcenginesdkcore.Configuration()
18
+ configuration.ak = config["ak"]
19
+ configuration.sk = config["sk"]
20
+ configuration.region = config["region"]
21
+ configuration.client_side_validation = True
22
+ return volcenginesdkescloud.ESCLOUDApi(volcenginesdkcore.ApiClient(configuration))
@@ -0,0 +1,29 @@
1
+ from mcp.server.fastmcp import FastMCP
2
+
3
+ from escloud_mcp_server.tools import instance_info, resource_info
4
+
5
+
6
+ class ESCloudMCPServer:
7
+ def __init__(self):
8
+ self.name = "ESCloudMCPServer"
9
+ self.mcp = FastMCP(self.name)
10
+ self._register_tools()
11
+
12
+ def _register_tools(self):
13
+ """Register tools to the mcp server."""
14
+ resource_info.register_tools(self.mcp)
15
+ instance_info.register_tools(self.mcp)
16
+
17
+ def run(self):
18
+ """Run the mcp server."""
19
+ self.mcp.run(transport="stdio")
20
+
21
+
22
+ def main():
23
+ server = ESCloudMCPServer()
24
+ server.run()
25
+
26
+
27
+ if __name__ == "__main__":
28
+ print("Start ESCloud MCP Server")
29
+ main()
@@ -0,0 +1,117 @@
1
+ import volcenginesdkescloud
2
+ from mcp.server.fastmcp import FastMCP
3
+ from mcp.types import TextContent
4
+
5
+ from escloud_mcp_server.client import create_escloud_client
6
+
7
+
8
+ def register_tools(mcp: FastMCP):
9
+ @mcp.tool()
10
+ async def escloud_describe_instance(region_id: str, instance_id: str):
11
+ """
12
+ 查询云搜索服务在指定区域下的实例详细信息,包括实例 id、名称、版本、状态、创建时间、计费类型、规格配置、标签列表、网络配置、数据迁移等信息。
13
+
14
+ :param region_id: 区域 id
15
+ :param instance_id: 实例 id
16
+ :return: 实例详细信息
17
+ """
18
+ try:
19
+ client = create_escloud_client(region_id)
20
+ response = client.describe_instance(
21
+ volcenginesdkescloud.DescribeInstanceRequest(instance_id=instance_id)
22
+ )
23
+ return TextContent(type="text", text=str(response))
24
+ except Exception as e:
25
+ return TextContent(type="text", text=f"Error: {str(e)}")
26
+
27
+ @mcp.tool()
28
+ async def escloud_describe_instances(region_id: str, zone_id=None, instance_id=None, instance_name=None,
29
+ status=None, version=None, charge_type=None, project_name=None,
30
+ page_number=1, page_size=10):
31
+ """
32
+ 查询云搜索服务在指定区域下的实例列表,包括每个实例的详细信息。
33
+
34
+ :param region_id: 区域 id
35
+ :param zone_id: 可用区 id,支持模糊查询
36
+ :param instance_id: 实例 id,支持模糊查询
37
+ :param instance_name: 实例名称,支持模糊查询
38
+ :param status: 实例状态
39
+ :param version: 实例版本
40
+ :param charge_type: 实例计费类型
41
+ :param project_name: 项目名称
42
+ :param page_number: 分页页码
43
+ :param page_size: 分页大小
44
+ :return: 实例列表
45
+ """
46
+ try:
47
+ filters = []
48
+ if zone_id:
49
+ filters.append(
50
+ volcenginesdkescloud.FilterForDescribeInstancesInput(name="ZoneId", values=[zone_id])
51
+ )
52
+ if instance_id:
53
+ filters.append(
54
+ volcenginesdkescloud.FilterForDescribeInstancesInput(name="InstanceId", values=[instance_id])
55
+ )
56
+ if instance_name:
57
+ filters.append(
58
+ volcenginesdkescloud.FilterForDescribeInstancesInput(name="InstanceName", values=[instance_name])
59
+ )
60
+ if status:
61
+ filters.append(
62
+ volcenginesdkescloud.FilterForDescribeInstancesInput(name="Status", values=[status])
63
+ )
64
+ if version:
65
+ filters.append(
66
+ volcenginesdkescloud.FilterForDescribeInstancesInput(name="Version", values=[version])
67
+ )
68
+ if charge_type:
69
+ filters.append(
70
+ volcenginesdkescloud.FilterForDescribeInstancesInput(name="ChargeType", values=[charge_type])
71
+ )
72
+
73
+ client = create_escloud_client(region_id)
74
+ response = client.describe_instances(volcenginesdkescloud.DescribeInstancesRequest(
75
+ filters=filters,
76
+ project_name=project_name,
77
+ page_number=page_number,
78
+ page_size=page_size))
79
+ return TextContent(type="text", text=str(response))
80
+ except Exception as e:
81
+ return TextContent(type="text", text=f"Error: {str(e)}")
82
+
83
+ @mcp.tool()
84
+ async def escloud_describe_instance_nodes(region_id: str, instance_id: str):
85
+ """
86
+ 查询云搜索服务在指定区域下的实例节点列表,包括每个节点的名称、类型、状态、存储配置、规格配置、重启次数等信息。
87
+
88
+ :param region_id: 区域 id
89
+ :param instance_id: 实例 id
90
+ :return: 实例节点列表
91
+ """
92
+ try:
93
+ client = create_escloud_client(region_id)
94
+ response = client.describe_instance_nodes(
95
+ volcenginesdkescloud.DescribeInstanceNodesRequest(instance_id=instance_id)
96
+ )
97
+ return TextContent(type="text", text=str(response))
98
+ except Exception as e:
99
+ return TextContent(type="text", text=f"Error: {str(e)}")
100
+
101
+ @mcp.tool()
102
+ async def escloud_describe_instance_plugins(region_id: str, instance_id: str):
103
+ """
104
+ 查询云搜索服务在指定区域下的实例的插件列表,包括每个插件的名称、版本、状态、描述等信息。
105
+
106
+ :param region_id: 区域 id
107
+ :param instance_id: 实例 id
108
+ :return: 实例插件列表
109
+ """
110
+ try:
111
+ client = create_escloud_client(region_id)
112
+ response = client.describe_instance_plugins(
113
+ volcenginesdkescloud.DescribeInstancePluginsRequest(instance_id=instance_id)
114
+ )
115
+ return TextContent(type="text", text=str(response))
116
+ except Exception as e:
117
+ return TextContent(type="text", text=f"Error: {str(e)}")
@@ -0,0 +1,24 @@
1
+ import volcenginesdkescloud
2
+ from mcp.server.fastmcp import FastMCP
3
+ from mcp.types import TextContent
4
+
5
+ from escloud_mcp_server.client import create_escloud_client
6
+
7
+
8
+ def register_tools(mcp: FastMCP):
9
+ @mcp.tool()
10
+ async def escloud_describe_zones(region_id: str):
11
+ """
12
+ 查询云搜索服务在指定区域下的可用区列表,包括可用区 id、名称、状态等信息。
13
+
14
+ :param region_id: 区域 id
15
+ :return: 可用区列表
16
+ """
17
+ try:
18
+ client = create_escloud_client(region_id)
19
+ response = client.describe_zones(
20
+ volcenginesdkescloud.DescribeZonesRequest()
21
+ )
22
+ return TextContent(type="text", text=str(response))
23
+ except Exception as e:
24
+ return TextContent(type="text", text=f"Error: {str(e)}")
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: escloud-mcp-server
3
+ Version: 0.0.1
4
+ Summary: ESCloud MCP Server
5
+ License-Expression: MIT
6
+ Requires-Python: >=3.10
7
+ Requires-Dist: mcp[cli]>=1.6.0
8
+ Requires-Dist: volcengine-python-sdk>=1.1.3
9
+ Description-Content-Type: text/markdown
10
+
11
+ # ESCloud MCP Server
12
+ This mcp server is used to provide interaction with escloud service on volcengine platform. It is a Model
13
+ Control Protocol([MCP](https://modelcontextprotocol.io/introduction)) server implementation. This server enables
14
+ querying the available zones in specific region, getting the config, nodes, plugins of instance, and more.
15
+
16
+ ## Prerequisites
17
+ Before using this mcp server, you need to install the following components:
18
+ - ak/sk for volcano engine
19
+ - python 3.10+ or higher
20
+ - [uv](https://github.com/astral-sh/uv) installed
21
+
22
+ ## Usage
23
+ Obtain ak/sk from the [volcengine](https://www.volcengine.com/): login -> right top user icon -> api access secret key.
24
+
25
+ ### Usage with Trae
26
+ TODO
27
+
28
+
29
+ ### Usage with Cline
30
+ #### Using uvx with published package
31
+ First, adding the following code to the config file `cline_mcp_settings.json`, it will automatically download the
32
+ latest published package from the registry and run it. Then you need to change `your_volcengine_ak`
33
+ and `your_volcengine_sk` to your ak and sk.
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "escloud-mcp-server": {
38
+ "disabled": false,
39
+ "timeout": 60,
40
+ "command": "uvx",
41
+ "args": [
42
+ "escloud-mcp-server"
43
+ ],
44
+ "env": {
45
+ "VOLC_ACCESS_KEY": "your_volcengine_ak",
46
+ "VOLC_SECRET_KEY": "your_volcengine_sk"
47
+ },
48
+ "transportType": "stdio"
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ #### Using uv with local development
55
+ First, cloning the repository locally and specifying the path to source code. Then add the following code to
56
+ the config file `cline_mcp_settings.json`. Last you need to change `path/to/src/escloud_mcp_server` to the path
57
+ where you cloned the repository, and change `your_volcengine_ak` and `your_volcengine_sk` to your ak and sk.
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "escloud-mcp-server": {
62
+ "disabled": false,
63
+ "timeout": 60,
64
+ "command": "uv",
65
+ "args": [
66
+ "--directory",
67
+ "path/to/src/escloud_mcp_server",
68
+ "run",
69
+ "server.py"
70
+ ],
71
+ "env": {
72
+ "VOLC_ACCESS_KEY": "your_volcengine_ak",
73
+ "VOLC_SECRET_KEY": "your_volcengine_sk"
74
+ },
75
+ "transportType": "stdio"
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## Tools
82
+ The server provides the following tools:
83
+ - `escloud_describe_zones`: query available zones in a specific region
84
+ - parameters:
85
+ - `region_id`: the id of region
86
+ - `escloud_describe_instance`: query the information of a instance
87
+ - parameters:
88
+ - `region_id`: the id of region
89
+ - `instance_id`: the id of instance
90
+ - `escloud_describe_instances`: query the information of instances
91
+ - parameters:
92
+ - `region_id`: the id of region
93
+ - `zone_id`: the id of zone, support fuzzy query
94
+ - `instance_id`: the id of instance, support fuzzy query
95
+ - `instance_name`: the name of instance, support fuzzy query
96
+ - `status`: the status of instance
97
+ - `version`: the version of instance
98
+ - `charge_type`: the charge type of instance
99
+ - `project_name`: the project name that instance belongs to
100
+ - `page_number`: the page number of the result list
101
+ - `page_size`: the page size of the result list
102
+ - `escloud_describe_instance_nodes`: query the nodes of a instance
103
+ - parameters:
104
+ - `region_id`: the id of region
105
+ - `instance_id`: the id of instance
106
+ - `escloud_describe_instance_plugins`: query the plugins of a instance
107
+ - parameters:
108
+ - `region_id`: the id of region
109
+ - `instance_id`: the id of instance
@@ -0,0 +1,10 @@
1
+ escloud_mcp_server/__init__.py,sha256=69hwKmYrDznN3ln0htzBSzI0PTXe8fm07tVpfr3jmeo,124
2
+ escloud_mcp_server/__main__.py,sha256=HMV50m6yPKI3bZflFYhmg5V9fhL4vlX4wDwFNRJiIL0,78
3
+ escloud_mcp_server/client.py,sha256=oLbwcdxoHKLOvGcAvnXZbE2zNu1pG5r_L2uFfDxk9rk,727
4
+ escloud_mcp_server/server.py,sha256=bK2A0XJykV-DI1HnijjoMiK2Jz5cxPioLEE9Uj8wet0,673
5
+ escloud_mcp_server/tools/instance_info.py,sha256=gq1i-UPopJIyaOyHd9FeDUclbW1ggNEepC9QsXJ_OFk,5119
6
+ escloud_mcp_server/tools/resource_info.py,sha256=wA4iV7M7VIpnSBPsf332PFGLFRpv7hzxq_AF349j6ks,829
7
+ escloud_mcp_server-0.0.1.dist-info/METADATA,sha256=2fKzJcL7xCVIBPFy-gum-2wxLx4iBQePYyjGo6orDow,3662
8
+ escloud_mcp_server-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
9
+ escloud_mcp_server-0.0.1.dist-info/entry_points.txt,sha256=py-13ItyIEF0rGuplu7Ll1HLY0-FM30LaoXsprwyeDk,66
10
+ escloud_mcp_server-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-server-opensearch = escloud_mcp_server:main