CreateNacosMcpServer - 创建MCP服务

更新时间:
复制 MD 格式

创建一个MCP Server。

调试

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

调试

授权信息

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

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

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

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

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

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

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

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

操作

访问级别

资源类型

条件关键字

关联操作

mse:CreateNacosMcpServer

create

*全部资源

*

无 无

请求参数

名称

类型

必填

描述

示例值

NamespaceId

string

否

命名空间 ID。

public

ServerSpecification

string

否

Server 描述的 JSON 字符串

{"description":"a mcp demo service","capabilities":[],"allVersions":[{"version":"1.0.0","release_date":"2025-08-13T01:58:42Z","is_latest":true}],"remoteServerConfig":{"exportPath":"/sse"},"enabled":true,"versionDetail":{"version":"1.0.1"},"backendEndpoints":[{"path":"/sse","address":"127.0.0.1","port":8080}],"protocol":"mcp-sse","name":"mcp-demo","frontProtocol":"mcp-sse"}

ToolSpecification

string

否

Tool 的描述的 JSON 字符串

{"tools":[{"name":"demo-tool","description":"a demo tool","inputSchema":{"type":"object","properties":{"name":{"type":"string","description":"name"}}}}],"toolsMeta":{"demo-tool":{"enabled":true}}}

EndpointSpecification

string

否

Endpoint 描述的 Json 字符串

{"type":"REF","data":{"namespaceId":"public","groupName":"mcp-endpoints","serviceName":"mcp-demo"}}

InstanceId

string

否

实例 ID。

mse-cn-st21ri2****

ServerName

string

否

服务名称。

mcp-demo

YamlConfig

string

否

AI 网关 Yaml 配置,选填。

allowTools: - demo-tool securityScheme: {} server: name: mcp-demo tools: - args: - name: name description: name type: string description: a demo tool name: demo-tool

EncryptToolSpec

boolean

否

是否加密 MCP 工具描述(ToolSpecification)。取值:

  • true:加密。

  • false:不加密,默认值。

AcceptLanguage

string

否

返回结果显示的语言。取值:zh(默认值):中文,en:英文

zh

返回参数

名称

类型

描述

示例值

object

RestResult

RequestId

string

请求 ID。

AF21683A-29C7-4853-AC0F-B5ADEE4****

Data

boolean

返回数据。

true

示例

正常返回示例

JSON格式

{
  "RequestId": "AF21683A-29C7-4853-AC0F-B5ADEE4****",
  "Data": true
}

错误码

HTTP status code

错误码

错误信息

描述

400 Resource.exist Resource %s already exists, cannot be created repeatedly. 资源已经存在,无法重复创建
400 Nacos.Intercepted The request is blocked by the security barrier detection. Check the request content and modify the retry. 请求被安全护栏检测拦截,请检查请求内容后修改重试,拦截详情: %s.
400 IllegalRequest Invalid request:%s 非法请求: %s
400 InvalidParameter Parameter error:%s 请求参数错误:%s
500 InternalError Console error. Try again later:%s 控制台错误.稍后重试:%s
403 NoPermission You are not authorized to perform this operation:%s 没有权限使用此接口:%s
404 NotFound Not found:%s 资源不存在:%s

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

变更历史

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