Nacos MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Nacos MCP Server show me the current re-gateway.yaml config from Nacos"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Nacos MCP Server
English
MCP Server for Nacos Config Center, allowing AI assistants (like Claude Code) to read and write Nacos configurations directly.
Based on Nacos 1.x Open API. Supports authentication (accessToken) with auto-refresh.
Features
Read configs - Get single or all configurations from Nacos
List configs - List all config dataIds in a namespace/group
Publish configs - Update configs with auto format detection (yaml/properties/json/text)
Auth support - Auto login and token refresh, compatible with no-auth setups
Installation
git clone https://github.com/litianfu1997/nacos-mcp-server.git
cd nacos-mcp-server
npm installConfiguration
Environment Variables
Variable | Default | Description |
|
| Nacos server address |
|
| Nacos context path |
| `` | Default namespace ID |
|
| Default config group |
|
| Login username |
|
| Login password |
Claude Code Configuration
Add the index.js path to ~/.claude.json under mcpServers:
{
"mcpServers": {
"nacos": {
"command": "node",
"args": ["/path/to/nacos-mcp-server/src/index.js"]
}
}
}Windows users: Use
cmdas command:{ "command": "cmd", "args": ["/c", "node", "D:/path/to/nacos-mcp-server/src/index.js"] }
Nacos connection parameters support two configuration methods:
Method 1: Environment Variables (via env in mcpServers)
{
"mcpServers": {
"nacos": {
"command": "node",
"args": ["/path/to/nacos-mcp-server/src/index.js"],
"env": {
"NACOS_SERVER_ADDR": "127.0.0.1:8848",
"NACOS_NAMESPACE": "your-namespace-id",
"NACOS_GROUP": "your-group",
"NACOS_USERNAME": "nacos",
"NACOS_PASSWORD": "nacos",
"NACOS_CONTEXT_PATH": "/nacos"
}
}
}
}Method 2: Config File (Recommended)
Create ~/.nacos-mcp.json in the project directory or user home directory:
{
"serverAddr": "127.0.0.1:8848",
"contextPath": "/nacos",
"namespace": "your-namespace-id",
"group": "DEFAULT_GROUP",
"username": "nacos",
"password": "nacos"
}Config priority: Project .nacos-mcp.json > User home ~/.nacos-mcp.json > Environment variables > Defaults.
MCP Tools
nacos_get_config
Get a single config by dataId.
Parameters:
dataId(required) - Config dataId, e.g.re-gateway.yamlnamespace(optional) - Namespace ID, defaults to envNACOS_NAMESPACEgroup(optional) - Config group, defaults to envNACOS_GROUP
nacos_list_configs
List all configs in a namespace/group.
Parameters:
namespace(optional) - Namespace IDgroup(optional) - Config group
nacos_get_all_configs
Get full content of all configs in a namespace/group.
Parameters:
namespace(optional) - Namespace IDgroup(optional) - Config group
nacos_publish_config
Publish (update) a config. Content is saved as-is, preserving original format (indentation, comments, blank lines).
Parameters:
dataId(required) - Config dataIdcontent(required) - Full config content (must preserve original format)namespace(optional) - Namespace IDgroup(optional) - Config group
Important: Always nacos_get_config first, modify the original content, then publish. Format type (yaml/properties/json/text) is auto-detected from dataId extension.
Requirements
Node.js >= 18.0.0 (built-in
fetch)Nacos 1.x or 2.x (uses 1.x compatible API)
License
MIT
Related MCP server: jewei-mcp-nacos
中文
Nacos 配置中心的 MCP Server,让 AI 助手(如 Claude Code)可以直接读写 Nacos 配置。
基于 Nacos 1.x Open API,支持认证(accessToken)及自动刷新。
功能特性
读取配置 - 获取单个或全部 Nacos 配置
列出配置 - 列出指定命名空间/分组下的所有配置 dataId
发布配置 - 更新配置,自动识别格式(yaml/properties/json/text)
认证支持 - 自动登录与 Token 刷新,兼容无认证环境
安装
git clone https://github.com/litianfu1997/nacos-mcp-server.git
cd nacos-mcp-server
npm install配置
环境变量
变量 | 默认值 | 说明 |
|
| Nacos 服务器地址 |
|
| Nacos 上下文路径 |
| `` | 默认命名空间 ID |
|
| 默认配置分组 |
|
| 登录用户名 |
|
| 登录密码 |
Claude Code 配置
将 index.js 路径配置到 ~/.claude.json 的 mcpServers 下即可:
{
"mcpServers": {
"nacos": {
"command": "node",
"args": ["/path/to/nacos-mcp-server/src/index.js"]
}
}
}Windows 用户:使用
cmd作为 command:{ "command": "cmd", "args": ["/c", "node", "D:/path/to/nacos-mcp-server/src/index.js"] }
Nacos 连接参数支持两种配置方式:
方式一:环境变量(在 mcpServers 中配置 env)
{
"mcpServers": {
"nacos": {
"command": "node",
"args": ["/path/to/nacos-mcp-server/src/index.js"],
"env": {
"NACOS_SERVER_ADDR": "127.0.0.1:8848",
"NACOS_NAMESPACE": "your-namespace-id",
"NACOS_GROUP": "your-group",
"NACOS_USERNAME": "nacos",
"NACOS_PASSWORD": "nacos",
"NACOS_CONTEXT_PATH": "/nacos"
}
}
}
}方式二:配置文件(推荐)
在项目目录或用户目录下创建 ~/.nacos-mcp.json:
{
"serverAddr": "127.0.0.1:8848",
"contextPath": "/nacos",
"namespace": "your-namespace-id",
"group": "DEFAULT_GROUP",
"username": "nacos",
"password": "nacos"
}配置优先级:项目目录 .nacos-mcp.json > 用户目录 ~/.nacos-mcp.json > 环境变量 > 默认值。
MCP 工具
nacos_get_config
获取单个配置的内容。
参数:
dataId(必填)- 配置的 dataId,如re-gateway.yamlnamespace(可选)- 命名空间 ID,默认使用环境变量NACOS_NAMESPACEgroup(可选)- 配置分组,默认使用环境变量NACOS_GROUP
nacos_list_configs
列出指定命名空间/分组下的所有配置项(dataId 列表)。
参数:
namespace(可选)- 命名空间 IDgroup(可选)- 配置分组
nacos_get_all_configs
获取指定命名空间/分组下的全部配置内容。返回每个 dataId 对应的完整配置。
参数:
namespace(可选)- 命名空间 IDgroup(可选)- 配置分组
nacos_publish_config
发布(更新)配置。原样保存配置内容,不修改任何格式(缩进、注释、空行等)。
参数:
dataId(必填)- 配置的 dataIdcontent(必填)- 完整的配置内容,必须保持原始格式namespace(可选)- 命名空间 IDgroup(可选)- 配置分组
重要: 必须先通过 nacos_get_config 获取当前内容,在原始内容基础上修改后再发布。格式类型(yaml/properties/json/text)根据 dataId 扩展名自动识别。
环境要求
Node.js >= 18.0.0(内置
fetch)Nacos 1.x 或 2.x(使用 1.x 兼容 API)
许可证
MIT
Available Tools
4 toolsnacos_get_all_configsA
获取 Nacos 中指定命名空间/分组下的全部配置内容。返回每个 dataId 对应的完整配置。
Inputs: group, namespace.
nacos_get_configA
获取 Nacos 中单个配置的内容。用于查看指定 dataId 的 yaml/properties 配置。
Inputs: dataId (required), group, namespace.
nacos_list_configsB
列出 Nacos 中指定命名空间/分组下的所有配置项(dataId 列表)。
Inputs: group, namespace.
nacos_publish_configA
发布配置到 Nacos。原样保存配置内容,不修改任何格式(缩进、注释、空行等)。使用前必须先通过 nacos_get_config 获取当前内容,在原始内容基础上修改后再发布。
Inputs: dataId (required), content (required), group, namespace.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a distinct role: single-config read, dataId listing, bulk read, and publish. The only mild overlap is between nacos_list_configs and nacos_get_all_configs, but the descriptions clearly differentiate listing names versus returning full contents.
All tools use a consistent nacos_ prefix with verb_noun structure (get_config, list_configs, get_all_configs, publish_config). The pattern is predictable and readable throughout.
Four tools is on the lean side but each covers a real operation in the config lifecycle. The set is well-scoped for a focused Nacos config server, though slightly thin overall.
Read, list, bulk-read, and create/update via publish are covered, but there is no delete-config operation and no namespace/group discovery tool. These are notable gaps in an otherwise coherent CRUD surface.
Maintenance
Related MCP Connectors
Publish, list, update and delete shareable Markdown/HTML pages from your AI assistant.
Manage ConfigDirector feature flags, remote configs, and targeting rules from AI assistants.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Related MCP Servers
AlicenseAqualityDmaintenanceA server that enables interaction with Nacos service discovery and configuration management through Large Language Models, providing read-only access to namespaces, services, and configurations.1112Apache 2.0- AlicenseBqualityDmaintenanceAn MCP server that enables AI assistants to query and manage Nacos configurations. It supports Nacos 3.x for retrieving or publishing configuration files and includes an optional read-only mode for secure environments.23MIT
- AlicenseBqualityDmaintenanceEnables large language models to query and operate on Apollo Configuration Center. Supports managing apps, clusters, namespaces, config items, and releases.1711 PyPI3MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to query and manage Nacos configurations, supporting Nacos 1.x/2.x/3.x with multiple transport protocols.71MIT