envspeak
EnvSpeak
MCP 服务器和 CLI,用于解析 .env 文件、Docker Compose 和 Kubernetes 中的配置/环境变量级联——告诉 AI 代理(以及你)某个变量在运行时实际求值为什么,以及为什么。
与 CSS 级联相同的问题形态——多个来源、不明显的优先级规则,以及一个仅仅因为定义位置而“胜出”的值——只不过应用于应用程序配置而非样式表。它是 stylesafe 和 stylespeak 的姊妹项目,后者为 CSS 做同样的事情。
问题
真实应用的配置来自 .env、.env.local、.env.production、docker-compose.yml(environment: 与 env_file:)、Kubernetes ConfigMap/Secret 对象,以及代码中的硬编码回退——五层以上,每一层都有自己的优先级规则,而这些规则组合起来的方式并不像你猜测的那样。最著名的陷阱:普通的 .env.local 会覆盖 .env.production,除非你还有一个 .env.production.local——因为在常规 dotenv 级联中,“本地”的优先级高于“特定环境”。编辑配置的代理无法知道某个变量实际解析为什么,也不知道如果更改某一层会破坏什么。
Related MCP server: onboard-mcp
工具
resolve_variable—DATABASE_URL实际求值为什么,哪个文件胜出?trace_variable— 该变量在所有领域和环境中的每个设置位置。impact_preview— 如果我更改此文件中的此值,下游实际会改变什么——又有哪些被更高优先级的东西屏蔽?config_manifest— 一份压缩的全项目摘要:每个变量、其来源,以及风险热点(位于被跟踪文件中的机密、在代码中读取但没有任何回退且在任何地方都没有来源的变量)。diff_environments— 解析两个环境/服务/工作负载下的每个变量,查看它们之间实际有何不同。
安装
npm install -g @patrizzos/envspeak作为 MCP 服务器
{
"mcpServers": {
"envspeak": {
"command": "envspeak"
}
}
}作为 CLI
envspeak resolve DATABASE_URL --environment production
envspeak trace LOG_LEVEL
envspeak impact --file .env --variable LOG_LEVEL --newValue debug
envspeak manifest
envspeak diff --a '{"nodeEnv":"development"}' --b '{"nodeEnv":"production"}'如果省略 --files,envspeak 会在 --projectRoot(默认:当前目录)下自动发现 .env*、Compose 和 Kubernetes 清单文件。传入 --files a,b,c 以显式限定范围——建议用于 MCP 调用,这样代理就能精确控制读取的内容。
编码的优先级约定
dotenv(Next.js/Vite 风格,事实标准):process.env(shell)> .env.[env].local > .env.local > .env.[env] > .env > 代码回退(process.env.X || 'default')。注意 .env.local 的优先级高于 .env.[env]——即上面的陷阱。
Docker Compose:docker compose run -e(CLI)> environment: > env_file:(列表中的最后一个文件在冲突时胜出)> Dockerfile ENV(不分析)。
Kubernetes:内联 env: 始终覆盖 envFrom:(批量 ConfigMap/Secret 导入;其中列表中的最后一个条目胜出)。环境值在 Pod 启动时冻结——编辑引用的 ConfigMap/Secret 不会在未重启或滚动更新的情况下到达运行中的 Pod。impact_preview 会标记这一点。
每个结果都包含一个 confidence 级别和一个 caveat 字符串,因为 shell 导出或 CLI 传入的覆盖始终是可能的,并且静态分析永远看不到——envspeak 会明确说明这一点,而不是假装拥有它并不具备的确定性。
安全
零运行时依赖。 用于 Compose/Kubernetes 文件的 YAML 子集解析器是手写的,而不是从 npm 引入的,因此没有第三方供应链攻击面。
npm audit在构造上就是干净的。路径遍历防护。 文件读取会针对
projectRoot进行解析,并拒绝逃逸出该目录,即使工具调用被给予精心构造的相对路径。原型污染防护。 从 YAML 内容解析出的对象键(
__proto__、constructor、prototype)永远不会用于属性赋值。机密默认脱敏。 Kubernetes
Secret值仅显示为ab***yz,无论哪个工具展示它们,都不会完整显示。机密可能性启发式。 变量名和值形态(AWS 密钥、GitHub 令牌、PEM 块、高熵凭据形态字符串)会被标记,与
.gitignore交叉引用,并作为secretFlag/ 风险热点呈现,而不是静默放过。有界、非回溯的正则表达式。 用于代码默认值扫描的模式匹配会限制匹配长度,并避免嵌套量词,以防止在大文件上出现 ReDoS。
无论这些防护如何,envspeak 都会读取你指向的任何文件——请限定代理可以传递的
files列表,就像你限定任何具有文件系统访问权限的工具一样。
开发
npm test # zero dependencies — no install step needed许可证
MIT
Available Tools
5 toolsconfig_manifestB
Compressed, project-wide summary of every config variable found — sources, domains, and risk hotspots (likely secrets in tracked files, variables read in code with no source). Load once per session instead of repeated resolve_variable calls.
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| projectRoot | No | ||
| maxVariables | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the tool's output nature (compressed summary, sources, risk hotspots) and hints at performance ('load once per session'), suggesting it is a read-only aggregation operation. However, it does not explicitly state whether it modifies state, whether it performs file I/O that might have side effects, or any rate limits. The description is informative but not fully transparent about behavioral boundaries.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that packs a lot of relevant information: purpose, content, and usage guidance. It front-loads the core purpose ('Compressed, project-wide summary') and then adds specifics. It is concise and well-structured, though it could be slightly less dense. No waste.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of annotations, output schema, and parameter descriptions, the description must provide extensive context. It explains what the tool returns and gives a usage hint, but it omits essential details: what files are expected (input semantics), how projectRoot and maxVariables affect behavior, what the output format is, and when to use this versus other siblings beyond resolve_variable. The description is insufficient for an agent to confidently invoke this tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, meaning the input schema provides no explanations for the three parameters. The description does not mention any of them (files, projectRoot, maxVariables). An agent has no clue from the description what values to provide or how the parameters affect the tool's behavior. The description completely fails to compensate for the schema gap, making parameter semantics severely deficient.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly specifies the tool's purpose: producing a compressed, project-wide summary of config variables, including sources, domains, and risk hotspots. It explicitly distinguishes itself from sibling resolve_variable by positioning as a session-level alternative, making it unambiguous what the tool does and when it differs from at least one sibling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit usage guidance: 'Load once per session instead of repeated resolve_variable calls.' This tells an agent when to prefer this tool over a specific sibling. However, it does not mention other siblings (trace_variable, impact_preview, diff_environments) or provide exclusions for when not to use this tool, so it's not fully comprehensive.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
diff_environmentsA
Resolves every variable under two different environment/service/workload selectors and reports what differs between them.
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| variables | No | Optional subset; defaults to every variable discovered | |
| projectRoot | No | ||
| environmentA | Yes | { nodeEnv?, service?, workload?, container?, label? } | |
| environmentB | Yes | { nodeEnv?, service?, workload?, container?, label? } |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral burden. It conveys that the operation resolves variables and reports differences, implying a read-only comparison. However, it does not disclose output format, possible failure modes, performance implications, or whether any resolution side effects occur.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is one dense, purposeful sentence with no filler. It front-loads the core verb and resource, states the comparison scope, and communicates the output concept without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With five parameters, nested objects, no output schema, and no annotations, this description leaves important gaps: what 'files' represents, what values the selectors may contain, what a 'difference' report looks like, and when this tool is preferable to resolve_variable or trace_variable. The core idea is present, but an agent would struggle to call it correctly without guessing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 60%; variables and the two environment objects have descriptions, and the description reinforces that all discovered variables are included by default. However, the required 'files' parameter and 'projectRoot' have no schema descriptions and the description does not clarify their meaning, leaving a critical input unexplained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific action ('Resolves every variable') and a distinct resource ('two different environment/service/workload selectors'), then states the comparison outcome ('reports what differs'). This clearly separates it from siblings like resolve_variable, which handles a single variable, and trace_variable, which traces rather than diffs.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'under two different environment/service/workload selectors' gives clear context for when to invoke this tool: when an agent needs to compare resolved variables across two configurations. It does not explicitly exclude alternatives or name sibling tools, but the intended scenario is apparent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
impact_previewB
Predicts which environments/services/workloads are actually affected if a variable's value in one file is changed (or removed) — including which contexts are shielded by a higher-precedence source.
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | The file that would be edited | |
| files | Yes | ||
| newValue | No | Omit to simulate removing the assignment entirely | |
| variable | Yes | ||
| projectRoot | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry the behavioral burden. It adds one meaningful behavior (higher-precedence shielding) but does not disclose whether the tool is read-only, error behavior (e.g., variable not found), or what the output is (e.g., list of affected items). This is a clear gap, but the precedence detail provides partial transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The entire description is a single, tight sentence that front-loads the verb 'Predicts' and packs in the core purpose plus a behavioral nuance. There is no redundant phrasing or filler—every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite the tool's moderate complexity (impact prediction across environments with precedence), the description omits critical context: it does not explain how parameters like 'files' and 'projectRoot' influence behavior, nor what the return value looks like. An agent would struggle to construct a correct call without additional inference.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is only 40%, so the description must compensate for poorly documented parameters like 'files', 'variable', and 'projectRoot'. It only indirectly references 'file' and 'variable' and does not clarify the purpose of 'files' (plural) or why 'projectRoot' is needed. This fails to add meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Predicts') and identifies the exact resource (environments/services/workloads affected by a variable change). It also adds a distinguishing nuance about precedence shielding, which differentiates it from siblings like resolve_variable or trace_variable without naming them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description states what the tool does but gives no guidance on when to use it versus alternatives. It does not mention conditions, exclusions, or situations where another sibling tool would be more appropriate. This leaves the agent without direction for tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
resolve_variableA
Resolves what a config/env variable actually evaluates to across dotenv, docker-compose, and Kubernetes sources, and which source wins.
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | Paths (relative to projectRoot) to .env*, compose, and k8s manifest files to consider | |
| service | No | docker-compose service name to resolve for | |
| variable | Yes | The variable name, e.g. DATABASE_URL | |
| workload | No | Kubernetes workload (Deployment/Pod/etc.) name to resolve for | |
| container | No | Kubernetes container name within the workload | |
| environment | No | Target NODE_ENV-style value for dotenv resolution, e.g. "production" | |
| projectRoot | No | Directory the file paths are relative to |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral burden. It does disclose important behavior: resolution spans dotenv, docker-compose, and Kubernetes, and precedence is evaluated. However, it does not state side-effect freedom, error behavior, missing-file handling, or any operational prerequisites, leaving notable gaps for a tool with no annotation support.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
One concise, front-loaded sentence delivers the core function and the key differentiator (which source wins). There is no filler or redundant restatement of the tool name.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the moderate complexity of 7 parameters, full schema coverage, and no output schema, the description is largely sufficient: it states what the tool returns conceptually (evaluated value and winning source) and all parameters are otherwise documented. It could be stronger by noting how to handle missing variables or by connecting to sibling tools, but the essential selection and invocation context is present.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents every parameter. The description adds conceptual context by naming the source types, which loosely ties to files/service/workload/container, but it does not add parameter-level detail beyond what the schema provides, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description uses a specific verb ('resolves') and identifies the exact resource: what a config/env variable evaluates to across dotenv, docker-compose, and Kubernetes, including which source wins. This clearly differentiates it from siblings by focusing on multi-source resolution and precedence, not tracing, manifest inspection, impact, or diffing.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies a clear usage context: use when you need the actual evaluated value of a variable across multiple config-source types and the winning source. It does not explicitly name alternatives or state when not to use it, so it stops short of the strongest guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
trace_variableA
Lists every place a variable is defined or read across dotenv, compose, k8s, and code, and what wins in each discovered environment/service/workload context.
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| variable | Yes | ||
| projectRoot | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden, and it does a solid job: it reveals that the tool is a read/analysis operation that returns locations and precedence outcomes. It does not discuss edge cases or failure modes, but it clearly communicates the core observable behavior and that it is non-mutating.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The entire description is one dense, front-loaded sentence with no filler. Every clause contributes meaning: what is listed, where it is searched, and what result is produced.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The core purpose is clear, but the definition is incomplete for reliable invocation: there is no output schema, no annotations, no guidance on files/projectRoot semantics, and no differentiation from sibling tools. An agent would likely need to inspect the schema or guess to use it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must explain parameters. It clarifies that 'variable' is the trace target, but it gives no meaning for 'files' or 'projectRoot'—what files should contain, whether they are required, or how projectRoot changes discovery. This is a significant gap for a schema with no inline descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Lists'), names the resource (variable definitions/reads), and defines scope across dotenv, compose, k8s, and code. It also conveys a distinct deliverable ('what wins in each discovered environment/service/workload context'), which separates it from siblings like resolve_variable or diff_environments.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The usage context is implied rather than explicit: an agent can infer this is the tool to use when all definition/read locations and precedence are needed. However, it never states when not to use it or names alternative tools, leaving the agent to reason from sibling names.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Most tools are clearly separated by purpose: manifest summarizes, impact previews, diff compares, and trace enumerates. The only real overlap is between resolve_variable and trace_variable, since both explain precedence and 'what wins,' though one targets the final value and the other targets all definition/read locations.
resolve_variable and trace_variable follow a clean verb_noun pattern, but config_manifest and impact_preview are noun compounds, and diff_environments uses a terse verb. The names are readable and descriptive, but the naming convention is not uniform across the set.
Five tools is well-scoped for a read-only environment/config analysis server. Each tool covers a distinct analytical need without redundancy or bloat, and the count feels intentional rather than thin or excessive.
The set covers the full analysis workflow: resolving a single variable, tracing all usages, generating a project-wide manifest, predicting change impact, and diffing environments. No obvious missing operation is needed for the stated domain.
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 Connectors
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Find your AI agent's likely failure mode, get runtime settings, and clarify ambiguous prompts.
Secrets for developers and agents—secure context and workflows without exposing secret values.
Four IaC audits in one call: Compose, Dockerfile, GitHub Actions, Kubernetes. 131 checks.
Related MCP Servers
- AlicenseAqualityAmaintenanceVisual tech-stack inventory of any codebase: languages, frameworks, databases, AI SDKs, infra.2MIT
- AlicenseAqualityAmaintenanceChecks your local development environment for common issues like wrong Node version, missing Docker, missing git config, missing .env keys, and busy ports, and provides fixes.6171MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLM clients to inspect local dev environments—Docker container health, pnpm workspace integrity, and stuck process detection—without manual terminal copy-pasting.MIT
- AlicenseAqualityBmaintenanceProvides AI coding agents with structured, evidence-based diagnostics about the local development environment, detecting tech stack, runtime mismatches, dependency state, services, ports, and Git status without exposing secrets or using network calls.10Apache 2.0
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/Patrizzos/EnvSpeak'
If you have feedback or need assistance with the MCP directory API, please join our Discord server