alibaba-cloud-ops-mcp-server 0.9.14__py3-none-any.whl → 0.9.15__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.
@@ -192,7 +192,7 @@ def find_bucket_by_tag(client: oss.Client, tag_key: str, tag_value: str) -> Opti
192
192
  return buckets[0] if buckets else None
193
193
 
194
194
 
195
- def get_or_create_bucket_for_code_deploy(application_name: str, region_id: str) -> str:
195
+ def get_or_create_bucket_for_code_deploy(application_name: str) -> str:
196
196
  """
197
197
  Obtain or create an OSS bucket for code deployment
198
198
 
@@ -206,17 +206,14 @@ def get_or_create_bucket_for_code_deploy(application_name: str, region_id: str)
206
206
  """
207
207
  tag_key = 'app_management'
208
208
  tag_value = 'code_deploy'
209
- client = create_oss_client(region_id=region_id)
209
+ client = create_oss_client(region_id='cn-hangzhou')
210
210
 
211
211
  found_bucket = find_bucket_by_tag(client, tag_key, tag_value)
212
212
  if found_bucket:
213
213
  logger.info(f"[code_deploy] Found existing bucket by tag: {found_bucket}")
214
214
  return found_bucket
215
215
 
216
- safe_app_name = application_name.lower().replace('_', '-').replace(' ', '-')
217
-
218
- safe_app_name = ''.join(c if c.isalnum() or c == '-' else '' for c in safe_app_name)
219
- bucket_name = f'app-{safe_app_name}-code-deploy-{str(uuid.uuid4())[:8]}'
216
+ bucket_name = f'code-deploy-{str(uuid.uuid4())[:8]}'
220
217
 
221
218
  try:
