File tree Expand file tree Collapse file tree
use-configmap/files/support-files
use-custom-docker-image/my-apigw-manager/support-files
django/use-custom-script/support-files Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## Change logs
22
3+ ### 4.2.3
4+
5+ - 支持同步网关环境 MCP Server 配置,新增 Django Command ` sync_apigw_stage_mcp_servers `
6+ - 基础镜像 sync-apigateway.sh 支持通过环境变量 ` ENABLE_SYNC_MCP_SERVERS=true ` 开启 MCP Server 同步
7+ - DRF 集成支持 MCP Server 配置生成与同步(` gen_apigateway_resource_config ` 新增 ` enable_mcp ` /` none_schema ` 参数)
8+ - 完善 examples 中的 definition.yaml 和 sync-apigateway.sh 样例,添加 MCP Server 配置示例
9+
310### 4.1.0
411
512- [ breaking change] 做了多租户改造的全租户应用必须显式设置 ` BK_APP_TENANT_ID=system ` (环境变量或django settings)
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ call_definition_command_or_exit create_version_and_release_apigw "${definition_f
2727
2828if [[ " ${ENABLE_SYNC_MCP_SERVERS} " = " true" ]]; then
2929 title " syncing stage MCP Servers"
30- call_definition_command_or_exit sync_apigw_stage_mcp_servers " ${definition_file} "
30+ call_definition_command_or_exit sync_apigw_stage_mcp_servers " ${definition_file} " ${SYNC_APIGW_STAGE_MCP_SERVERS_ARGS}
3131fi
3232
3333log_info " done"
Original file line number Diff line number Diff line change 3333- ` SYNC_RESOURCE_DOCS_BY_ARCHIVE_ARGS ` : 默认值: "--safe-mode",用于命令 ` sync_resource_docs_by_archive ` ,同步网关文档
3434- ` CREATE_VERSION_AND_RELEASE_APIGW_ARGS ` : 默认值:"--generate-sdks",用于命令 ` create_version_and_release_apigw ` ,创建资源版本并发布
3535- ` ENABLE_SYNC_MCP_SERVERS ` : 用于命令 ` sync_apigw_stage_mcp_servers ` , 是否开启同步环境 MCP Server
36+ - ` SYNC_APIGW_STAGE_MCP_SERVERS_ARGS ` : 用于命令 ` sync_apigw_stage_mcp_servers ` ,同步环境 MCP Server 的额外参数
3637
3738基础镜像提供了一些自定义同步脚本常用的 bash 函数,以及执行 Django Command 指令的辅助脚本:
3839
@@ -87,6 +88,9 @@ title "releasing"
8788# 指定参数 --no-pub 则只生成版本,不发布
8889call_definition_command_or_exit create_version_and_release_apigw " ${definition_file} " --gateway-name=${gateway_name}
8990
91+ # 可选:需要同步 MCP Server 时调用。注意:前提是该 stage 有生效的版本且声明的 mcp tool 在生效版本的资源列表里且确认过请求参数
92+ # call_definition_command_or_exit sync_apigw_stage_mcp_servers "${definition_file}" --gateway-name=${gateway_name}
93+
9094log_info " done"
9195```
9296
@@ -314,4 +318,7 @@ call_definition_command_or_exit sync_apigw_stage "${definition_file}" --gateway-
314318
315319# 可选,同步资源文档
316320call_definition_command_or_exit sync_resource_docs_by_archive " ${definition_file} " --gateway-name=${gateway_name} --safe-mode
321+
322+ # 可选:需要同步 MCP Server 时调用。注意:前提是该 stage 有生效的版本且声明的 mcp tool 在生效版本的资源列表里且确认过请求参数
323+ # call_definition_command_or_exit sync_apigw_stage_mcp_servers "${definition_file}" --gateway-name=${gateway_name}
317324```
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ call_definition_command_or_exit create_version_and_release_apigw "${definition_f
3232
3333if [[ " ${ENABLE_SYNC_MCP_SERVERS} " = " true" ]]; then
3434 title " syncing stage MCP Servers"
35- call_definition_command_or_exit sync_apigw_stage_mcp_servers " ${definition_file} "
35+ call_definition_command_or_exit sync_apigw_stage_mcp_servers " ${definition_file} " --gateway-name= ${gateway_name}
3636fi
3737
3838log_info " done"
Original file line number Diff line number Diff line change @@ -26,6 +26,28 @@ stages:
2626 # 网关调用后端服务的默认域名或IP,不包含Path,比如:http://api.example.com
2727 - host : " https://httpbin.org"
2828 weight : 100
29+
30+ # 同步 MCP Server 相关配置(可选)
31+ # mcp_servers:
32+ # - name: "mcp_server1"
33+ # # MCP Server 中文名/显示名称
34+ # title: "MCP Server 示例"
35+ # description: "mcp-server demo"
36+ # labels:
37+ # - "test"
38+ # # 添加的 tool 对应的资源名称
39+ # resource_names:
40+ # - resource1
41+ # # 是否公开
42+ # is_public: true
43+ # # 1: 开启, 0: 停止; 默认是开启
44+ # status: 1
45+ # # MCP 协议类型: sse(默认)、streamable_http
46+ # protocol_type: "sse"
47+ # # 授权的应用
48+ # target_app_codes:
49+ # - "bk_app_code1"
50+
2951 # 环境插件配置
3052 # plugin_configs:
3153 # - type: bk-rate-limit
Original file line number Diff line number Diff line change @@ -30,11 +30,9 @@ title "releasing"
3030# 指定参数 --no-pub 则只生成版本,不发布
3131call_definition_command_or_exit create_version_and_release_apigw " ${definition_file} " --gateway-name=${gateway_name}
3232
33- title " done"
34-
35- if [[ " ${ENABLE_MCP_SERVER} " = " true" ]]; then
33+ if [[ " ${ENABLE_SYNC_MCP_SERVERS} " = " true" ]]; then
3634 title " syncing stage MCP Servers"
37- call_definition_command_or_exit sync_apigw_stage_mcp_servers " ${definition_file} "
35+ call_definition_command_or_exit sync_apigw_stage_mcp_servers " ${definition_file} " --gateway-name= ${gateway_name}
3836fi
3937
4038log_info " done"
Original file line number Diff line number Diff line change @@ -27,6 +27,27 @@ stages:
2727 - host : " https://httpbin.org"
2828 weight : 100
2929
30+ # 同步 MCP Server 相关配置(可选)
31+ # mcp_servers:
32+ # - name: "mcp_server1"
33+ # # MCP Server 中文名/显示名称
34+ # title: "MCP Server 示例"
35+ # description: "mcp-server demo"
36+ # labels:
37+ # - "test"
38+ # # 添加的 tool 对应的资源名称
39+ # resource_names:
40+ # - resource1
41+ # # 是否公开
42+ # is_public: true
43+ # # 1: 开启, 0: 停止; 默认是开启
44+ # status: 1
45+ # # MCP 协议类型: sse(默认)、streamable_http
46+ # protocol_type: "sse"
47+ # # 授权的应用
48+ # target_app_codes:
49+ # - "bk_app_code1"
50+
3051 # 环境插件配置
3152 # plugin_configs:
3253 # - type: bk-rate-limit
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ python manage.py sync_apigw_stage --gateway-name=${gateway_name} --file="${defin
2323python manage.py sync_apigw_resources --delete --gateway-name=${gateway_name} --file=" ${resources_file} "
2424python manage.py sync_resource_docs_by_archive --gateway-name=${gateway_name} --file=" ${definition_file} "
2525python manage.py create_version_and_release_apigw --gateway-name=${gateway_name} --file=" ${definition_file} "
26+
27+ # 可选:需要同步 MCP Server 时调用。注意:前提是该 stage 有生效的版本且声明的 mcp tool 在生效版本的资源列表里且确认过请求参数
28+ # python manage.py sync_apigw_stage_mcp_servers --gateway-name=${gateway_name} --file="${definition_file}"
29+
2630python manage.py grant_apigw_permissions --gateway-name=${gateway_name} --file=" ${definition_file} "
2731python manage.py fetch_apigw_public_key --gateway-name=${gateway_name}
2832echo " gateway ${gateway_name} sync definition end"
Original file line number Diff line number Diff line change @@ -27,6 +27,27 @@ stages:
2727 - host : " https://httpbin.org"
2828 weight : 100
2929
30+ # 同步 MCP Server 相关配置(可选)
31+ # mcp_servers:
32+ # - name: "mcp_server1"
33+ # # MCP Server 中文名/显示名称
34+ # title: "MCP Server 示例"
35+ # description: "mcp-server demo"
36+ # labels:
37+ # - "test"
38+ # # 添加的 tool 对应的资源名称
39+ # resource_names:
40+ # - resource1
41+ # # 是否公开
42+ # is_public: true
43+ # # 1: 开启, 0: 停止; 默认是开启
44+ # status: 1
45+ # # MCP 协议类型: sse(默认)、streamable_http
46+ # protocol_type: "sse"
47+ # # 授权的应用
48+ # target_app_codes:
49+ # - "bk_app_code1"
50+
3051# 资源文档
3152# 资源文档的目录格式样例如下,en 为英文文档,zh 为中文文档:
3253# ./
You can’t perform that action at this time.
0 commit comments