Class NacosMcpRegistryService
java.lang.Object
com.alibaba.nacos.mcpregistry.service.NacosMcpRegistryService
a service for mcp registry api implementation.
- Author:
- xinluo
-
Constructor Summary
ConstructorsConstructorDescriptionNacosMcpRegistryService(McpServerOperationService mcpServerOperationService, com.alibaba.nacos.core.service.NamespaceOperationService namespaceOperationService, McpServerIndex mcpServerIndex) -
Method Summary
Modifier and TypeMethodDescriptioncom.alibaba.nacos.api.ai.model.mcp.registry.ServerResponseGet mcp server detail for the specified name and version.com.alibaba.nacos.api.ai.model.mcp.registry.McpRegistryServerListgetServerVersions(String namespaceId, String serverName) Get all versions of the specified MCP server.com.alibaba.nacos.api.ai.model.mcp.McpToolSpecificationGet tools info about the given version of the mcp server.com.alibaba.nacos.api.ai.model.mcp.registry.McpRegistryServerListlistMcpServers(ListServerForm listServerForm) List mcp server from mcpServerOperationService and convert the result toMcpRegistryServerList.
-
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 toMcpRegistryServerList.- 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 namenamespaceId- namespace idversion- 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
-