Skip to main content
Glama
aliyun

Alibaba Cloud FC MCP Server

Official
by aliyun

update-custom-domain-config

Modify custom domain routing configurations for Alibaba Cloud Function Compute, including protocols, routes, authentication, certificates, and security settings.

Instructions

更新函数计算的域名路由配置,修改域名路由配置

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
regionNo部署的区域,当前可选的区域是cn-hangzhou, cn-shanghai, cn-beijing, cn-shenzhen, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, eu-west-1, us-west-1, us-east-1, ap-south-1, me-east-1, cn-chengdu, cn-wulanchabu, cn-guangzhou,默认是cn-hangzhoucn-hangzhou
domainYes域名,例如example.com,域名不能带有'https://'或'http://'等协议内容
updateCustomDomainConfigYes

Implementation Reference

  • The inline asynchronous handler function that executes the core logic of the 'update-custom-domain-config' tool. It extracts parameters, checks credentials, creates the FC client, builds the UpdateCustomDomainRequest from inputs, calls the Alibaba Cloud API to update the custom domain config, and returns success or error response.
    async (args) => { const { region, domain, updateCustomDomainConfig } = args; const accessKeyId = process.env.ALIBABA_CLOUD_ACCESS_KEY_ID; const accessKeySecret = process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET; if (!accessKeyId || !accessKeySecret) { return { isError: true, content: [{ type: "text", text: `执行失败,请设置ALIBABA_CLOUD_ACCESS_KEY_ID, ALIBABA_CLOUD_ACCESS_KEY_SECRET, ALIBABA_CLOUD_SECURITY_TOKEN环境变量` }] }; } const accountId = await getAccountId(); if (!accountId) { return { isError: true, content: [{ type: "text", text: `执行失败,获取accountId异常` }] }; } const fcClient = createFcClient(region); const updateCustomDomainRequest: UpdateCustomDomainRequest = new UpdateCustomDomainRequest({ body: { authConfig: updateCustomDomainConfig.authConfig, certConfig: updateCustomDomainConfig.certConfig, tlsConfig: updateCustomDomainConfig.tlsConfig, wafConfig: updateCustomDomainConfig.wafConfig, routeConfig: updateCustomDomainConfig.routeConfig, protocol: updateCustomDomainConfig.protocol, }, }); try { const result = await fcClient.updateCustomDomain(domain, updateCustomDomainRequest); return { content: [{ type: "text", text: `更新域名路由配置成功。result: ${JSON.stringify(result)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `更新域名路由配置失败:${JSON.stringify(error as any)}` }] }; } }
  • src/index.ts:675-712 (registration)
    The registration of the 'update-custom-domain-config' tool using McpServer's server.tool method, specifying name, description, input schema, and handler function.
    server.tool( "update-custom-domain-config", "更新函数计算的域名路由配置,修改域名路由配置", { region: regionSchema, domain: domainSchema, updateCustomDomainConfig: updateCustomDomainConfigSchema, }, async (args) => { const { region, domain, updateCustomDomainConfig } = args; const accessKeyId = process.env.ALIBABA_CLOUD_ACCESS_KEY_ID; const accessKeySecret = process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET; if (!accessKeyId || !accessKeySecret) { return { isError: true, content: [{ type: "text", text: `执行失败,请设置ALIBABA_CLOUD_ACCESS_KEY_ID, ALIBABA_CLOUD_ACCESS_KEY_SECRET, ALIBABA_CLOUD_SECURITY_TOKEN环境变量` }] }; } const accountId = await getAccountId(); if (!accountId) { return { isError: true, content: [{ type: "text", text: `执行失败,获取accountId异常` }] }; } const fcClient = createFcClient(region); const updateCustomDomainRequest: UpdateCustomDomainRequest = new UpdateCustomDomainRequest({ body: { authConfig: updateCustomDomainConfig.authConfig, certConfig: updateCustomDomainConfig.certConfig, tlsConfig: updateCustomDomainConfig.tlsConfig, wafConfig: updateCustomDomainConfig.wafConfig, routeConfig: updateCustomDomainConfig.routeConfig, protocol: updateCustomDomainConfig.protocol, }, }); try { const result = await fcClient.updateCustomDomain(domain, updateCustomDomainRequest); return { content: [{ type: "text", text: `更新域名路由配置成功。result: ${JSON.stringify(result)}` }] }; } catch (error) { return { isError: true, content: [{ type: "text", text: `更新域名路由配置失败:${JSON.stringify(error as any)}` }] }; } } )
  • Zod schema defining the structure and validation for the 'updateCustomDomainConfig' input parameter of the tool.
    export const updateCustomDomainConfigSchema = z.object({ protocol: protocolSchema.optional(), routeConfig: routeConfigSchema, authConfig: authConfigSchema, certConfig: certConfigSchema.optional(), tlsConfig: tlsConfigSchema.optional(), wafConfig: wafConfigSchema.optional(), });
  • Helper function to create and configure the Alibaba Cloud Function Compute (FC) client instance used in the tool handler.
    export function createFcClient(regionId: string) { const config = new $OpenApi.Config({ credential: getCredentialClient(), endpoint: `fcv3.${regionId}.aliyuncs.com`, }); return new FCClient(config); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aliyun/alibabacloud-fc-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server