Purpose: spring-nacos-mcp is a project-aware, read-only Nacos MCP server for Spring Cloud repositories. It reads the project's own application-* / bootstrap-* files, automatically discovers environments such as dev, test, pre, and prod, and provides AI assistants with cross-environment read-only Nacos tools without needing to configure host, port, namespace, or token. Unlike the official nacos-mcp-server, which requires manually specifying a single cluster, this project answers "what my project configuration looks like in each environment."
Main capabilities: automatically locate the repository root (based on .git, pom.xml, build.gradle, mvnw, gradlew, etc.); scan application[-<profile>].{yml,yaml,properties} and bootstrap[-<profile>].{yml,yaml,properties} under /src/main/resources/, supporting multi-document YAML with spring.config.activate.on-profile (or the older spring.profiles); merge bootstrap-<profile> → application-<profile> → base bootstrap → base application by priority; extract spring.cloud.nacos. server-addr, namespace, username/password, config group, discovery group, file-extension, shared-configs/extension-configs, etc., and handle relaxed binding; resolve ${...} placeholders (environment variables, ${name:default} uses the default value), and environments that cannot be resolved are skipped and logged.
Usage: it can be automatically installed by an AI agent (the repository provides llms-install.md); it can also be manually copied as a single zero-dependency Python file using only the standard library into the repository, or installed from git via uv/pip and used with the spring-nacos-mcp command.The server automatically detects the repository root from the working directory; for clients not launched in the workspace (such as Claude Desktop), --repo /path/to/repo can be used to specify it. A validation command can be used to view the discovered environments, sources, and Nacos reachability; exit code 0 means all are reachable, 1 means none were discovered, and 2 means discovered but some are unreachable. Supports environment variables and repository-root .spring-nacos-mcp.yml to override or supplement environments.
Limitations: read-only by design, it only calls configuration/service GET queries and login endpoints, with no write path; configuration content is passed to the LLM and is not masked by default, masking can be enabled with SPRING_NACOS_MCP_MASK=1 or a custom key list, and using a read-only Nacos account is recommended. Requires Python ≥ 3.9, with zero runtime dependencies; supports Nacos 1.x/2.x via v1 OpenAPI, authentication goes through /v1/auth/login and falls back to /v3/auth/user/login (Nacos 3.x), supports https and comma-separated cluster addresses; if a deployment disables v1 OpenAPI, an issue needs to be filed, and a v3 API backend is on the roadmap. The built-in YAML parser only covers the common subset used by Spring configuration and ignores anchors and flow collections; @...@ placeholders generated by Maven profile filtering are not resolved and require an override file.