Skip to main content
Glama

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.

Related MCP server: @mcpx-digital/env-check

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

npm install -g @patrizzos/envspeak

As an MCP server

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

As a 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"}'

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

npm test   # zero dependencies — no install step needed

License

MIT

Available Tools

5 tools
config_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.

Inputs: files (required), projectRoot, maxVariables.

diff_environmentsA

Resolves every variable under two different environment/service/workload selectors and reports what differs between them.

Inputs: files (required), environmentA (required), environmentB (required), variables, +1 more.

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.

Inputs: file (required), files (required), variable (required), newValue, +1 more.

resolve_variableA

Resolves what a config/env variable actually evaluates to across dotenv, docker-compose, and Kubernetes sources, and which source wins.

Inputs: files (required), variable (required), service, workload, +3 more.

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.

Inputs: files (required), variable (required), projectRoot.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation4/5

    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.

    Naming Consistency3/5

    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.

    Tool Count5/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Provides 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.
      10
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Compares a project's .env file against its .env.example template to surface missing, extra, and empty keys, flag empty required variables, and produce paste-safe key inventories for tickets or sharing. Runs entirely on local files with every value redacted, so secrets are never echoed or uploaded.
      3
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Checks which .env, .git, keys and source maps Cloudflare Pages, Vercel, Netlify or Firebase would publish, before and after deploy. CLI, live probe, Claude Code hook, MCP server and GitHub Action.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables scanning a repository's source files for actual environment variable reads and diffing those names against .env.example or .env.sample. Returns a deterministic JSON report with the sync verdict, counts, and findings for used-but-undocumented, documented-but-unused, and missing-example vars, without ever reading values.
      53 npm
      MIT