mcp-nacos
The mcp-nacos server is an MCP server that enables AI assistants to query and manage Nacos configurations and namespaces, supporting versions 1.x, 2.x, and 3.x via multiple transport protocols.
Configuration Management:
Get configuration content by dataId, group, and namespace.
Publish (create/overwrite) configurations with support for yaml, json, properties, xml, text, toml, etc.
Delete configurations (destructive – triggers confirmation in supported clients).
List configuration metadata (dataId, group) with filtering and pagination.
Configuration History:
List paginated historical versions, including operator, operation type, and timestamp.
Get the full content of a specific historical version by nid.
Retrieve the content of the version immediately preceding the current one.
Namespace Management:
List all namespaces, including public, with quota and usage information.
Get details of a specific namespace (e.g., configuration count).
Create, update (name/description), and delete namespaces (destructive – triggers confirmation in supported clients).
Key Features:
Automatic API adaptation for Nacos v1, v2, and v3 based on configured NACOS_VERSION.
Read-only mode (NACOS_READ_ONLY=true) disables all write tools.
Transport options: stdio, SSE, streamable-http with optional Bearer token authentication.
Stateless HTTP mode suitable for serverless and multi-replica deployments.
Destructive operation confirmation (MRTR) for delete actions in compatible clients.
Exposes the MCP resource
nacos://namespacesfor read-only namespace metadata.
Click on "Install 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., "@mcp-nacosget config dataId 'app.yaml' in group 'DEFAULT_GROUP'"
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.
mcp-nacos
Nacos MCP Server —— 让 AI 助手查询与管理 Nacos 配置。
支持 Nacos 1.x / 2.x / 3.x,按 NACOS_VERSION 自动适配。
特性
多协议传输:
stdio(默认)、sse、streamable-httpHTTP 接口认证:Bearer Token 保护,未授权请求返回
401写前确认:所有写操作通过 MCP 原生 Elicitation(
Resolve+Elicit)二次确认,客户端不支持时 fail-closed 拒绝执行MCP Resources:
nacos://URI 暴露命名空间等只读元数据Stateless HTTP:无会话状态,适配 Serverless / 多副本部署
灵活部署:
uvx免安装、Docker 公开镜像、或本地构建
Related MCP server: OssHub
快速开始
MCP 客户端(stdio,本地)
Claude Code 示例,写入项目 .mcp.json 或全局 ~/.claude.json:
{
"mcpServers": {
"nacos": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-nacos"],
"env": {
"NACOS_BASE_URL": "http://localhost:8848",
"NACOS_USERNAME": "nacos",
"NACOS_PASSWORD": "your-password",
"NACOS_NAMESPACE": "dev",
"NACOS_VERSION": "3",
"NACOS_READ_ONLY": "false"
}
}
}
}Cursor / OpenCode / Claude Desktop 等客户端格式相同:command: uvx + args: ["mcp-nacos"] + NACOS_* 环境变量。
NACOS_BASE_URL 格式(唯一地址参数,三版本通用):
scheme://host[:port][/context-path]。端口缺省按协议默认;是否带 /nacos 或反向代理前缀由部署决定,API 段(/v1/cs/configs、/v2/cs/config、/v3/console/cs/config 等)按 NACOS_VERSION 自动拼接。典型取值:
部署形态 |
|
1.x / 2.x 默认 |
|
3.x 默认(无 contextPath) |
|
经网关转发到 | 填网关对外完整地址 |
Docker(公开镜像,免构建)
公开镜像:ghcr.io/zhouweico/mcp-nacos:latest。
方式一:stdio(客户端拉起容器)
{
"mcpServers": {
"nacos": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "ghcr.io/zhouweico/mcp-nacos:latest"],
"env": {
"NACOS_BASE_URL": "http://your-nacos-host:8080",
"NACOS_USERNAME": "nacos",
"NACOS_PASSWORD": "your-password",
"NACOS_NAMESPACE": "dev",
"NACOS_VERSION": "3"
}
}
}
}必须带
-i(保持 stdin 管道)。
方式二:HTTP + 认证(容器独立运行)
容器启动时会校验
NACOS_BASE_URL(缺失则${VAR:?...}报错退出),必须显式传入。
启动容器:
docker run -d -p 8000:8000 \
-e MCP_TRANSPORT=streamable-http \
-e MCP_AUTH_TOKEN=your-strong-token \
-e NACOS_BASE_URL=http://your-nacos-host:8848 \
-e NACOS_VERSION=3 \
ghcr.io/zhouweico/mcp-nacos:latest客户端 .mcp.json:
{
"mcpServers": {
"nacos": {
"type": "streamable-http",
"url": "http://localhost:8000/mcp",
"headers": {
"Authorization": "Bearer your-strong-token"
}
}
}
}可用工具
工具 | Nacos OpenAPI | 类型 | 说明 | 只读模式 |
| GET | 读 | 按 dataId + group + namespace 获取配置 | ✅ |
| POST | 写 | 发布 / 更新配置 | ❌ |
| DELETE | 写 | 删除配置(写前确认) | ❌ |
| GET | 读 | 配置历史列表(分页) | ✅ |
| GET | 读 | 指定 nid 历史详情 | ✅ |
| GET | 读 | 配置上一版本 | ✅ |
| v1/v2: | 读 | 命名空间下配置列表(dataId + group 等元数据,不含内容),支持过滤与分页。v1/v2 | ✅ |
| GET | 读 | 查询所有命名空间 | ✅ |
| GET | 读 | 查询单个命名空间(v1 由列表过滤模拟) | ✅ |
| POST | 写 | 创建命名空间 | ❌ |
| PUT | 写 | 编辑命名空间 | ❌ |
| DELETE | 写 | 删除命名空间(写前确认) | ❌ |
版本端点差异:
版本 | 路径前缀 | 备注 |
v1 |
| 若部署带 contextPath(如 |
v2 |
| 同上 |
v3 |
| 命名空间路径带 |
v3 创建命名空间字段为 customNamespaceId(同 v1),编辑/删除用 namespaceId。
只读模式(默认):NACOS_READ_ONLY 默认 true,写工具不注册,Agent 看不到也调不到;设为 false 开启写工具。
写前确认:所有写操作通过 MCP 原生 Elicitation 二次确认;stdio 等不支持 Elicitation 的客户端,SDK 直接返回 -32021 拒绝执行(fail-closed)。
Nacos 概念
配置唯一键三元组:namespace → group → dataId。
namespace:隔离多环境 / 多租户(dev / test / prod)。未指定时用
NACOS_NAMESPACE,默认public。group:同命名空间下的逻辑分组,默认
DEFAULT_GROUP。dataId:配置项唯一标识(通常对应文件名)。
type:
yaml/json/properties/text/xml/toml等,发布时通过config_type指定。
版本字段差异:1.x 用
tenant作命名空间 ID,2.x/3.x 为namespaceId,3.x 创建命名空间又回到customNamespaceId。本 Server 已按版本适配,调用方统一传namespace_id即可。
配置
环境变量
MCP 传输与认证
变量 | 说明 | 默认值 |
| 传输协议: |
|
| HTTP 监听地址(stdio 忽略),默认仅本地回环;对外暴露需显式设置并务必配置 |
|
| HTTP 监听端口(stdio 忽略) |
|
| 非空时启用 Bearer Token 认证 | -(不鉴权) |
| 启用无状态 HTTP(适配 Serverless) |
|
| 日志级别: |
|
Nacos 连接
变量 | 说明 | 默认值 |
| 必填。唯一地址参数,格式 | - |
| 用户名 | - |
| 密码 | - |
| 默认命名空间 ID |
|
| Nacos 版本: |
|
| 只读模式(禁用写工具) |
|
| 跳过 TLS 证书验证(自签名 / 内部 CA 场景) |
|
只读模式(默认)
默认只读,写工具不注册。需写操作时显式关闭:
{ "env": { "NACOS_READ_ONLY": "false" } }TLS 证书验证
默认验证 TLS 证书(行为与 httpx 一致)。自签名或内部 CA 环境:
{ "env": { "NACOS_INSECURE": "true" } }禁用证书验证不安全,生产环境应使用受信任 CA 签发的有效证书。
多协议传输
协议 | 端点 | 适用 |
| - | 本地客户端集成(Claude Code、Cursor 等) |
|
| SSE 传输 |
|
| 远程部署 / 多客户端共享 |
启动示例:
MCP_TRANSPORT=streamable-http \
MCP_HOST=0.0.0.0 MCP_PORT=8000 \
MCP_AUTH_TOKEN=your-strong-token \
mcp-nacos接口认证
MCP_AUTH_TOKEN 非空时,HTTP 请求需携带:
Authorization: Bearer <MCP_AUTH_TOKEN>兼容 X-Auth-Token / X-MCP-Token 请求头。GET /health 免鉴权(容器探活)。
stdio不经过网络,不做 Token 认证。未设MCP_AUTH_TOKEN时 HTTP 接口不鉴权,生产环境务必配置。
MCP Resources
URI | 说明 |
| 列出所有命名空间 |
Stateless HTTP 模式
MCP_STATELESS_HTTP=true:每次请求独立处理,不保留会话状态。适配 Serverless(AWS Lambda、阿里云函数计算)或多副本部署。
MCP_TRANSPORT=streamable-http \
MCP_STATELESS_HTTP=true \
MCP_PORT=8000 \
mcp-nacosStateless 模式不支持 SSE 流式响应,每个 HTTP 请求独立完成后返回。
容器化部署
本地构建(Docker)
docker build -t mcp-nacos:latest .
docker run -d --name mcp-nacos -p 8000:8000 \
-e MCP_TRANSPORT=streamable-http \
-e MCP_AUTH_TOKEN=your-strong-token \
-e NACOS_BASE_URL=http://your-nacos-host:8080 \
-e NACOS_USERNAME=nacos \
-e NACOS_PASSWORD=your-password \
-e NACOS_NAMESPACE=public \
-e NACOS_VERSION=3 \
mcp-nacos:latestDocker Compose
cp .env.example .env # 按需修改
docker compose up -ddocker-compose.yml 已内置:基于 Dockerfile 构建(标记为 mcp-nacos:latest)、/health 健康检查、非 root 用户运行。
跳过本地构建、直接拉取公开镜像:删除
build:段,只保留image: ghcr.io/zhouweico/mcp-nacos:latest。
使用示例
下面示例均为自然语言提示,AI 助手会自动映射到对应 MCP 工具。三元组默认值:namespace=NACOS_NAMESPACE、group=DEFAULT_GROUP、type=yaml。
配置查询
帮我获取 Nacos 中 dataId 为 "application.yaml" 的配置查看 nacos 里 user-service.yml 的配置内容,namespace 是 dev列出 dev 命名空间下所有的配置项(只看 dataId 和 group)模糊搜索 dataId 包含 "redis" 的配置查看 prod 命名空间里 application 的历史版本,第 1 页看一下 nid=128 那次历史发布的详细内容回滚准备:取 application.yaml 上一版本的内容给我看下配置发布与删除
把下面这段配置发布到 Nacos,dataId 是 "redis.yaml":
server:
port: 6379把这段 JSON 配置发布成 order-config.json,类型 json,namespace 用 prod
{"timeout": 3000}更新 user-service 的配置,把数据库端口改成 3307删除 dev 命名空间下 group=DEFAULT_GROUP、dataId=legacy.properties 的配置所有写操作(发布 / 删除 / 命名空间增删改)均需 MCP 原生 Elicitation 二次确认;不支持 Elicitation 的客户端(如 stdio)由 SDK 直接返回
-32021拒绝执行。
命名空间管理
列出 Nacos 里所有的命名空间查看 dev 命名空间的详情新建一个命名空间,id 为 order-prod,名称 "订单生产环境"把 dev 命名空间改名为 "开发环境"删除命名空间 order-prod批量与组合操作
把 dev 命名空间下所有配置项的 dataId 和 group 列出来,挑出 redis 相关的给我看内容对比 application.yaml 最近两次历史版本的内容差异把 test 命名空间的 user-service.yaml 配置同步发布到 prod 命名空间默认只读
默认 NACOS_READ_ONLY=true,写工具(发布 / 删除 / 命名空间增删改)不注册,AI 只能执行查询类操作:
只读模式下:帮我删除 dataId=legacy.properties 的配置AI 会回复该操作不可用,引导用户关闭只读模式或手动处理。
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.1111Apache 2.0- AlicenseBqualityFmaintenanceAn 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
- FlicenseCqualityDmaintenanceEnables AI assistants to manage Alibaba Cloud resources via natural language, with explicit tools for common services and a universal API invoker for full cloud coverage.92
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Create and manage AI agents that collaborate and solve problems through natural language interacti…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/zhouweico/mcp-nacos'
If you have feedback or need assistance with the MCP directory API, please join our Discord server