222
219
  client.put_bucket(oss.PutBucketRequest(
@@ -150,19 +150,16 @@ def _tools_api_call(service: str, api: str, parameters: dict, ctx: Context):
150
150
  except UnretryableException as e:
151
151
  last_exception = e
152
152
  error_msg = str(e)
153
- # 检查错误消息是否包含 [Errno 9] Bad file descriptor
154
153
  has_bad_fd = '[Errno 9] Bad file descriptor' in error_msg
155
154
 
156
155
  if has_bad_fd and attempt < max_retries - 1:
157
- wait_time = (attempt + 1) * 1 # 递增等待时间:1秒、2秒
156
+ wait_time = (attempt + 1) * 0.5
158
157
  logger.warning(f'[_tools_api_call] UnretryableException with [Errno 9] Bad file descriptor (attempt {attempt + 1}/{max_retries}), retrying after {wait_time}s: {e}')
159
158
  time.sleep(wait_time)
160
159
  else:
161
- # 如果不是可重试的错误,或者已经重试了3次,直接抛出异常
162
160
  logger.error(f'Call API Error: {e}')
163
161
  raise e
164
-
165
- # 如果所有重试都失败了,抛出最后一次的异常
162
+
166
163
  if last_exception:
167
164
  logger.error(f'[_tools_api_call] All retries failed, raising last exception: {last_exception}')
168
165
  raise last_exception
@@ -47,13 +47,9 @@ def OOS_CodeDeploy(
47
47
  name: str = Field(description='name of the application'),
48
48
  deploy_region_id: str = Field(description='Region ID for deployment'),
49
49
  application_group_name: str = Field(description='name of the application group'),
50
- region_id_oss: str = Field(description='OSS region ID'),
51
50
  object_name: str = Field(description='OSS object name'),
52
51
  file_path: str = Field(description='Local file path to upload. If the file is not in '
53
52
  '.code_deploy/release directory, it will be copied there.'),
54
- is_internal_oss: bool = Field(description='Whether to download OSS files through internal network. Note: '
55
- 'If you choose internal network download, you must ensure that '
56
- 'the ECS to be deployed and OSS are in the same region.'),
57
53
  application_start: str = Field(
58
54
  description='Application start command script. IMPORTANT: If the uploaded artifact '
59
55
  'is a tar archive or compressed package (e.g., .tar, .tar.gz, .zip), '
@@ -242,7 +238,8 @@ def OOS_CodeDeploy(
242
238
  file_path = str(release_path_resolved)
243
239
  else:
244
240
  logger.info(f"[code_deploy] File already in release directory: {file_path}")
245
-
241
+ region_id_oss = 'cn-hangzhou'
242
+ is_internal_oss = True if deploy_region_id.lower() == 'cn-hangzhou' else False
246
243
  # Log input parameters
247
244
  logger.info(f"[code_deploy] Input parameters: name={name}, deploy_region_id={deploy_region_id}, "
248
245
  f"application_group_name={application_group_name}, instance_ids={instance_ids}, "
@@ -250,7 +247,7 @@ def OOS_CodeDeploy(
250
247
  f"is_internal_oss={is_internal_oss}, port={port}")
251
248
 
252
249
  # Upload file to OSS
253
- bucket_name = get_or_create_bucket_for_code_deploy(name, region_id_oss)
250
+ bucket_name = get_or_create_bucket_for_code_deploy(name)
254
251
  logger.info(f"[code_deploy] Auto selected/created bucket: {bucket_name}")
255
252
 
256
253
  put_object_resp = oss_tools.OSS_PutObject(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alibaba-cloud-ops-mcp-server
3
- Version: 0.9.14
3
+ Version: 0.9.15
4
4
  Summary: A MCP server for Alibaba Cloud
5
5
  Author-email: Zheng Dayu <dayu.zdy@alibaba-inc.com>, Zhao Shuaibo <zhaoshuaibo.zsb@alibaba-inc.com>
6
6
  License-File: LICENSE
@@ -6,19 +6,19 @@ alibaba_cloud_ops_mcp_server/settings.py,sha256=R1jvMtgErWn_1MZ2Gq3xzBZeMtkGpSHv
6
6
  alibaba_cloud_ops_mcp_server/alibabacloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  alibaba_cloud_ops_mcp_server/alibabacloud/api_meta_client.py,sha256=t2TSc0Gzcy_uEcaCgiHHuLoMiEGu3-NCtYmwYjyPWsY,7973
8
8
  alibaba_cloud_ops_mcp_server/alibabacloud/exception.py,sha256=7PdhgqgXEGrTPL1cj98h9EH-RrM6-2TT89PDtcmlpmU,1230
9
- alibaba_cloud_ops_mcp_server/alibabacloud/utils.py,sha256=J3fywpnqMvIX19Fw87sKlKSxwWGjQcje8sRTMVAUZvg,8271
9
+ alibaba_cloud_ops_mcp_server/alibabacloud/utils.py,sha256=lGjwsq-Igptz52_3AALSRJLtVsP815b4nSQCfxhIiUo,8068
10
10
  alibaba_cloud_ops_mcp_server/alibabacloud/static/PROMPT_UNDERSTANDING.md,sha256=QPubudP1bwDbWu0Js6MYb4cJd1B2zM_JGp53twYv5yc,3611
11
11
  alibaba_cloud_ops_mcp_server/alibabacloud/static/__init__.py,sha256=wJrYamaIb7e_kA4ILZpdP1f1TUUTXMGqEhA4IbSZ2Ts,230
12
12
  alibaba_cloud_ops_mcp_server/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- alibaba_cloud_ops_mcp_server/tools/api_tools.py,sha256=GFjummXzLDiPr8QQ_2LYmblhUXRxKw1E6Z1ZazmISSA,10910
14
- alibaba_cloud_ops_mcp_server/tools/application_management_tools.py,sha256=Bivn1UXBzWcdJj3EWzO4EpXiGAdVn18dZJVxVe1RpvI,35363
13
+ alibaba_cloud_ops_mcp_server/tools/api_tools.py,sha256=n7FLDAlnTSIk38iQqT1ABwAskIyswO_tBGTm34SPMpg,10632
14
+ alibaba_cloud_ops_mcp_server/tools/application_management_tools.py,sha256=B3Otl46o9T2StEbe1yaKnerqjctZgEHuLMu4dHeQseE,35060
15
15
  alibaba_cloud_ops_mcp_server/tools/cms_tools.py,sha256=BmPTiP8wu9DsEHBQsvR7JH9nFkcKMTBuNuafFqSfVxU,4308
16
16
  alibaba_cloud_ops_mcp_server/tools/common_api_tools.py,sha256=ccQAWqS1I9F-fdOdjLcXN-dIhNqSbZV8T5ODuGXlfXM,2711
17
17
  alibaba_cloud_ops_mcp_server/tools/local_tools.py,sha256=Sl7Vl2mVQMLyMIZQDLoE-xVF0vNz_haMEspyYPDe6Sg,13133
18
18
  alibaba_cloud_ops_mcp_server/tools/oos_tools.py,sha256=cPEl05Y0rlNvCeO2SF46Y7Ewky4LXZ8__sD0_JCi8ek,13569
19
19
  alibaba_cloud_ops_mcp_server/tools/oss_tools.py,sha256=6yKo1FqQN3n9I-eDUW8MrnIZTHthy-worKc8XIsn-Nw,7427
20
- alibaba_cloud_ops_mcp_server-0.9.14.dist-info/METADATA,sha256=EsGiCnz8252l848ovAPAsNXNjCTOJGbRLTg1cO0wjLI,8794
21
- alibaba_cloud_ops_mcp_server-0.9.14.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
22
- alibaba_cloud_ops_mcp_server-0.9.14.dist-info/entry_points.txt,sha256=ESGAWXKEp184forhs7VzTD4P1AUdZz6vCW6hRUKITGw,83
23
- alibaba_cloud_ops_mcp_server-0.9.14.dist-info/licenses/LICENSE,sha256=gQgVkp2ttRCjodiPpXZZR-d7JnrYIYNiHk1YDUYgpa4,11331
24
- alibaba_cloud_ops_mcp_server-0.9.14.dist-info/RECORD,,
20
+ alibaba_cloud_ops_mcp_server-0.9.15.dist-info/METADATA,sha256=uB0lXqAEtEFLRaz79bhXwQF2r7gbEhBjxXn7CGpBhrI,8794
21
+ alibaba_cloud_ops_mcp_server-0.9.15.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
22
+ alibaba_cloud_ops_mcp_server-0.9.15.dist-info/entry_points.txt,sha256=ESGAWXKEp184forhs7VzTD4P1AUdZz6vCW6hRUKITGw,83
23
+ alibaba_cloud_ops_mcp_server-0.9.15.dist-info/licenses/LICENSE,sha256=gQgVkp2ttRCjodiPpXZZR-d7JnrYIYNiHk1YDUYgpa4,11331
24
+ alibaba_cloud_ops_mcp_server-0.9.15.dist-info/RECORD,,