一个通过大型语言模型启用与Nacos服务发现和配置管理交互的服务器,提供对命名空间、服务和配置的只读访问。
731 查看 · 2026-07-07 更新
简介
一个通过大型语言模型启用与Nacos服务发现和配置管理交互的服务器,提供对命名空间、服务和配置的只读访问。
简介
一个通过大型语言模型启用与Nacos服务发现和配置管理交互的服务器,提供对命名空间、服务和配置的只读访问。
mcp-server-nacos: 一个 Nacos MCP 服务器
概述
Nacos 是一个易于使用的平台,旨在用于动态服务发现、配置和服务管理。它帮助您轻松构建云原生应用程序和微服务平台。
这个 MCP(Model Context Protocol)服务器是为与 Nacos 进行交互和自动化而设计的。该服务器提供了通过大型语言模型在 Nacos 集群中搜索和读取 namespace、service 和 configuration 相关信息的工具。
请注意,mcp-server-nacos 目前处于早期开发阶段。随着我们继续开发和完善服务器,其功能和可用工具可能会发生变化和扩展。此外,请注意当前版本的 mcp-server-nacos 仅提供读取、搜索和列表操作,不支持任何写入操作。写入操作计划在未来版本中支持。
另外需要注意的是,此 mcp-server-nacos 所需的版本为:
1. Nacos version required upper `3.0.0`, because of depended on the [Nacos Admin API](https://nacos.io/en/swagger/admin/) in 3.x. 2. python version required 3.x, recommend upper `3.13`.
工具
list_namespaces- Retrieves the list of namespaces in the current Nacos cluster.
- Input:
- None
- Returns: list of namespaces in the current Nacos cluster.
list_services- This tool retrieves the list of services under a specified namespace. The response format depends on the
withInstancesparameter:withInstances=true: Returns service details with instances (ServiceDetailInfoobjects).withInstances=false: Returns service metadata without instances (ServiceViewobjects). **NOTE: ** WhenwithInstances=true, The API may cost too much memory and networks, If Only want get instance list with little or one service, Suggest usewithInstances=falsewithList Service Instances. - Input:
pageNo(number): The current page number, default is 1.pageSize(number): The size of services in each page, default is 100.namespaceId(string, optional): The namespaceId of services, default ispublicif missing.groupNameParam(string, optional): The groupName pattern of services, default null means all group if missing.serviceNameParam(string, optional): The serviceName pattern of services, default null means all service if missing.ignoreEmptyService(bool, optional): Whether ignore the empty service in result, default is true.withInstances(bool, optional): Whether contain instances under each services in result, recommend and default is false.
- Returns: list of services under a specified namespace.
- This tool retrieves the list of services under a specified namespace. The response format depends on the
get_service- This tool retrieves detailed information of a specified service, including metadata and clusters, not including instance list.
- Input:
namespaceId(string, optional): The namespaceId of services, default ispublicif missing.groupName(string, optional): The groupName pattern of services, default isDEFAULT_GROUPif missing.serviceName(string): The serviceName pattern of services, required.
- Returns: detailed information of a specified service.
list_service_instances- This tool retrieves the list of instances for a specified service.
- Input:
namespaceId(string, optional): The namespaceId of services, default ispublicif missing.groupName(string, optional): The groupName pattern of services, default isDEFAULT_GROUPif missing.serviceName(string): The serviceName pattern of services, required.clusterName(string, optional): The cluster name of instances in service, optional and default is null means match all cluster.
- Returns: list of instances for a specified service.
list_service_subscribers- This tool retrieves the list of subscribers for a specified service.
- Input:
pageNo(number): The current page number, default is 1.pageSize(number): The size of service subscribers in each page, default is 100.namespaceId(string, optional): The namespaceId of services, default ispublicif missing.groupName(string, optional): The groupName pattern of services, default isDEFAULT_GROUPif missing.serviceName(string): The serviceName pattern of services, required.aggregation(bool, optional): Whether aggregation from whole cluster.
- Returns: list of subscribers for a specified service.
list_configs- This tool retrieves the list of configurations under a specified namespace.
- Input:
pageNo(number): The current page number, default is 1.pageSize(number): The size of configs in each page, default is 100.namespaceId(string, optional): The namespaceId of configs, default ispublicif missing.groupName(string, optional): The groupName pattern of configs, default null means all group.dataId(string, optional): The dataId pattern of configs, default null means all dataId.type(string, optional): The type of configs, default null means all type.configTags(string, optional): The tags of configs, default null means all tags.appName(string, optional): The appName of configs, default null means all appName.search(string, optional): The search way of list configs, default isblur, optional valueaccurate.
- Returns: list of configurations under a specified namespace.
get_config- retrieves the details of the specified configuration.
- Input:
namespaceId(string, optional): The namespaceId of configs, default ispublicif missing.groupName(string): The groupName of config, Required.dataId(string): The dataId of config, Required.
- Returns: the details of the specified configuration.
list_config_history- This tool retrieves the complete publish history of a configuration.
- Input:
pageNo(number): The current page number, default is 1.pageSize(number): The size of config history records in each page, default is 100.namespaceId(string, optional): The namespaceId of configs, default ispublicif missing.groupName(string): The groupName of config, Required.dataId(string): The dataId of config, Required.
- Returns: list of configurations under a specified namespace.
get_config_history- retrieves a specific historical change record of a configuration.
- Input:
namespaceId(string, optional): The namespaceId of configs, default ispublicif missing.groupName(string): The groupName of config, Required.dataId(string): The dataId of config, Required.nid(number): the actual id of config history record, Get from list config history tool,idfield.
- Returns: historical change record of a configuration.
list_config_listeners
- 检索订阅特定配置的监听器列表。
- 输入:
namespaceId(字符串,可选):配置的命名空间ID,默认为public(如果缺失)。groupName(字符串):配置的组名,必填。dataId(字符串):配置的数据ID,必填。aggregation(布尔值,可选):是否从整个集群聚合。
- 返回:订阅特定配置的监听器列表。
- 输入:
list_listened_configs
- 列出由特定客户端IP地址订阅的配置。
- 输入:
namespaceId(字符串,可选):配置的命名空间ID,默认为public(如果缺失)。ip(字符串):配置监听器的客户端IP,必填。aggregation(布尔值,可选):是否从整个集群聚合。
- 返回:列出由特定客户端IP地址订阅的配置。
安装
使用 uv(推荐)
当使用 uv 时,不需要特别安装。我们将
使用 uvx 直接运行 mcp-server-nacos。
使用 PIP
或者,您可以通过 pip 安装 mcp-server-nacos:
pip install mcp-server-nacos
安装后,您可以使用以下命令作为脚本运行它:
python -m mcp_server_nacos
配置
与 Claude Desktop 一起使用
将以下内容添加到您的 claude_desktop_config.json 中:
使用 uvx
"mcpServers": { "git": { "command": "uvx", "args": [ "nacos-mcp-server", "--host", "your_nacos_host", "--port", "your_nacos_main_port, such as 8848", "--access_token", "your_nacos_access_token, get from `login` api: /nacos/v3/auth/user/login with `username` and `password`" ], } }
您可能需要在
command字段中填写uvx可执行文件的完整路径。您可以通过在 MacOS/Linux 上运行which uvx或在 Windows 上运行where uvx来获取此路径。
使用 pip 安装
"mcpServers": { "git": { "command": "python", "args": [ "-m", "nacos-mcp-server", "--host", "your_nacos_host", "--port", "your_nacos_main_port, such as 8848", "--access_token", "your_nacos_access_token, get from `login` api: /nacos/v3/auth/user/login with `username` and `password`" ], } }
开发
如果您正在进行本地开发,请按照以下步骤操作:
- 将此仓库克隆到您的本地环境。
- 修改
src/mcp_server_nacos中的代码以实现您想要的功能。 - 使用 Claude 桌面应用程序进行测试。向您的
claude_desktop_config.json添加以下内容:
{ "mcpServers": { "mcp-server-nacos": { "command": "uv", "args": [ "--directory", "/<path to mcp-server-nacos>/src/mcp_server_nacos", "run", "mcp-server-nacos" ] } }
许可证
mcp-server-nacos 根据 Apache 2.0 许可证授权。这意味着您可以在遵守 Apache 2.0 许可证条款和条件的前提下自由使用、修改和分发该软件。更多详情,请参阅项目存储库中的 LICENSE 文件。
工具列表
-
list_namespaces: Retrieves the list of namespaces in the current Nacos cluster.
-
list_services: This interface retrieves the list of services under a specified namespace. The response format depends on the
withInstancesparameter:withInstances=true: Returns service details with instances (ServiceDetailInfoobjects).withInstances=false: Returns service metadata without instances (ServiceViewobjects). **NOTE: ** WhenwithInstances=true, The API may cost too much memory and networks, If Only want get instance list with little or one service, Suggest usewithInstances=falsewithList Service Instances. -
get_service: This interface retrieves detailed information of a specified service, including metadata and clusters, not including instance list.
-
list_service_instances: This interface retrieves the list of instances for a specified service.
-
list_service_subscribers: This interface retrieves the list of subscribers for a specified service.
-
list_configs: This interface retrieves the list of configurations under a specified namespace.
-
get_config: This interface retrieves the details of the specified configuration.
-
list_config_history: This interface retrieves the complete publish history of a configuration.
-
get_config_history: This interface retrieves a specific historical change record of a configuration.
-
list_config_listeners: This interface retrieves the list of listeners subscribed to a specific configuration.
-
list_listened_configs: This interface lists the configurations subscribed to by a specific client IP address.
来源
- 来源:github
- 链接:https://github.com/nacos-group/nacos-mcp-server