Class NacosMcpRegistryService

java.lang.Object
com.alibaba.nacos.mcpregistry.service.NacosMcpRegistryService

@Service public class NacosMcpRegistryService extends Object
a service for mcp registry api implementation.
Author:
xinluo
  • Constructor Details

    • NacosMcpRegistryService

      public NacosMcpRegistryService(McpServerOperationService mcpServerOperationService, com.alibaba.nacos.core.service.NamespaceOperationService namespaceOperationService, McpServerIndex mcpServerIndex)
  • Method Details

    • listMcpServers

      public com.alibaba.nacos.api.ai.model.mcp.registry.McpRegistryServerList listMcpServers(ListServerForm listServerForm)
      List mcp server from mcpServerOperationService and convert the result to McpRegistryServerList.
      Parameters:
      listServerForm - listServerParams
      Returns:
      McpRegistryServerList
    • getServer

      public com.alibaba.nacos.api.ai.model.mcp.registry.ServerResponse getServer(String name, String namespaceId, String version) throws com.alibaba.nacos.api.exception.NacosException
      Get mcp server detail for the specified name and version. if namespaceId is null, search in all namespaces and return the first mcp server found.
      Parameters:
      name - mcp server name
      namespaceId - namespace id
      version - mcp server version
      Returns:
      mcp server detail
      Throws:
      com.alibaba.nacos.api.exception.NacosException - if nacos operation fails
    • getServerVersions

      public com.alibaba.nacos.api.ai.model.mcp.registry.McpRegistryServerList getServerVersions(String namespaceId, String serverName) throws com.alibaba.nacos.api.exception.NacosException
      Get all versions of the specified MCP server.
      Parameters:
      namespaceId - the namespaceId of mcp server, if not specified, search in all namespaces.
      serverName - the server name of mcp server.
      Returns:
      all versions of the found MCP server as McpRegistryServerList
      Throws:
      com.alibaba.nacos.api.exception.NacosException
    • getTools

      public com.alibaba.nacos.api.ai.model.mcp.McpToolSpecification getTools(String serverId, String version) throws com.alibaba.nacos.api.exception.NacosException
      Get tools info about the given version of the mcp server.
      Parameters:
      serverId - mcp server id.
      version - the version of the mcp server.
      Returns:
      tools info about the mcp server.
      Throws:
      com.alibaba.nacos.api.exception.NacosException - if request parameter is invalid or handle error