Skip to main content
Glama
aliyun

Alibaba Cloud FC MCP Server

Official
by aliyun

create-custom-domain-config

Set up custom domain routing for Alibaba Cloud Function Compute by defining domain configurations, including protocol settings, route paths, and authentication. Ensure the domain is CNAME-mapped to the function's public endpoint for successful setup.

Instructions

创建函数计算的域名路由配置,域名必须已经CNAME到函数计算的公网域名(格式为${uid}.${regionId}.fc.aliyuncs.com,例如14**49.cn-hangzhou.fc.aliyuncs.com)上,否则会创建失败。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
createCustomDomainConfigYes
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

Implementation Reference

  • Handler function that implements the core logic of the 'create-custom-domain-config' tool: extracts arguments, checks credentials, creates FC client, builds CreateCustomDomainRequest, calls createCustomDomain, and returns result or error.
    const { region, createCustomDomainConfig } = 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 createCustomDomainRequest: CreateCustomDomainRequest = new CreateCustomDomainRequest({ body: { domainName: createCustomDomainConfig.domain, protocol: createCustomDomainConfig.protocol, routeConfig: createCustomDomainConfig.routeConfig, authConfig: createCustomDomainConfig.authConfig, certConfig: createCustomDomainConfig.certConfig, tlsConfig: createCustomDomainConfig.tlsConfig, wafConfig: createCustomDomainConfig.wafConfig, }, }); try { const result = await fcClient.createCustomDomain(createCustomDomainRequest); 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:716-722 (registration)
    Registration of the 'create-custom-domain-config' tool using server.tool, including name, description, input schema, and reference to handler function.
    "create-custom-domain-config", "创建函数计算的域名路由配置,域名必须已经CNAME到函数计算的公网域名(格式为${uid}.${regionId}.fc.aliyuncs.com,例如14**49.cn-hangzhou.fc.aliyuncs.com)上,否则会创建失败。", { region: regionSchema, createCustomDomainConfig: createCustomDomainConfigSchema, }, async (args) => {
  • Zod schema defining the structure for createCustomDomainConfig input parameter used in the tool's schema.
    export const createCustomDomainConfigSchema = z.object({ domain: domainSchema, protocol: protocolSchema.optional(), routeConfig: routeConfigSchema, authConfig: authConfigSchema, certConfig: certConfigSchema.optional(), tlsConfig: tlsConfigSchema.optional(), wafConfig: wafConfigSchema.optional(), });
  • Zod schema for the 'region' input parameter used in the tool.
    export const regionSchema = z.enum(['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']) .default('cn-hangzhou') .describe("部署的区域,当前可选的区域是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-hangzhou");

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