Skip to main content
Glama
nacos-group

Nacos MCP Server

Official
by nacos-group

get_config

Retrieve specific configuration details by providing namespaceId, groupName, and dataId using the Nacos MCP Server interface for efficient configuration management.

Instructions

This interface retrieves the details of the specified configuration.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataIdYesThe dataId of config, Required.
groupNameYesThe groupName of config, Required.
namespaceIdNoThe namespaceId of configs, default is `public` if missing

Implementation Reference

  • Handler logic within the MCP @server.call_tool() function specifically for the 'get_config' tool. Retrieves the Nacos API URL from the tool class and executes a GET request using NacosServer.get with the provided arguments.
    case nacos_tools.NacosToolNames.GET_CONFIG: url = nacos_tools.NacosGetConfig().url result = nacos.get(name, url, arguments) return [types.TextContent(type="text", text=result)]
  • Defines the NacosGetConfig tool class, including its name ('get_config'), description, input schema (namespaceId optional, groupName and dataId required), and the target Nacos API URL.
    class NacosGetConfig(NacosTool): def __init__(self): super().__init__( name=NacosToolNames.GET_CONFIG, description="This interface retrieves the details of the specified configuration.", inputSchema={ "type": "object", "properties": { "namespaceId": {"type": "string", "description": "The namespaceId of configs, default is `public` if missing"}, "groupName": {"type": "string", "description": "The groupName of config, Required."}, "dataId": {"type": "string", "description": "The dataId of config, Required."} }, "required": ["groupName", "dataId"], }, url="/nacos/v3/admin/cs/config" )
  • Registers the NacosGetConfig tool (line 81) among other Nacos tools in the MCP server's list_tools handler.
    @server.list_tools() async def handle_list_tools() -> list[types.Tool]: """List available tools""" return [ nacos_tools.NacosListNamespacesTool(), nacos_tools.NacosListServices(), nacos_tools.NacosGetService(), nacos_tools.NacosListInstances(), nacos_tools.NacosListServiceSubscribers(), nacos_tools.NacosListConfigs(), nacos_tools.NacosGetConfig(), nacos_tools.NacosListConfigHistory(), nacos_tools.NacosGetConfigHistory(), nacos_tools.NacosListConfigListeners(), nacos_tools.NacosListListenedConfigs(), ]
  • Generic helper method in NacosServer class that performs the HTTP GET request to the Nacos API endpoint, used by all tool handlers including get_config.
    def get(self, name:str, url: str, params: Any = None) -> str: url = f'http://{self.host}:{self.port}{url}' logger.debug(f'GET {url} with params {params}') result = self._request(url, params=params) if result is None: return "Unexpected error: None result handled." if result.is_success(): return str(result.data) return f'Do {name} failed with message: {result.message}'
  • Enum definition for the tool name 'get_config' in NacosToolNames.
    GET_CONFIG = "get_config",

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nacos-group/nacos-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server