Skip to main content
Glama

Alibaba Cloud FC MCP Server

Official
by aliyun

get-custom-domain-config

Retrieve custom domain routing configurations for Alibaba Cloud Function Compute. Specify the region and domain to access detailed routing setup information.

Instructions

查询函数计算的域名路由配置

Input Schema

NameRequiredDescriptionDefault
domainYes域名,例如example.com,域名不能带有'https://'或'http://'等协议内容
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

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "domain": { "description": "域名,例如example.com,域名不能带有'https://'或'http://'等协议内容", "type": "string" }, "region": { "default": "cn-hangzhou", "description": "部署的区域,当前可选的区域是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", "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" ], "type": "string" } }, "required": [ "domain" ], "type": "object" }

Implementation Reference

  • Inline handler function for the 'get-custom-domain-config' tool. It validates environment variables, retrieves account ID, creates an Alibaba Cloud FC client, and fetches the custom domain configuration.
    async (args) => { const { region, domain } = 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); try { const result = await fcClient.getCustomDomain(domain); 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:646-672 (registration)
    Registration of the 'get-custom-domain-config' tool using server.tool, including name, description, input parameters schema, and handler reference.
    server.tool( "get-custom-domain-config", "查询函数计算的域名路由配置", { region: regionSchema, domain: domainSchema, }, async (args) => { const { region, domain } = 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); try { const result = await fcClient.getCustomDomain(domain); 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 definition for 'region' parameter used in the tool's input schema.
    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");
  • Zod schema definition for 'domain' parameter used in the tool's input schema.
    export const domainSchema = z.string().describe("域名,例如example.com,域名不能带有'https://'或'http://'等协议内容");
  • Helper function to create Alibaba Cloud Function Compute (FC) client instance used in the handler.
    export function createFcClient(regionId: string) { const config = new $OpenApi.Config({ credential: getCredentialClient(), endpoint: `fcv3.${regionId}.aliyuncs.com`, }); return new FCClient(config); }
  • Helper function to retrieve Alibaba Cloud account ID using STS client, used in the handler.
    export async function getAccountId(): Promise<string> { try { const client = createStsClient('cn-hangzhou'); const result = await client.getCallerIdentity(); const accountId = result.body?.accountId || ''; return accountId; } catch (ex: any) { console.error('getAccountId异常:', JSON.stringify(ex)) return ''; } }

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