Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions server/mcp_server_vefaas_function/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies = [
"volcengine-python-sdk>=3.0.8",
"requests==2.32.3",
"pyzipper==0.3.6",
"pathspec>=0.12.0",
]

[project.scripts]
Expand All @@ -20,3 +21,6 @@ build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.autopep8]
max_line_length = 240
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
Service = "apig"
Version = "2021-03-03"
Region = "cn-beijing"
Host = "iam.volcengineapi.com"
Host = "open.volcengineapi.com"
ContentType = "application/x-www-form-urlencoded"

AK_KEY = "VOLCENGINE_ACCESS_KEY"
Expand All @@ -62,7 +62,7 @@ def norm_query(params):
if type(params[key]) == list:
for k in params[key]:
query = (
query + quote(key, safe="-_.~") + "=" + quote(k, safe="-_.~") + "&"
query + quote(key, safe="-_.~") + "=" + quote(k, safe="-_.~") + "&"
)
else:
query = (query + quote(key, safe="-_.~") + "=" + quote(params[key], safe="-_.~") + "&")
Expand All @@ -82,7 +82,7 @@ def hash_sha256(content: str):


# 第二步:签名请求函数
def request(method, date, query, header, ak, sk, token, action, body, region = None, timeout=None):
def request(method, date, query, header, ak, sk, token, action, body, region=None, timeout=None):
# 第三步:创建身份证明。其中的 Service 和 Region 字段是固定的。ak 和 sk 分别代表
# AccessKeyID 和 SecretAccessKey。同时需要初始化签名结构体。一些签名计算时需要的属性也在这里处理。
# 初始化身份证明结构体
Expand All @@ -99,7 +99,8 @@ def request(method, date, query, header, ak, sk, token, action, body, region = N

if action in ['CodeUploadCallback', 'CreateDependencyInstallTask', 'GetDependencyInstallTaskStatus',
'GetDependencyInstallTaskLogDownloadURI', "ListApplicationTemplates", "GetApplicationTemplateDetail", "GetRevision",
"CreateApplication", "GetApplication", "ReleaseApplication", "ListTriggers", "GetApplicationRevisionLog", "ListTemplates", "GetTemplateDetail"]:
"CreateApplication", "GetApplication", "ReleaseApplication", "ListTriggers", "GetApplicationRevisionLog", "ListTemplates", "GetTemplateDetail",
"GenTempTosObjectUrl", "ListApplications", "CreateFunction", "UpdateFunction", "GetFunction", "Release", "GetReleaseStatus"]:
credential["service"] = "vefaas"

content_type = ContentType
Expand Down Expand Up @@ -150,11 +151,11 @@ def request(method, date, query, header, ak, sk, token, action, body, region = N
"x-content-sha256:" + x_content_sha256,
"x-date:" + x_date,
]
),
"",
signed_headers_str,
x_content_sha256,
]
),
"",
signed_headers_str,
x_content_sha256,
]
)

# 打印正规化的请求用于调试比对
Expand Down Expand Up @@ -195,13 +196,13 @@ def request(method, date, query, header, ak, sk, token, action, body, region = N
def get_authorization_credentials(ctx: Context = None) -> tuple[str, str, str]:
"""
Gets authorization credentials from either environment variables or request headers.

Args:
ctx: The server context object

Returns:
tuple: (access_key, secret_key, session_token)

Raises:
ValueError: If authorization information is missing or invalid
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates
# SPDX-License-Identifier: MIT

"""veFaaS CLI SDK - Ported capabilities from vefaas-cli (TypeScript)"""

from .detector import auto_detect, DetectionResult
from .deploy import (
DeployConfig,
DeployResult,
VeFaaSClient,
deploy_application,
get_console_url,
get_application_console_url,
extract_access_url_from_cloud_resource,
wait_for_function_release,
wait_for_application_deploy,
wait_for_dependency_install,
)
from .config import (
VefaasConfig,
FunctionConfig,
TriggerConfig,
read_config,
write_config,
get_linked_ids,
get_linked_region,
)

__all__ = [
# Detector
"auto_detect",
"DetectionResult",
# Deploy
"DeployConfig",
"DeployResult",
"VeFaaSClient",
"deploy_application",
"get_console_url",
"get_application_console_url",
"extract_access_url_from_cloud_resource",
"wait_for_function_release",
"wait_for_application_deploy",
"wait_for_dependency_install",
# Config
"VefaasConfig",
"FunctionConfig",
"TriggerConfig",
"read_config",
"write_config",
"get_linked_ids",
"get_linked_region",
]
Loading