Skip to content

[ISSUE #13497]feat: return mcpId when create mcpserver #13561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public Result<String> createMcpServer(McpDetailForm mcpForm) throws NacosExcepti
McpServerBasicInfo basicInfo = McpRequestUtil.parseMcpServerBasicInfo(mcpForm);
McpToolSpecification mcpTools = McpRequestUtil.parseMcpTools(mcpForm);
McpEndpointSpec endpointSpec = McpRequestUtil.parseMcpEndpointSpec(basicInfo, mcpForm);
mcpServerOperationService.createMcpServer(mcpForm.getNamespaceId(), basicInfo, mcpTools,
String mcpId = mcpServerOperationService.createMcpServer(mcpForm.getNamespaceId(), basicInfo, mcpTools,
endpointSpec);
return Result.success("ok");
return Result.success(mcpId);
Comment on lines +113 to +115
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

返回结果未处理异常情况导致潜在空指针风险

🟠 Critical | 🐞 Bugs

📋 问题详情

在createMcpServer方法中,直接返回mcpServerOperationService创建方法的结果,但未处理该方法可能抛出的异常。当服务层返回null时可能导致空指针异常,且未对异常场景进行错误码返回处理

💡 解决方案

需要增加对mcpId的空值检查,并处理异常场景返回错误信息:

- String mcpId = mcpServerOperationService.createMcpServer(mcpForm.getNamespaceId(), basicInfo, mcpTools,
-         endpointSpec);
- return Result.success(mcpId);
+ String mcpId;
+ try {
+     mcpId = mcpServerOperationService.createMcpServer(mcpForm.getNamespaceId(), basicInfo, mcpTools, endpointSpec);
+     if (StringUtils.isEmpty(mcpId)) {
+         throw new NacosException(NacosException.INTERNALServerError, "MCP server ID generation failed");
+     }
+     return Result.success(mcpId);
+ } catch (NacosException e) {
+     return Result.fail(e.getErrorCode(), e.getMessage());
+ }

您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)

有用意见👍无用意见👎错误意见❌

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not true, because if it return mcpId, it must have value

Copy link

@lingma-agents lingma-agents bot Jun 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据代码逻辑分析,createMcpServer方法的返回值mcpId确实需要区分两种风险场景:

  1. 异常场景:即使方法返回值不为空,但若方法内部出现异常(如数据库操作失败),需要捕获NacosException并返回错误码。当前方法签名声明了throws NacosException,但未在调用处处理,可能导致未捕获异常抛出。

  2. 空值场景:如果createMcpServer方法在某些情况下返回空字符串(例如服务端逻辑未正确生成ID但未抛异常),直接返回会导致前端接收空值。虽然您认为"must have value",但需要确认该方法是否严格保证非空返回。

建议补充异常捕获逻辑,保持接口的健壮性:

try {
    String mcpId = mcpServerOperationService.createMcpServer(...);
    return Result.success(mcpId);
} catch (NacosException e) {
    return Result.fail(e.getErrorCode(), e.getMessage());
}

这样既保证了异常场景的可控性,又保留了您的设计逻辑。是否需要空值检查取决于createMcpServer的实现规范,建议与服务层开发者确认方法的返回值约束。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evenif there occurs error inside method, the createMcpServer method have throw Exception, eventually, the client will get errorcode and errormsg

Copy link

@lingma-agents lingma-agents bot Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jujiale 您的分析需要结合方法抛出异常的传播路径来判断:

  1. 异常传播逻辑
    当前createMcpServer方法声明抛出NacosException,但调用该方法的客户端(如Controller)若未捕获异常,异常会向上抛出。若未在Spring Boot的全局异常处理器(如@ControllerAdvice)中捕获NacosException,则会触发HTTP 500错误,无法返回结构化的错误响应(如包含errorCodemessage的JSON)。您的方案需要确保全局异常处理已覆盖此场景。

  2. 显式错误封装的优势
    建议的try-catch方案能直接返回Result.fail()结构化响应,即使存在全局异常处理,显式捕获可:

  • 精确控制错误码(如区分数据库异常与ID生成失败)
  • 避免堆栈追踪暴露敏感信息
  • 统一前后端错误协议
  1. 空值风险的补充说明
    createMcpServer保证非空返回(如通过Javadoc标注@Nonnull),则无需空值检查。但若服务层可能出现空值(如网络超时未抛异常但返回空),则需要补充校验。

综上,是否需要修改取决于:

  • 全局异常处理是否已覆盖NacosException
  • createMcpServer的返回值约束是否严格定义
    建议与服务层开发者确认方法规范,并检查是否存在未声明的异常场景(如NullPointerException)。

Copy link

@lingma-agents lingma-agents bot Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jujiale 您的分析需要结合以下关键点进一步确认:

  1. 全局异常处理有效性
    若当前NacosException已被全局异常处理器(如@ControllerAdvice)捕获并转换为结构化响应(如Result.fail()格式),则无需本地try-catch。但需确认:
  • 全局处理器是否精确处理NacosException
  • 是否包含errorCodemessage的正确封装
  1. 未声明异常的潜在风险
    当前方法签名声明抛出NacosException,但若服务层可能抛出未声明的异常(如NullPointerExceptionIOException),则这些异常会直接导致HTTP 500,无法返回预期的错误码。

  2. 空值返回的边界情况
    createMcpServer方法在某些场景未抛异常但返回空字符串(例如数据库主键生成失败但未正确抛异常),直接返回会导致前端接收空值。需确认该方法的Javadoc是否明确标注@Nonnull

建议行动项

  • 检查是否存在覆盖NacosException的全局异常处理逻辑
  • 与服务层开发者确认createMcpServer的异常边界(是否包含未声明异常)
  • 若需保留当前设计,请补充方法返回值的非空断言(Objects.requireNonNull(mcpId))以明确契约

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,24 @@ public String createMcpServer(String namespaceId, McpServerBasicInfo serverSpeci
throw new NacosApiException(NacosApiException.INVALID_PARAM, ErrorCode.PARAMETER_VALIDATE_ERROR,
"Version must be specified in parameter `serverSpecification`");
}

String id = UUID.randomUUID().toString();
String id;
String customMcpId = serverSpecification.getId();

if (StringUtils.isEmpty(customMcpId)) {
id = UUID.randomUUID().toString();
}else {
if (!StringUtils.isUUIDString(customMcpId)) {
throw new NacosApiException(NacosApiException.INVALID_PARAM, ErrorCode.PARAMETER_VALIDATE_ERROR,
"parameter `serverSpecification.id` is not match uuid pattern, must obey uuid pattern");
}
if (mcpServerIndex.getMcpServerById(serverSpecification.getId()) != null) {
throw new NacosApiException(NacosApiException.INVALID_PARAM, ErrorCode.PARAMETER_VALIDATE_ERROR,
"parameter `serverSpecification.id` conflict with exist mcp server id");
}

id = customMcpId;
}

serverSpecification.setId(id);
ZonedDateTime currentTime = ZonedDateTime.now(ZoneOffset.UTC);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(Constants.RELEASE_DATE_FORMAT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,14 @@ void testJoin() {
collection.add("bar");
assertEquals("foo,bar", join(collection, ","));
}

@Test
void testUUIDPattern() {
// match 8-4-4-4-12 uuid pattern
assertTrue(StringUtils.isUUIDString("123e4567-e89b-12d3-a456-426655440000"));
// not match 8-4-4-4-12 uuid pattern
assertFalse(StringUtils.isUUIDString("123e54567-e89b5-12d35-a4565-426655440000"));
// not match hexadecimal and '-' char
assertFalse(StringUtils.isUUIDString("@23e4567+e89b-12d3-a456-426655440000"));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UUID测试用例未覆盖大写格式

🟢 Minor | 🧹 Code Smells

📋 问题详情

测试用例仅验证了小写格式的UUID,未包含大写格式测试,可能导致实际使用中大小写混合的情况未被正确识别

💡 解决方案

补充大写测试用例:

+ assertTrue(StringUtils.isUUIDString("123E4567-E89B-12D3-A456-426655440000"));

您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)

有用意见👍无用意见👎错误意见❌

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.Pattern;

/**
* string util.
Expand Down Expand Up @@ -53,6 +54,9 @@ private StringUtils() {
public static final String FOLDER_SEPARATOR = "/";

public static final String WINDOWS_FOLDER_SEPARATOR = "\\";

public static final Pattern UUID_PATTERN = Pattern.compile(
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");

/**
* <p>Create a string with encoding format as utf8.</p>
Expand Down Expand Up @@ -808,4 +812,8 @@ private static String changeFirstCharacterCase(String str) {
chars[0] = updatedChar;
return new String(chars);
}

public static boolean isUUIDString(String str) {
return UUID_PATTERN.matcher(str).matches();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public Result<String> createMcpServer(McpDetailForm mcpForm) throws NacosExcepti
McpServerBasicInfo basicInfo = McpRequestUtil.parseMcpServerBasicInfo(mcpForm);
McpToolSpecification mcpTools = McpRequestUtil.parseMcpTools(mcpForm);
McpEndpointSpec endpointSpec = McpRequestUtil.parseMcpEndpointSpec(basicInfo, mcpForm);
mcpProxy.createMcpServer(mcpForm.getNamespaceId(), basicInfo, mcpTools, endpointSpec);
return Result.success("ok");
String mcpId = mcpProxy.createMcpServer(mcpForm.getNamespaceId(), basicInfo, mcpTools, endpointSpec);
return Result.success(mcpId);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ Page<McpServerBasicInfo> listMcpServers(String namespaceId, String mcpName, Stri
* @param serverSpecification mcp server specification, see {@link McpServerBasicInfo}
* @param toolSpecification mcp server included tools, see {@link McpTool}, optional
* @param endpointSpecification mcp server endpoint specification, see {@link McpEndpointSpec}, optional
* @return mcp server id of the new mcp server
* @throws NacosException any exception during handling
*/
void createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
String createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
Comment on lines +68 to +71
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

接口返回类型变更未更新文档注释

🟢 Minor | 🧹 Code Smells

📋 问题详情

createMcpServer方法返回类型从void改为String,但方法注释中@return说明未同步更新,可能导致调用者误解接口行为

💡 解决方案

补充@return说明:

+     * @return 新创建的MCP服务器ID

您的反馈对我们很重要!(建议右键在新标签页中打开以下链接)

有用意见👍无用意见👎错误意见❌

McpToolSpecification toolSpecification, McpEndpointSpec endpointSpecification) throws NacosException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public McpServerDetailInfo getMcpServer(String namespaceId, String mcpName, Stri
}

@Override
public void createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
public String createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
McpToolSpecification toolSpecification, McpEndpointSpec endpointSpecification) throws NacosException {
mcpServerOperationService.createMcpServer(namespaceId, serverSpecification, toolSpecification,
return mcpServerOperationService.createMcpServer(namespaceId, serverSpecification, toolSpecification,
endpointSpecification);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ public McpServerDetailInfo getMcpServer(String namespaceId, String mcpName, Stri
}

@Override
public void createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
public String createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
McpToolSpecification toolSpecification, McpEndpointSpec endpointSpecification) throws NacosException {
clientHolder.getAiMaintainerService()
return clientHolder.getAiMaintainerService()
.createMcpServer(serverSpecification.getName(), serverSpecification, toolSpecification, endpointSpecification);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ public McpServerDetailInfo getMcpServer(String namespaceId, String mcpName, Stri
* @param serverSpecification mcp server specification, see {@link McpServerBasicInfo}
* @param toolSpecification mcp server included tools, see {@link McpToolSpecification}, optional
* @param endpointSpecification mcp server endpoint specification, see {@link McpEndpointSpec}, optional
* @return mcp server id of the new mcp server
* @throws NacosException any exception during handling
*/
public void createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
public String createMcpServer(String namespaceId, McpServerBasicInfo serverSpecification,
McpToolSpecification toolSpecification, McpEndpointSpec endpointSpecification) throws NacosException {
mcpHandler.createMcpServer(namespaceId, serverSpecification, toolSpecification, endpointSpecification);
return mcpHandler.createMcpServer(namespaceId, serverSpecification, toolSpecification, endpointSpecification);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ McpServerDetailInfo getMcpServerDetail(String namespaceId, String mcpName, Strin
*
* @param mcpName mcp server name of the new mcp server
* @param version version of the new mcp server
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createLocalMcpServer(String mcpName, String version) throws NacosException {
default String createLocalMcpServer(String mcpName, String version) throws NacosException {
return createLocalMcpServer(mcpName, version, null);
}

Expand All @@ -188,10 +188,10 @@ default boolean createLocalMcpServer(String mcpName, String version) throws Naco
* @param mcpName mcp server name of the new mcp server
* @param version version of the new mcp server
* @param description description of the new mcp server
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createLocalMcpServer(String mcpName, String version, String description) throws NacosException {
default String createLocalMcpServer(String mcpName, String version, String description) throws NacosException {
return createLocalMcpServer(mcpName, version, description, null);
}

Expand All @@ -202,10 +202,10 @@ default boolean createLocalMcpServer(String mcpName, String version, String desc
* @param version version of the new mcp server
* @param description description of the new mcp server
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createLocalMcpServer(String mcpName, String version, String description,
default String createLocalMcpServer(String mcpName, String version, String description,
McpToolSpecification toolSpec) throws NacosException {
return createLocalMcpServer(mcpName, version, description, null, toolSpec);
}
Expand All @@ -218,10 +218,10 @@ default boolean createLocalMcpServer(String mcpName, String version, String desc
* @param description description of the new mcp server
* @param localServerConfig custom config of the new mcp server
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createLocalMcpServer(String mcpName, String version, String description,
default String createLocalMcpServer(String mcpName, String version, String description,
Map<String, Object> localServerConfig, McpToolSpecification toolSpec) throws NacosException {
McpServerBasicInfo serverSpec = new McpServerBasicInfo();
serverSpec.setName(mcpName);
Expand All @@ -241,10 +241,10 @@ default boolean createLocalMcpServer(String mcpName, String version, String desc
* @param serverSpec mcp server specification, see {@link McpServerBasicInfo} which `type` is
* {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createLocalMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec)
default String createLocalMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec)
throws NacosException {
if (Objects.isNull(serverSpec)) {
throw new NacosException(NacosException.INVALID_PARAM, "Mcp server specification cannot be null.");
Expand All @@ -263,10 +263,10 @@ default boolean createLocalMcpServer(String mcpName, McpServerBasicInfo serverSp
* @param version version of the new mcp server
* @param protocol mcp protocol type not {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, can't be null.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createRemoteMcpServer(String mcpName, String version, String protocol,
default String createRemoteMcpServer(String mcpName, String version, String protocol,
McpEndpointSpec endpointSpec) throws NacosException {
return createRemoteMcpServer(mcpName, version, protocol, new McpServerRemoteServiceConfig(), endpointSpec);
}
Expand All @@ -279,10 +279,10 @@ default boolean createRemoteMcpServer(String mcpName, String version, String pro
* @param protocol mcp protocol type not {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @param remoteServiceConfig remote service configuration, see {@link McpServerRemoteServiceConfig}.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, can't be null.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createRemoteMcpServer(String mcpName, String version, String protocol,
default String createRemoteMcpServer(String mcpName, String version, String protocol,
McpServerRemoteServiceConfig remoteServiceConfig, McpEndpointSpec endpointSpec) throws NacosException {
return createRemoteMcpServer(mcpName, version, null, protocol, remoteServiceConfig, endpointSpec);
}
Expand All @@ -296,10 +296,10 @@ default boolean createRemoteMcpServer(String mcpName, String version, String pro
* @param protocol mcp protocol type not {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @param remoteServiceConfig remote service configuration, see {@link McpServerRemoteServiceConfig}.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, can't be null.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createRemoteMcpServer(String mcpName, String version, String description, String protocol,
default String createRemoteMcpServer(String mcpName, String version, String description, String protocol,
McpServerRemoteServiceConfig remoteServiceConfig, McpEndpointSpec endpointSpec) throws NacosException {
return createRemoteMcpServer(mcpName, version, description, protocol, remoteServiceConfig, endpointSpec, null);
}
Expand All @@ -314,10 +314,10 @@ default boolean createRemoteMcpServer(String mcpName, String version, String des
* @param remoteServiceConfig remote service configuration, see {@link McpServerRemoteServiceConfig}.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, can't be null.
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createRemoteMcpServer(String mcpName, String version, String description, String protocol,
default String createRemoteMcpServer(String mcpName, String version, String description, String protocol,
McpServerRemoteServiceConfig remoteServiceConfig, McpEndpointSpec endpointSpec, McpToolSpecification toolSpec)
throws NacosException {
McpServerBasicInfo serverSpec = new McpServerBasicInfo();
Expand All @@ -338,10 +338,10 @@ default boolean createRemoteMcpServer(String mcpName, String version, String des
* @param serverSpec mcp server specification, see {@link McpServerBasicInfo} which `type` is not
* {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, can't be null.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createRemoteMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpEndpointSpec endpointSpec)
default String createRemoteMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpEndpointSpec endpointSpec)
throws NacosException {
return createRemoteMcpServer(mcpName, serverSpec, null, endpointSpec);
}
Expand All @@ -354,10 +354,10 @@ default boolean createRemoteMcpServer(String mcpName, McpServerBasicInfo serverS
* {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, nullable.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createRemoteMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
default String createRemoteMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
McpEndpointSpec endpointSpec) throws NacosException {
if (Objects.isNull(serverSpec)) {
throw new NacosException(NacosException.INVALID_PARAM, "Mcp server specification cannot be null.");
Expand All @@ -379,10 +379,10 @@ default boolean createRemoteMcpServer(String mcpName, McpServerBasicInfo serverS
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, nullable if `type` is
* {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
default boolean createMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
default String createMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
McpEndpointSpec endpointSpec) throws NacosException {
return createMcpServer(Constants.DEFAULT_NAMESPACE_ID, mcpName, serverSpec, toolSpec, endpointSpec);
}
Expand All @@ -396,10 +396,10 @@ default boolean createMcpServer(String mcpName, McpServerBasicInfo serverSpec, M
* @param toolSpec mcp server tools specification, see {@link McpToolSpecification}, nullable.
* @param endpointSpec mcp server endpoint specification, see {@link McpEndpointSpec}, nullable if `type` is
* {@link AiConstants.Mcp#MCP_PROTOCOL_STDIO}.
* @return {@code true} if create success, {@code false} otherwise
* @return mcp server id of the new mcp server
* @throws NacosException if fail to create mcp server.
*/
boolean createMcpServer(String namespaceId, String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
String createMcpServer(String namespaceId, String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
McpEndpointSpec endpointSpec) throws NacosException;

/**
Expand Down
Loading