Skip to main content
Glama

envguard-mcp — 3-Runtime .env Parser, Client-Bundle Secret Leak & 4-Way Drift MCP Server + GitHub Action

z121245017-ai/envguard-mcp MCP server

Zero-dependency, 100% offline Model Context Protocol (MCP) Server, CLI, and GitHub Action enabling AI coding agents (Claude Desktop, Claude Code, Cursor, Windsurf, Antigravity) and pull-request CI pipelines to catch:

  1. 3-Runtime .env Parser Divergences across Node dotenv v16, docker run --env-file, and POSIX sh / docker compose (inline # password truncation, literal "..." quotes in Docker, $2b$12$ bcrypt corruption, export rejections, and Windows CRLF \r trailing bytes).

  2. Frontend Bundle Secret Leaks where private keys, database URIs, live API secrets, or Supabase service_role JWTs are accidentally exposed under NEXT_PUBLIC_, VITE_, NUXT_PUBLIC_, REACT_APP_, EXPO_PUBLIC_, or PUBLIC_.

  3. 4-Way Configuration Drift across .env, .env.example, docker-compose.yml, and polyglot source code (process.env, import.meta.env, Deno.env, Bun.env, os.environ, os.Getenv, std::env::var).

Zero-Secret-Leak Guarantee: Every MCP tool and CI report strictly redacts raw values into <redacted len:N bytes:B fnv1a:HHHHHHHH> fingerprints so production secrets never enter LLM context windows or CI logs.

MCP Tools Exposed (stdio)

Tool

Purpose

Safety Annotations

compare_env_runtime_parsers

Compares exact parsed byte lengths and FNV-1a hashes across Node dotenv v16, docker run --env-file, and POSIX sh / docker compose without exposing raw secret plaintext.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

detect_client_bundle_secret_leaks

Audits .env* files and source code for private keys, service_role JWTs, or DB credentials accidentally prefixed with NEXT_PUBLIC_, VITE_, NUXT_PUBLIC_, REACT_APP_, or EXPO_PUBLIC_.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

audit_env_compose_code_drift

Computes 4-way cross-drift across .env, .env.example, docker-compose.yml, and source code references, returning redacted findings and a 0–100 deployment safety score.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

generate_sanitized_env_example

Produces a zero-secret .env.example (automatically renaming leaked client-prefix server keys) and an escaped fail-fast docker-compose.yml snippet.

readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false

Related MCP server: mendapi

Quick Start (MCP Client & Local CLI)

# Start MCP server over stdio (supports both NDJSON and Content-Length framing)
npx -y github:z121245017-ai/envguard-mcp

# List MCP tool schemas
npx -y github:z121245017-ai/envguard-mcp --list

# Compare 3-runtime .env parser behavior from terminal (raw secrets redacted)
npx -y github:z121245017-ai/envguard-mcp --cli compare_env_runtime_parsers '{"envText":"DB_PASS=p@ss#word123\nREDIS_PASS=\"secret\""}'

Claude Desktop / Cursor / Windsurf / Antigravity Config

{
  "mcpServers": {
    "envguard": {
      "command": "npx",
      "args": ["-y", "github:z121245017-ai/envguard-mcp"]
    }
  }
}

Docker (node:22-alpine, non-root USER node)

docker build -t envguard-mcp .
docker run -i --rm envguard-mcp

GitHub Action (z121245017-ai/envguard-mcp@v1)

Add envguard-mcp@v1 to .github/workflows/ to block pull requests that introduce NEXT_PUBLIC_ / VITE_ secret leaks or forget to document new process.env / import.meta.env keys in .env.example:

name: EnvGuard Secret Leak & Drift Check

on:
  pull_request:

permissions:
  contents: read

jobs:
  envguard:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Audit client-bundle secret leaks and .env.example drift
        uses: z121245017-ai/envguard-mcp@v1
        with:
          env-example: '.env.example'
          code-paths: 'src,app'
          fail-on-client-leaks: 'true'
          fail-on-example-drift: 'true'

Action Inputs & Outputs

Name

Kind

Default

Description

workspace

Input

.

Workspace directory to scan.

env-file

Input

""

Optional .env or template file checked for 3-runtime parser divergence and client-bundle leaks.

env-example

Input

.env.example

Path to .env.example used for undocumented variable drift checks.

compose-file

Input

""

Optional path to docker-compose.yml / compose.yaml (auto-detected when omitted).

code-paths

Input

.

Comma-separated source directories or files scanned for environment variable references.

fail-on-client-leaks

Input

true

Exit 1 when server secrets or service_role JWTs are exposed under NEXT_PUBLIC_ / VITE_ / etc.

fail-on-example-drift

Input

true

Exit 1 when variables referenced in source code or Compose are missing from .env.example.

fail-on-parser-divergence

Input

true

Exit 1 when an inspected .env file diverges across dotenv, docker --env-file, and POSIX sh.

verdict

Output

—

PASSED or BLOCKED.

safety-score

Output

—

Deterministic safety score (0–100).

client-leaks-found

Output

—

Count of client-bundle secret exposure findings.

example-drift-found

Output

—

Count of undocumented variables missing from .env.example.

parser-divergences-found

Output

—

Count of 3-runtime .env parser divergences.

report-json

Output

—

Redacted JSON summary (raw secret values are never included).

Verification

npm test

License

MIT License — 0 external npm dependencies, 0 network calls, 100% local execution.

Available Tools

4 tools
audit_env_compose_code_driftB
Read-onlyIdempotent

Computes deterministic 4-way configuration cross-drift across .env, .env.example, docker-compose.yml, and polyglot source code references (process.env, import.meta.env, os.environ), returning redacted findings and a 0-100 deployment safety score.

Inputs: envText, codeText, codePaths, targetEnv, +6 more.

compare_env_runtime_parsersA
Read-onlyIdempotent

Compares exact parsed byte lengths and FNV-1a hashes across Node dotenv v16, docker run --env-file, and POSIX sh / docker compose, catching inline # truncation, literal quotes, $ bcrypt corruption, and CRLF \r bugs while strictly redacting raw secret values.

Inputs: envText, envFilePath.

detect_client_bundle_secret_leaksA
Read-onlyIdempotent

Audits .env files and frontend source configs for private keys, Supabase service_role JWTs, API secrets, or database URIs accidentally prefixed with NEXT_PUBLIC_, VITE_, NUXT_PUBLIC_, REACT_APP_, EXPO_PUBLIC_, or PUBLIC_, redacting all secret values.

Inputs: envText, codeText, codePaths, envFilePath.

generate_sanitized_env_exampleA
Read-onlyIdempotent

Generates a zero-secret .env.example template (automatically renaming leaked NEXT_PUBLIC_/VITE_ server secrets) and an escaped fail-fast docker-compose.yml snippet from local config structure without leaking any secret values.

Inputs: envText, codeText, composeText, envFilePath, +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 4 tools

    Disambiguation4/5

    Each tool targets a distinct env-security workflow: parser comparison, leak detection, config drift auditing, and sanitized template generation. The first and third tools both analyze env/compose configuration, so an agent may need to read descriptions carefully to choose between them, but their outputs and purposes differ.

    Naming Consistency4/5

    All four names use snake_case and are verb-led or action-oriented, with clear domain-specific nouns. The pattern is consistent, though names are unusually long and the first tool is slightly more noun-heavy than the others.

    Tool Count5/5

    Four tools is a tight, well-scoped set for an env-security auditing server. Each tool maps to a distinct step in the workflow, with no filler or redundant tools.

    Completeness4/5

    The surface covers comparison, leak detection, drift auditing, and safe example generation, which form a coherent lifecycle. It lacks a direct remediation or fix-application tool, but generation of sanitized examples partially fills that gap.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A deterministic MCP server that guards AI/agent output by detecting secrets, injection, and PII in ~85µs with zero dependencies. Gives a clear ship/block verdict and runs locally or hosted.
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server that watches upstream API providers for breaking changes, scans your codebase for impact, and drafts migration fixes locally, all offline-first with zero network.
      97 npm
      1
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      A tiny local MCP server and CLI that lets AI agents read only allowlisted environment variables, redacts known secrets from text, and logs every access.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      100% local-first, zero-dependency 5-pillar Git repository auditor & Client Codebase Audit / Project Handover PDF report generator MCP server. Scans secrets, lockfiles, CI/tests, Git bus-factor & handover docs locally.
      4
      MIT