关于 Alibaba Cloud FC MCP Server
Alibaba Cloud FC MCP Server 基于 Serverless Devs 和 OpenAPI,为 Alibaba Cloud Function Compute 提供 MCP 工具,面向需要通过 Agent 应用管理函数的用户。它支持部署及更新函数,也可查询和管理函数与自定义域名路由配置。
主要功能
- 01打包并部署自定义运行时函数
- 02更新函数参数
- 03查询和列出函数
- 04删除函数
- 05管理自定义域名路由
适用场景
- 01从 Agent 应用部署项目到 Function Compute
- 02查看指定地域的函数列表
- 03更新函数或查询函数详情
- 04调整自定义域名路由配置
MCP 相关
该 MCP 服务向支持 MCP 的 Agent 应用提供 Function Compute 工具。工具涵盖函数部署、更新、查询和删除,以及自定义域名路由配置管理。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
12收录的工具列表 · 更新于 3 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| location | string | 是 | 本地代码工程的根路径,例如 /Users/xxx/my-project,无需打包为 zip。 |
| functionName | string | 是 | 函数名称在每个 region 中必须唯一。 |
| region | 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,默认是cn-hangzhoucn-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 |
| cpu | number | 否 | 函数的 CPU 规格,单位为 vCPU,为 0.05 vCPU 的倍数。和 diskSize 必须同时存在,如果仅填写 memorySize,cpu 和 diskSize 可以不填。内存规格(以 GB 计算)与 CPU 规格的比例必须在 1 到 4 之间,例如内存为 1024MB,则 CPU 必须为 0.25 到 1 之间,默认为 1 |
| memorySize | number | 否 | 函数的内存规格,单位为 MB,最小值为 128,最大值为 30720。可选内存规格为:128,256,512,1024,2048,4096,8192,16384,32768。默认为 2048。内存规格(以 GB 计算)与 CPU 规格的比例必须在 1 到 4 之间,例如内存为 1024MB,则 CPU 必须为 0.25 到 1 之间 |
| customRuntimeConfig | object | 是 | 自定义运行时配置,用于定义启动命令、参数以及启动的 HTTP Server 的监听端口 |
| customRuntimeConfig.command | array | 是 | 自定义运行时的启动命令。命令以 root 用户身份执行,工作目录为 /code,例如 python3 |
| customRuntimeConfig.args | array | 否 | 自定义运行时启动命令的参数,例如 app.py |
| customRuntimeConfig.port | number | 否 | 自定义运行时启动的 HTTP Server 的监听端口,默认为 9000 |
| description | string | 否 | 函数的描述,可用于描述函数的功能。 |
| diskSize | number | 是 | 磁盘大小,单位为 MB,可选值:512 | 10240 |
| instanceConcurrency | number | 是 | 单实例并发数。规定单个实例可同时处理多个请求的上限。仅对自定义运行时和自定义容器镜像运行时生效。范围为 [1, 200] |
| environmentVariables | object | 否 | 运行时的环境变量配置 |
| internetAccess | boolean | 否 | 是否支持从函数实例内部访问互联网 |
| logConfig | any | 否 | 日志投递配置。如果配置为 auto,则会自动创建 SLS 日志库并投递日志。如果配置为其他值,则需要配置 project 和 logstore。 |
| vpcConfig | any | 否 | 函数的 VPC 网络配置。如果配置为 auto,则会自动创建 VPC、VSwitch 和安全组配置。如果配置为其他值,则需要配置 vpcId、vSwitchIds 和 securityGroupId。函数实例将在配置的 VPC 网络中运行。 |
| role | string | 否 | 函数运行时的角色配置。授予函数计算所需权限的 RAM 角色,使用场景包括:1. 将函数生成的日志发送到您的日志库。2. 为函数在执行过程中访问其他云资源生成临时访问令牌。通常可设置为 aliyunfcdefaultrole。角色 ARN 为 acs:ram::****:role/aliyunfcdefaultrole,只需输入 aliyunfcdefaultrole 即可 |
| runtime | enum | 否 | 函数的运行时环境。对于自定义运行时,当前支持 debian10、debian11、debian12custom.debian10 | custom.debian11 | custom.debian12 |
| timeout | number | 否 | 函数执行的超时时间,单位为秒,最小值为 1 秒,默认为 3 秒。函数执行超过此时间后将被终止。 |
| layers | array | 否 | 函数计算的层配置。当前会自动为 custom.debian10、custom.debian11、custom.debian12 添加默认公共层 |
| tags | array | 否 | 函数标签的 key 和 value 配置 |
详细介绍
English | 中文
Alibaba Cloud FC MCP Server
本项目是基于 Serverless Devs 和 OpenAPI 的阿里云函数计算(FC)服务 MCP 服务。
使用场景
将阿里云函数计算能力集成到支持 MCP 客户端的 Agent 应用中(例如 Cursor、Claude、Cline)。
前提条件
- 安装 Node.js(需要 18 或更高版本)。
- 准备阿里云凭证(
AccessKeyId和AccessKeySecret)。建议授予以下权限:AdministratorAccess(建议授予,以获得完整功能),或至少授予:AliyunFCFullAccess(必需)AliyunDevsFullAccess(建议)AliyunVPCFullAccess(建议)AliyunLogFullAccess(建议)AliyunEventBridgeFullAccess(可选)
快速开始
方法 1:从 npm 包启动[推荐 MCP 服务用户使用]
可以使用以下命令以 stdio 模式启动 MCP 服务:
ALIBABA_CLOUD_ACCESS_KEY_ID=${your-access-key-id} ALIBABA_CLOUD_ACCESS_KEY_SECRET=${your-access-key-secret} npx alibabacloud-fc-mcp-server
使用 Cursor[推荐]
- 点击
或编辑 Cursor 配置文件(文档),并添加以下配置:
"alibabacloud-fc-mcp-server": {
"command": "npx",
"args": ["-y", "alibabacloud-fc-mcp-server"],
"env": {
"ALIBABA_CLOUD_ACCESS_KEY_ID": "${your-access-key-id}",
"ALIBABA_CLOUD_ACCESS_KEY_SECRET": "${your-access-key-secret}"
}
}

