Skip to main content
Glama

env-guard-mcp — Token, Secret & Config Defense for AI Agents

CI Python 3.10+ MCP SDK v2 License: MIT

Stop leaking API tokens, secrets, and broken .env configs into LLM contexts or Git repos. A lightweight, zero-leak Python MCP server for Claude Code and Claude Desktop.

Why env-guard-mcp

  • Secret values never reach the model. Tools return key names, file paths, line numbers and rule names, never the secret itself, so nothing sensitive lands in the LLM context.

  • Catches drift early. Spot keys missing from .env or .env.example before a teammate's build breaks.

  • Tiny and auditable. One file, one dependency (mcp), stdio transport.

Related MCP server: trestle

Built-in Defense Tools

Tool

What it does

diff_env(project_dir=".")

Compares keys in .env and .env.example. Returns missing_in_env, missing_in_example, env_key_count and example_key_count.

scan_secrets(project_dir=".")

Scans text files for AWS access keys, GitHub tokens, OpenAI and Anthropic keys, and generic API_KEY/SECRET assignments. Skips .git, .venv, node_modules, binary files and .env. Returns {file, line, rule} per finding.

generate_env_example(project_dir=".", overwrite=False)

Writes .env.example from .env with values removed, keeping comments, blank lines and key order. Refuses to overwrite unless overwrite=True.

Quick Start

Requires Python 3.10+.

pip install git+https://github.com/monkestor888/env-guard-mcp

From a clone, for development:

pip install -e ".[dev]"
pytest

Claude Code / Desktop Setup

Claude Code (available in all your projects):

claude mcp add -s user env-guard -- env-guard-mcp

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "env-guard": { "command": "env-guard-mcp" }
  }
}

If env-guard-mcp is not on your PATH, use its full path (inside your virtualenv's bin/ or Scripts\). Pass an absolute project_dir to the tools, since the server's working directory depends on the client.

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to write .env files with secrets stored locally, allowing search by name/description while keeping actual secret values private and never exposed to the AI.
      5
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to diagnose environment-variable issues read-only without exposing values, including .env versus template comparison, undocumented or unused variables across source code, shape validation, secret-exposure checks, git-ignore and history checks, and safe .env.example proposals.
      6
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to scan code, staged changes, repositories, and text snippets for hardcoded secrets, returning redacted findings without exposing matched secret values to the model.
      4
      MIT