nacos-config-mcp
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-config-mcp show me the current contents of the config dataId 'app.yml' in the default namespace"
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-config-mcp
一个只读的 Model Context Protocol (MCP) 服务器,用于读取 Nacos 配置中心里的配置,同时兼容 Nacos 1.x / 2.x / 3.x。
它把 Nacos 的命名空间、配置检索、配置详情与历史版本能力,通过 6 个只读工具暴露给支持 MCP 的 AI 客户端(Claude Desktop、Cursor、Trae 等),让模型能够安全地查阅你的配置,而永远无法修改它们。
特性
只读:仅使用
GET请求(POST仅用于登录换取 token),不提供任何发布、更新、删除配置的能力。多版本兼容:自动探测 Nacos 大版本,并为每个操作准备有序的端点回退链;探测失败时也能通过回退链自愈。
双传输:默认
stdio,也可切换为 Streamable HTTP(无状态、可选 Bearer Token 鉴权)。多种鉴权:匿名、Nacos 用户名/密码(1.x/2.x 的
/v1/auth/login、3.x 的/v3/auth/user/login)、预置 access token、以及 server identity 头。TypeScript + Node:基于官方
@modelcontextprotocol/sdk,Node.js ≥ 18.17,零运行时框架依赖。日志走 stderr:stdout 完全留给 stdio 的 JSON-RPC 通信。
Related MCP server: agileconfig-mcp-server
版本兼容性
能力 | Nacos 1.x | Nacos 2.x | Nacos 3.x |
登录 |
| 同 1.x |
|
命名空间列表 |
|
|
|
获取配置 |
|
|
|
搜索/列出配置 |
|
|
|
历史列表 |
|
|
|
版本探测 |
| 同 1.x |
|
默认命名空间 |
|
|
|
说明:v3 的 Console API 默认监听独立端口(通常
8080)且不带/nacos前缀,可通过NACOS_CONSOLE_URL/NACOS_CONSOLE_CONTEXT_PATH单独指定。默认命名空间在内部统一归一化为空字符串,""与"public"均会被接受。
安装
npm install
npm run build构建产物位于 dist/,可通过 npx nacos-config-mcp 或 node dist/index.js 启动。
配置项
所有配置均可通过命令行参数或环境变量提供(命令行优先)。
命令行 | 环境变量 | 说明 | 默认值 |
|
| Nacos 服务地址,如 | 必填 |
|
| Server 端上下文路径 |
|
|
| Nacos 3.x Console 地址,如 | 与 |
|
| Console 上下文路径 | 空 |
|
| 强制指定大版本: |
|
|
| 工具未指定命名空间时使用的默认命名空间 | 空(public) |
|
| HTTP 超时(毫秒) |
|
|
| 跳过 TLS 证书校验 |
|
|
|
| 有凭据时 |
|
| Nacos 用户名 | — |
|
| Nacos 密码 | — |
|
| 预置 access token | — |
— |
| Server identity 头名称 | — |
— |
| Server identity 头取值 | — |
|
|
|
|
|
| HTTP 监听地址 |
|
|
| HTTP 监听端口 |
|
|
| HTTP 端点路径 |
|
|
| HTTP 请求所需的 Bearer Token | 不校验 |
|
|
|
|
客户端接入
stdio(默认)
Claude Desktop / Cursor / Trae 等客户端配置示例:
{
"mcpServers": {
"nacos-config": {
"command": "npx",
"args": ["-y", "nacos-config-mcp"],
"env": {
"NACOS_BASE_URL": "http://127.0.0.1:8848",
"NACOS_USERNAME": "nacos",
"NACOS_PASSWORD": "nacos"
}
}
}
}使用本地构建产物时:
{
"mcpServers": {
"nacos-config": {
"command": "node",
"args": ["/absolute/path/to/nacos-config-mcp/dist/index.js"],
"env": {
"NACOS_BASE_URL": "http://127.0.0.1:8848"
}
}
}
}Streamable HTTP
NACOS_BASE_URL=http://127.0.0.1:8848 \
MCP_TRANSPORT=http MCP_HTTP_PORT=3000 MCP_HTTP_TOKEN=secret \
node dist/index.js端点:http://127.0.0.1:3000/mcp(无状态模式,仅接受 POST)。设置 MCP_HTTP_TOKEN 后,请求需携带 Authorization: Bearer secret。
提供的工具
工具 | 说明 | 主要参数 |
| 报告连接信息:探测到的版本、大版本、实际使用的端点、上下文路径与鉴权方式。排查连通性/版本问题时优先调用。 | 无 |
| 列出命名空间(租户),可按命名空间 ID 过滤。 |
|
| 搜索/分页浏览配置项,支持精确/模糊匹配与分组、应用名、标签、类型过滤。返回分页摘要(不含内容)。 |
|
| 读取单个配置的完整内容与元数据。 |
|
| 列出配置的历史修订,返回可传给详情工具的修订 ID( |
|
| 读取某个历史修订的内容与元数据。 |
|
所有工具均带有 readOnlyHint: true、destructiveHint: false 注解,单页最多返回 500 条(pageSize 上限)。
只读保证
HTTP 客户端只允许
GET与POST两种方法(client.ts),POST仅用于登录换取 token。代码中不存在任何发布、更新、删除配置的端点。
所有工具均标注为只读。
开发
npm run dev # 以 tsx 直接运行源码
npm run build # 编译到 dist/
npm run typecheck # 类型检查(不产出文件)
npm test # 运行 vitest 单测目录结构
src/
├── index.ts # CLI 入口:分发 stdio / http
├── server.ts # 组装 HttpClient/Auth/Version/Api 与 McpServer
├── config.ts # 参数与环境变量解析
├── nacos/
│ ├── client.ts # 只读 HTTP 客户端(超时、重试)
│ ├── auth.ts # 登录与 token 缓存
│ ├── version.ts # 大版本探测
│ ├── api.ts # 多版本兼容 API 层 + 解析器
│ └── types.ts # 领域类型
├── tools/ # 6 个 MCP 工具
└── util/ # 错误、日志、文本工具License
Available Tools
6 toolsnacos_get_configGet Nacos config detailARead-onlyIdempotent
Read the full content and metadata of a single configuration entry identified by dataId + group + namespace. Compatible with Nacos 1.x, 2.x and 3.x; on Nacos 1.x the raw text body is returned.
Inputs: dataId (required), group, namespaceId.
nacos_get_config_history_detailGet Nacos config history detailARead-onlyIdempotent
Read the content and metadata of one historical revision of a configuration entry. Use the revision id (nid) returned by nacos_list_config_history. Compatible with Nacos 1.x, 2.x and 3.x.
Inputs: nid (required), dataId (required), group, namespaceId.
nacos_list_config_historyList Nacos config historyARead-onlyIdempotent
List the revision history of a configuration entry. Each item carries the revision id (nid) that can be passed to nacos_get_config_history_detail to read that revision. Compatible with Nacos 1.x, 2.x and 3.x.
Inputs: dataId (required), group, pageNo, pageSize, +1 more.
nacos_list_namespacesList Nacos namespacesARead-onlyIdempotent
List the namespaces (tenants) available on the Nacos server, optionally filtered to a single namespace ID. Works across Nacos 1.x, 2.x and 3.x.
Inputs: namespaceId.
nacos_search_configsSearch Nacos configsARead-onlyIdempotent
Search or page through configuration entries in a namespace. Supports exact and fuzzy matching on dataId, plus filters for group, application name, tags and content type. Returns paged summaries (without content); call nacos_get_config to read a value. Compatible with Nacos 1.x, 2.x and 3.x.
Inputs: type, group, dataId, pageNo, +5 more.
nacos_server_infoNacos server infoARead-onlyIdempotent
Report how this MCP server is connected to Nacos: detected server version, major version, the API endpoints actually in use, context path and authentication mode. Use this first when troubleshooting connectivity or version compatibility.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct action: server info, namespace listing, config search, config content retrieval, and history list/detail. The search tool explicitly returns summaries without content and points to get_config, so there is no functional overlap.
All tool names share a consistent nacos_ prefix and mostly follow the verb_noun pattern (list_namespaces, search_configs, get_config, list_config_history). The only deviation is nacos_server_info, which lacks a verb, but this is a minor inconsistency.
Six tools is a well-scoped set for reading Nacos configurations and their history. Each tool has a clear purpose and none feel redundant.
The read-side coverage is solid: namespaces, search, content retrieval, and full history review are all present. However, there are no create, update, delete, publish, or remove operations, leaving the configuration lifecycle incomplete.
Maintenance
Related MCP Connectors
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Read-only MCP server for AIStatusDashboard status, incidents, metrics, and fallback recommendations.
Read-only, no-auth MCP server over Human x AI's Content Hub and confirmed 2027 facts.
Read-only MCP for identity resolution and write guardrails.
Related MCP Servers
- 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
- AlicenseAqualityDmaintenanceMCP server that exposes all AgileConfig RESTful APIs as tools, enabling AI assistants to manage configuration, applications, users, nodes, and more via natural language.367 npmMIT
- AlicenseAqualityCmaintenanceEnables AI assistants to query and manage Nacos configurations, supporting Nacos 1.x/2.x/3.x with multiple transport protocols.71MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to query company logs, databases, caches, and config centers (e.g., Aliyun SLS, MySQL, Redis, Nacos) through local MCP servers, with read-only enforcement and SSH tunneling for production access.-