ListMcps - 查询 MCP 服务列表

更新时间:
复制 MD 格式

分页查询指定工作空间中的 MCP 服务及其配置和状态。

接口说明

请求说明

分页查询指定工作空间中的 MCP 服务及其配置和状态。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

agentcore:ListMcps

list

*Mcp

acs:agentcore:{#regionId}:{#accountId}:workspace/{#workspaceId}/mcp/*

无 无

请求语法

GET /workspaces/{workspaceId}/mcp-servers HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

workspaceId

string

是

AgentCore 工作空间 ID

workspace-id

请求参数

名称

类型

必填

描述

示例值

maxResults

integer

否

每页最大返回条数。

20

nextToken

string

否

下一页令牌。

next-page-token

name

string

否

MCP 服务名称或服务 ID。与 SearchType 配合使用

my-mcp-server

searchType

string

否

名称匹配方式。仅在设置 Name 时生效。取值:accurate(精确匹配)、blur(模糊匹配)。默认值为 blur

blur

officialTag

string

否

按官方用途标签筛选

KNOWLEDGE_BASE

customTag

string

否

按自定义标签筛选,需与标签完整匹配

知识库

usageActive

boolean

否

是否仍受官方模板用途约束

调用“查询 MCP 服务列表”接口时,请按参数定义传入:AgentCore 工作空间 ID、每页最大返回条数、下一页令牌。

返回参数

名称

类型

描述

示例值

object

查询成功

code

string

业务状态码。

Success

httpStatusCode

integer

HTTP 状态码。

200

items

array<object>

列表数据。

array<object>

addresses

array

MCP 服务地址列表。

string

MCP 服务地址列表中的元素。

https://example.com/mcp

auth

object

后端认证配置。enabled 表示是否启用;directProxy 为直连代理自定义认证头;httpToMcp 为 HTTP_TO_MCP 的 OpenAPI 凭证列表

codePackage

object

代码部署 MCP 的调用方 API Key 认证配置。

apiKey

string

用于校验 MCP 调用方的 API Key。

example-api-key

headerName

string

承载 API Key 的请求头名称。

X-API-Key

directProxy

object

直连代理认证配置。

name

string

名称。

mcp-example

value

string

认证参数取值。

example-credential

enabled

boolean

是否启用。

httpToMcp

array<object>

HTTP_TO_MCP 认证配置列表。

object

credential

string

认证凭证。

example-credential

id

string

认证方案 ID。

mcp-1234567890abcdef

name

string

名称。

mcp-example

position

string

凭证所在位置。

枚举值:

  • query :

    查询参数

  • header :

    请求头

header

type

string

类型。

枚举值:

  • apiKey :

    API Key 认证

  • bearer :

    Bearer 令牌认证

  • basic :

    Basic 认证

basic

createdAt

string

MCP 创建时间,采用 ISO 8601 UTC 格式。

2026-08-23T00:00:00Z

customTags

array

自定义标签,支持多个

string

单个 MCP 自定义标签。

知识库

deploymentConfig

object

代码部署 MCP 的部署配置。

accessControl

object

MCP 入口访问控制

credentialId

string

mode 为 CREDENTIAL 时引用 AgentCore Credential

credential-id

enabled

boolean

是否启用入口访问控制

mode

string

ANONYMOUS 表示匿名访问,CREDENTIAL 表示使用 AgentCore 访问凭证

CREDENTIAL

agentIdentityConfiguration

object

Agent Identity 配置

authorizationEnabled

boolean

是否启用授权

credentialProviderArn

string

凭证提供者 ARN

acs:agentidentity:cn-hangzhou:1234567890123456:provider/example

credentialProviderType

string

凭证提供者类型

oauth2

enabled

boolean

是否启用 Agent Identity

artifactType

string

Code 表示 ZIP 代码包,Container 表示自定义容器

Code

codeConfiguration

object

代码包配置

codePackageToken

string

GetMcpCodePackageUploadUrl 返回的临时代码包令牌;完成预签名上传后用于创建或更新代码部署

upload-token

command

array

完整启动命令,按参数边界依次传入。例如使用 supergateway 启动 stdio MCP 时传入 supergateway、--stdio、完整子命令和其余参数

string

启动命令或单个命令参数。

python

language

string

代码包运行时:python3.13、nodejs22 或 java17

python3.13

containerConfiguration

object

自定义容器配置

acrInstanceId

string

ACR 实例 ID

cri-example

command

array

启动命令

string

启动命令或单个命令参数。

python

entrypoint

array

容器入口参数

string

单个容器入口参数。

/bin/sh

image

string

容器镜像地址

registry.cn-hangzhou.aliyuncs.com/example/mcp:1.0.0

imageRegistryType

string

镜像仓库类型

ACR

mcpRuntimeMode

string

自定义容器当前需自行暴露标准 MCP,取值为 SELF_HOSTED

SELF_HOSTED

sourceType

string

当前固定为 CONTAINER_IMAGE

CONTAINER_IMAGE

hookConfiguration

object

Hook 配置

hooks

array<object>

按数组顺序执行 PRE_LIST_TOOLS、PRE_CALL_TOOL、POST_LIST_TOOLS 和 POST_CALL_TOOL Hook

array<object>

apiVersion

string

Hook API 版本

1.0

description

string

Hook 描述

记录 MCP 工具调用

enabled

boolean

是否启用 Hook

event

string

Hook 事件

PRE_CALL_TOOL

headers

object

Hook 请求头

string

HTTP 请求头的值。

application/json

timeout

integer

单位为毫秒

3000

url

string

Hook 回调地址

https://example.com/mcp-hook

logConfiguration

object

日志配置

enableInstanceMetrics

boolean

是否采集实例指标

enableRequestMetrics

boolean

是否采集请求指标

logBeginRule

string

FC 日志切分起始规则

DefaultRegex

logstore

string

日志库名称

mcp-logs

project

string

日志服务项目名称

agentcore-mcp-logs

mcpConfiguration

object

MCP 会话配置

endpointPath

string

例如 /mcp 或 /sse

/mcp

sessionConcurrencyPerInstance

integer

当前固定为 1

1

sessionIdleTimeoutSeconds

integer

单位为秒,默认 1800

1800

sessionMaxLifetimeSeconds

integer

单位为秒,默认 21600

21600

nasConfiguration

object

NAS 存储配置

groupId

integer

运行用户组 ID

1000

mountPoints

array<object>

NAS 挂载点列表

object

enableTls

boolean

是否启用 TLS

mountDir

string

本地挂载目录

/mnt/data

serverAddr

string

NAS 服务地址

example.cn-hangzhou.nas.aliyuncs.com

userId

integer

运行用户 ID

1000

networkConfiguration

object

网络配置

networkMode

string

网络模式

PUBLIC

securityGroupId

string

安全组 ID

sg-example

vSwitchIds

array

交换机 ID 列表

string

单个交换机 ID。

vsw-example

vpcId

string

专有网络 VPC ID

vpc-example

ossMountConfiguration

object

OSS 挂载配置

mountPoints

array<object>

OSS 挂载点列表

object

bucketName

string

OSS Bucket 名称

example-bucket

bucketPath

string

OSS Bucket 路径

/data

endpoint

string

OSS 服务访问端点

https://oss-cn-hangzhou.aliyuncs.com

mountDir

string

本地挂载目录

/mnt/data

readOnly

boolean

是否只读

parameterTransformConfiguration

object

参数转换和结果增强配置

enabled

boolean

是否启用参数转换和结果增强

ruleSetId

string

预留的参数转换和结果增强规则集引用

rules-1

version

string

转换规则版本

1.0

proxyConfiguration

object

MCP 代理配置

enabled

boolean

是否启用 MCP 代理

runtimeConfiguration

object

运行时和资源配置

cpu

number

单位为核,默认 0.25

0.25

diskSize

integer

单位为 MB,支持 512 或 10240

512

environmentVariables

object

环境变量

string

环境变量的值。

production

executionRoleArn

string

用户代码访问下游阿里云资源时使用的 RAM 角色 ARN

acs:ram::1234567890123456:role/agentcore-mcp-execution

instanceConcurrency

integer

默认 200

200

memory

integer

单位为 MB,默认 512

512

port

integer

默认 9000

9000

timeout

integer

单位为秒,默认 300

300

description

string

描述。

用于说明资源用途的示例描述。

endpoint

string

可供用户或 Agent 调用的 MCP Endpoint。部署完成前为空。

https://example.com/mcp

functionName

string

CODE_PACKAGE MCP 对应的函数计算函数名称。部署完成前为空,其他类型为空。

agentcore-mcp-example

marketSource

object

MCP 来源市场模板。

marketItemId

string

MCP 市场模板 ID。

market-1

mcpServerId

string

MCP 服务 ID。

mcp-1234567890abcdef

name

string

名称。

mcp-example

officialTag

string

官方用途标签,由服务端管理

KNOWLEDGE_BASE

permissionMode

string

PUBLIC 表示公开访问;CONTROLLED 表示根据权限规则控制访问。

CONTROLLED

protocol

string

MCP 协议。

SSE

status

string

状态

枚举值:

  • READY :

    就绪

  • FAILED :

    失败

  • DELETING :

    删除中

  • UPDATING :

    更新中

  • CREATING :

    创建中

CREATING

statusReason

string

状态原因

资源处理完成

swaggerConfig

string

Swagger 配置。

{"type":"object"}

type

string

类型。

file

updatedAt

string

MCP 最近更新时间,采用 ISO 8601 UTC 格式。

2026-08-23T01:00:00Z

usageActive

boolean

MCP 是否仍受官方模板的用途约束。

maxResults

integer

每页最大返回条数。

20

message

string

响应消息。

请求处理成功

nextToken

string

下一页令牌。

next-page-token

requestId

string

请求 ID。

A1B2C3D4-E5F6-47A8-90AB-CDEF12345678

success

boolean

请求是否成功。

totalCount

integer

总记录数。

100

“查询 MCP 服务列表”接口的响应包含:请求 ID、HTTP 状态码、总记录数、列表数据、每页最大返回条数、下一页令牌 等信息。

示例

正常返回示例

JSON格式

{
  "code": "Success",
  "httpStatusCode": 200,
  "items": [
    {
      "addresses": [
        "https://example.com/mcp"
      ],
      "auth": {
        "codePackage": {
          "apiKey": "example-api-key",
          "headerName": "X-API-Key"
        },
        "directProxy": {
          "name": "mcp-example",
          "value": "example-credential"
        },
        "enabled": true,
        "httpToMcp": [
          {
            "credential": "example-credential",
            "id": "mcp-1234567890abcdef",
            "name": "mcp-example",
            "position": "header",
            "type": "basic"
          }
        ]
      },
      "createdAt": "2026-08-23T00:00:00Z",
      "customTags": [
        "知识库"
      ],
      "deploymentConfig": {
        "accessControl": {
          "credentialId": "credential-id",
          "enabled": true,
          "mode": "CREDENTIAL"
        },
        "agentIdentityConfiguration": {
          "authorizationEnabled": true,
          "credentialProviderArn": "acs:agentidentity:cn-hangzhou:1234567890123456:provider/example",
          "credentialProviderType": "oauth2",
          "enabled": true
        },
        "artifactType": "Code",
        "codeConfiguration": {
          "codePackageToken": "upload-token",
          "command": [
            "python"
          ],
          "language": "python3.13"
        },
        "containerConfiguration": {
          "acrInstanceId": "cri-example",
          "command": [
            "python"
          ],
          "entrypoint": [
            "/bin/sh"
          ],
          "image": "registry.cn-hangzhou.aliyuncs.com/example/mcp:1.0.0",
          "imageRegistryType": "ACR",
          "mcpRuntimeMode": "SELF_HOSTED",
          "sourceType": "CONTAINER_IMAGE"
        },
        "hookConfiguration": {
          "hooks": [
            {
              "apiVersion": "1.0",
              "description": "记录 MCP 工具调用",
              "enabled": true,
              "event": "PRE_CALL_TOOL",
              "headers": {
                "key": "application/json"
              },
              "timeout": 3000,
              "url": "https://example.com/mcp-hook"
            }
          ]
        },
        "logConfiguration": {
          "enableInstanceMetrics": true,
          "enableRequestMetrics": true,
          "logBeginRule": "DefaultRegex",
          "logstore": "mcp-logs",
          "project": "agentcore-mcp-logs"
        },
        "mcpConfiguration": {
          "endpointPath": "/mcp",
          "sessionConcurrencyPerInstance": 1,
          "sessionIdleTimeoutSeconds": 1800,
          "sessionMaxLifetimeSeconds": 21600
        },
        "nasConfiguration": {
          "groupId": 1000,
          "mountPoints": [
            {
              "enableTls": true,
              "mountDir": "/mnt/data",
              "serverAddr": "example.cn-hangzhou.nas.aliyuncs.com"
            }
          ],
          "userId": 1000
        },
        "networkConfiguration": {
          "networkMode": "PUBLIC",
          "securityGroupId": "sg-example",
          "vSwitchIds": [
            "vsw-example"
          ],
          "vpcId": "vpc-example"
        },
        "ossMountConfiguration": {
          "mountPoints": [
            {
              "bucketName": "example-bucket",
              "bucketPath": "/data",
              "endpoint": "https://oss-cn-hangzhou.aliyuncs.com",
              "mountDir": "/mnt/data",
              "readOnly": true
            }
          ]
        },
        "parameterTransformConfiguration": {
          "enabled": true,
          "ruleSetId": "rules-1",
          "version": "1.0"
        },
        "proxyConfiguration": {
          "enabled": true
        },
        "runtimeConfiguration": {
          "cpu": 0.25,
          "diskSize": 512,
          "environmentVariables": {
            "key": "production"
          },
          "executionRoleArn": "acs:ram::1234567890123456:role/agentcore-mcp-execution",
          "instanceConcurrency": 200,
          "memory": 512,
          "port": 9000,
          "timeout": 300
        }
      },
      "description": "用于说明资源用途的示例描述。",
      "endpoint": "https://example.com/mcp",
      "functionName": "agentcore-mcp-example",
      "marketSource": {
        "marketItemId": "market-1"
      },
      "mcpServerId": "mcp-1234567890abcdef",
      "name": "mcp-example",
      "officialTag": "KNOWLEDGE_BASE",
      "permissionMode": "CONTROLLED",
      "protocol": "SSE",
      "status": "CREATING",
      "statusReason": "资源处理完成",
      "swaggerConfig": "{\"type\":\"object\"}",
      "type": "file",
      "updatedAt": "2026-08-23T01:00:00Z",
      "usageActive": true
    }
  ],
  "maxResults": 20,
  "message": "请求处理成功",
  "nextToken": "next-page-token",
  "requestId": "A1B2C3D4-E5F6-47A8-90AB-CDEF12345678",
  "success": true,
  "totalCount": 100
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameter Parameter error: %s. 参数错误
400 IllegalRequest Illegal request: %s. 非法请求
400 InvalidParameter.ImportFileSize The import file size exceeds the allowed limit: %s. 导入文件大小超过限制
500 InternalError The MCP server data could not be processed.
403 NoPermission You are not authorized to perform this operation: %s. 无操作权限
404 Resource.NotFound Not found: %s.
404 NotFound Not found: %s. 指定的工作空间、资源 或 版本不存在
409 ResourceAlreadyExist Resource already exists: %s. 指定的资源已存在

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。