查询官方 MCP 或当前工作空间下自定义 MCP 的详情、状态和配置。
接口
GET
/api/v1/mcp/servers/{mcpCode}路径参数
mcpCodestring必填MCP 编码
响应字段
返回完整的 DetailResponse。自定义 MCP 的 mcp_config 按保存值返回;配置无法恢复时为 null。官方 MCP 的 mcp_config 始终为 null。
mcp_codestringMCP 编码
server_namestringMCP 名称
descriptionstringMCP 描述
typestringOFFICIAL 或 CUSTOMER
server_typestringSTDIO、HTTP、SSE 或 OPENAPI
server_statusstring服务状态
server_status_textstring状态文案
dashscope_endpointstring / nullMCP 接入地址,仅已启用或开通中时返回
meta_infoobject / null服务元信息
mcp_configobject / null自定义 MCP 的已保存配置
meta_info 字段见 MCP API 概览。
请求示例
curl "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/mcp/servers/mcp-a1b2c3d4e5f6g7h8" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
响应示例
{
"success": true,
"error_code": null,
"error_msg": null,
"data": {
"mcp_code": "mcp-a1b2c3d4e5f6g7h8",
"server_name": "weather-mcp",
"description": "天气查询 MCP",
"type": "CUSTOMER",
"server_type": "HTTP",
"server_status": "ACTIVATED",
"server_status_text": "已启用",
"dashscope_endpoint": "https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/mcps/mcp-a1b2c3d4e5f6g7h8/mcp",
"meta_info": {
"console_detail_url": "https://bailian.console.aliyun.com/flow-agent/mcp-manage/detail/mcp-a1b2c3d4e5f6g7h8/custom",
"classification": "生活服务",
"activate_user_count": 10,
"call_total_count": 1200,
"average_call_time": 125,
"call_success_rate": 0.99
},
"mcp_config": {
"url": "https://mcp.example.com/mcp",
"headers": {
"Authorization": "Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
},
"request_id": "6f1c2a8e-3b0d-4c55-9a0e-2f7d1c9b8a11"
}
错误码
| HTTP 状态码 | error_code | 说明 |
|---|---|---|
| 400 | InvalidParameter | 携带了查询参数或请求体 |
| 404 | McpServerNotFound | MCP 服务不存在,或不属于当前工作空间 |
| 404 | McpServerUnavailable | MCP 服务已删除或已下架 |
警告mcp_config.headers 会按保存值返回,可能包含 API Key 等敏感信息。请妥善保护响应内容。
该文章对您有帮助吗?