- 创建一个新的空项目并在 Cursor 中打开。在 Agent 模式下与 Cursor 聊天。输入下面的
Prompts,引导对话。

- 让 Cursor Agent 生成一个 2048 游戏项目,然后要求 Agent 将其部署到阿里云函数计算。

- 等待 Agent 生成项目并将其部署到阿里云函数计算。

使用 Cline
编辑 Cline 配置文件(文档),并添加以下配置:
"alibabacloud-fc-mcp-server": {
"command": "npx",
"args": ["-y", "alibabacloud-fc-mcp-server"],
"env": {
"ALIBABA_CLOUD_ACCESS_KEY_ID": "${your-access-key-id}",
"ALIBABA_CLOUD_ACCESS_KEY_SECRET": "${your-access-key-secret}"
}
}
方法 2:从源代码启动[推荐 MCP 服务开发者使用]
- 首先,克隆项目并构建:
git clone https://github.com/alibaba/alibabacloud-fc-mcp-server.git
cd alibabacloud-fc-mcp-server
npm install
npm run build
- 然后以
stdio模式启动 MCP 服务:
ALIBABA_CLOUD_ACCESS_KEY_ID=${your-access-key-id} ALIBABA_CLOUD_ACCESS_KEY_SECRET=${your-access-key-secret} node {absolute-path-to-project}/build/index.js
- 最后,按照方法 1 在 Cursor 或 Cline 中配置 MCP 服务。
组件
工具
put-custom-runtime-function:打包符合阿里云自定义运行时要求的项目,创建函数,并将代码部署到该函数。如果函数已存在,则会尝试覆盖并更新目标函数。建议使用此方法前检查函数是否存在,并在必要时确认更新。update-custom-runtime-function:更新自定义运行时函数。仅更新提供的参数;其他参数保持不变。get-function:获取指定函数的详细信息。list-functions:列出指定区域中的所有函数,仅返回函数名称和部分信息。要获取完整详情,请使用get-function。delete-function:删除指定函数。get-custom-domain-config:查询自定义域名路由配置。update-custom-domain-config:更新自定义域名路由配置。create-custom-domain-config:创建自定义域名路由配置。域名必须已 CNAME 到 Function Compute 公网域名(格式:${uid}.${regionId}.fc.aliyuncs.com,例如 14**49.cn-hangzhou.fc.aliyuncs.com),否则将创建失败。delete-custom-domain-config:删除自定义域名路由配置。get-custom-runtime-prompt:获取自定义运行时提示词。未来将移至 Prompts。
提示词
# Role
You are a professional Alibaba Cloud Function Compute (FC) Copilot, focused on providing customers with advice on building and deploying code to Function Compute.
## Function Compute Build Constraints
- The project must be built before it can be deployed to Function Compute. For languages like Python, dependencies should be installed in ./python at the project root; for Node, dependencies should be installed in ./node_modules at the project root; for Java, use Maven or Gradle to package the project as a Jar with dependencies. This ensures runtime dependencies can be found.
- The project build must meet the Function Compute runtime constraints.
- You do not need to package the project; after building, you can directly use the MCP Server tools for deployment.
## Function Compute Runtime Constraints
- The user must expose a port to provide an HTTP service at runtime.
- The runtime environment is debian10, with Python 3.10, Node 20, and OpenJDK JRE 21 pre-installed.
- Function Compute provides specific runtime environments for Python, Node, Java, and Golang. Python 3.10 is installed at /opt/python3.10, and /opt/python3.10/bin as well as /code/python in the code package are added to the PATH environment variable by default. Node 20 is installed at /opt/nodejs20, and /opt/nodejs20/bin as well as /code/node_modules in the code package are added to the PATH by default. OpenJDK 21 is installed at /opt/java21, and /opt/java21/bin is added to the PATH by default, with JAVA_HOME set to /opt/java21. If you modify the PATH, you should include the above contents. Golang does not require a runtime environment.
## Skills
### Skill 1: Problem Decomposition and Analysis
- Able to deeply decompose user questions, clarify the core requirements and possible steps or commands involved.
- Provide clear task breakdown steps to ensure each step leads to the final solution.
- Organize answers in tabular form whenever possible.
### Skill 2: alibabacloud-fc-mcp-server MCP Tool Usage
- Proficient in using the alibabacloud-fc-mcp-server MCP tools to obtain function information or perform related operations.
- Task decomposition must be completed before tool invocation, ensuring the logic is clear and meets customer needs.
- Select the appropriate MCP module based on the user's specific problem, such as creating or updating custom runtime functions.
## Constraints
- **Task Decomposition First**: Detailed task breakdown steps must be provided first.
- **Clear Tool Dependency**: All operations requiring MCP tool invocation should be based on clear task requirements and logical reasoning.
- **Code Generation and Build**: Code must be built locally before being deployed and run on Function Compute. Code generation and build must meet the Function Compute build and runtime constraints.
MCP MarketPlace 集成
本项目已集成到阿里云 MCP MarketPlace。你可以通过以下链接访问:
许可证
本项目采用 MIT License 许可。详情参见 LICENSE 文件。
本项目基于 MIT License 开源。详情参见 LICENSE 文件。
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。