Envspeak

io.github.Patrizzos由 GitHub 账号 Patrizzos 发布v0.1.0更新于 Oct 24, 2026

MCP server and CLI that resolves config/env-var cascade across .env, docker-compose, and Kubernetes

概览

AI 生成的概览

本地 MCP 服务器兼命令行工具,解析环境变量在 .env 文件、Docker Compose 与 Kubernetes 之间的配置优先级,并说明最终取值来源。

可以做什么
解析单个变量的实际生效值,指出胜出的文件或层级,并在静态分析无法确定时给出置信度与注意事项。追踪某个变量在所有文件、环境和服务中的设置位置。预览在某个文件中修改取值后的下游影响,包括被更高优先级来源屏蔽的部分以及 Kubernetes 中在 Pod 启动时冻结的值。生成整个项目的变量清单、来源与风险热点,例如被跟踪文件中的密钥或代码中读取却无任何来源的变量。对比两个环境、服务或工作负载解析后的配置差异。
适用场景
适合助手编辑或审查应用配置时,需要知道变量在运行时实际取什么值、哪一层生效,或修改某个值会影响什么。也适合在部署前审计环境差异、发现密钥或未设置的变量。
运行要求
以本地进程通过 stdio 运行;需全局安装 npm 包 @patrizzos/envspeak 并注册 envspeak 命令。读取项目根目录下的 .env 文件、Compose 文件与 Kubernetes 清单,默认自动发现,也可用文件列表限定范围。未声明账号、API 密钥或环境变量。
安装前请注意
它会读取被指向的任何文件,应限定助手传入的文件列表以控制文件系统访问范围。Kubernetes Secret 值默认打码,但其他文件可能含凭据;密钥可能性标记只是启发式判断,并非保证。结果仅为静态分析,可能遗漏 shell 导出或命令行传入的覆盖值。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Envspeak,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

EnvSpeak

MCP server and CLI that resolves config/env-var cascade across .env files, Docker Compose, and Kubernetes — tells AI agents (and you) what a variable actually evaluates to at runtime, and why.

Same problem shape as CSS cascade — several sources, non-obvious precedence rules, and a value that "wins" only because of where it's defined — applied to application configuration instead of stylesheets. A sibling project to stylesafe and stylespeak, which do the same thing for CSS.

The problem

A real app's config comes from .env, .env.local, .env.production, docker-compose.yml (environment: vs env_file:), Kubernetes ConfigMap/Secret objects, and hard-coded fallbacks in code — five-plus layers, each with its own precedence rules that don't compose the way you'd guess. The best-known gotcha: a plain .env.local overrides .env.production unless you also have a .env.production.local — because "local" outranks "environment-specific" in the conventional dotenv cascade. An agent editing config has no way to know what a variable actually resolves to, or what breaks if it changes one layer.

Tools

  • resolve_variable — what does DATABASE_URL actually evaluate to, and which file wins?
  • trace_variable — every place this variable is set, across every domain and environment.
  • impact_preview — if I change this value in this file, what actually changes downstream — and what's shielded by something higher-precedence?
  • config_manifest — a compressed, whole-project summary: every variable, its sources, and risk hotspots (secrets sitting in a tracked file, variables read in code with no fallback and no source anywhere).
  • diff_environments — resolve every variable under two environments/services/workloads and see what's actually different between them.

Install

bash
npm install -g @patrizzos/envspeak

As an MCP server

json
{  "mcpServers": {    "envspeak": {      "command": "envspeak"    }  }}

As a CLI

bash
envspeak resolve DATABASE_URL --environment productionenvspeak trace LOG_LEVELenvspeak impact --file .env --variable LOG_LEVEL --newValue debugenvspeak manifestenvspeak diff --a '{"nodeEnv":"development"}' --b '{"nodeEnv":"production"}'

If --files is omitted, envspeak auto-discovers .env*, Compose, and Kubernetes manifest files under --projectRoot (default: current directory). Pass --files a,b,c to scope it explicitly — recommended for MCP calls, so the agent controls exactly what's read.

Precedence conventions encoded

dotenv (Next.js/Vite-style, the de facto standard): process.env (shell) > .env.[env].local > .env.local > .env.[env] > .env > code fallback (process.env.X || 'default'). Note .env.local outranks .env.[env] — the gotcha above.

Docker Compose: docker compose run -e (CLI) > environment: > env_file: (last file in the list wins on conflicts) > Dockerfile ENV (not analyzed).

Kubernetes: inline env: always overrides envFrom: (bulk ConfigMap/Secret import; last entry in the list wins among those). Env values are frozen at pod start — editing a referenced ConfigMap/Secret does not reach a running pod without a restart or rollout. impact_preview flags this.

Every result includes a confidence level and a caveat string, because a shell-exported or CLI-passed override is always possible and never visible to static analysis — envspeak says so explicitly rather than pretending certainty it doesn't have.

Security

  • Zero runtime dependencies. The YAML subset parser used for Compose/Kubernetes files is hand-written rather than pulled in from npm, so there's no third-party supply-chain surface. npm audit is clean by construction.
  • Path-traversal guarded. File reads are resolved against projectRoot and refuse to escape it, even if a tool call is given a crafted relative path.
  • Prototype-pollution guarded. Object keys parsed from YAML content (__proto__, constructor, prototype) are never used for property assignment.
  • Secrets are redacted by default. Kubernetes Secret values are shown only as ab***yz, never in full, regardless of which tool surfaces them.
  • Secret-likelihood heuristics. Variable names and value shapes (AWS keys, GitHub tokens, PEM blocks, high-entropy credential-shaped strings) are flagged, cross-referenced against .gitignore, and surfaced as a secretFlag / risk hotspot rather than silently passed through.
  • Bounded, non-backtracking regexes. Pattern matching used for code-default scanning caps match length and avoids nested quantifiers to avoid ReDoS on large files.
  • Regardless of these guards, envspeak reads whatever files you point it at — scope the files list an agent can pass, the same way you'd scope any tool with filesystem access.

Development

bash
npm test   # zero dependencies — no install step needed

License

MIT

来源:README.md,提交 e35621e

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分