envdoc
OfficialReads and repairs .env files: detects missing, unused, and misspelled environment variables, suggests typo fixes, applies renames and appends missing keys, and generates or syncs .env.example while preserving existing values.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
π± envdoc
Find missing, unused and misspelled environment variables β before they break your app.
A CLI for you, an MCP server for your AI agent.
Zero dependencies. Installs in one second. Works in your terminal and in your AI agent.
The problem
Your app reads os.environ["DATABASE_URL"]. Your .env has DATA_BASE_URL. Everything works on your machine β until it doesn't, on your teammate's machine, in staging, at 2 AM.
Environment variable mistakes are one of the most common β and most annoying β bugs in modern development. They're invisible until runtime, they break CI, and nobody remembers which variables are actually required.
envdoc scans your code, reads your .env, and tells you exactly what's wrong:
$ envdoc
envdoc v0.1.0
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
project C:\work\my-api
env file .env (3 keys)
scanned 3 files Β· 6 vars referenced
β MISSING (5)
API_KEY app/main.py:4
β³ typo? .env has API_KEYS
DEBUG app/main.py:6
β³ has default in code
PORT app/client.js:2
REDIS_URL app/client.js:1
SECRET_KEY app/main.py:5
β² UNUSED (2)
API_KEYS .env:3
β³ typo? code uses API_KEY
LEGACY_MODE .env:4
β 4 blocking issue(s) - the app will crash at runtime
+ 1 missing var(s) with defaults
exit code: 1 Β· run `envdoc example` to sync .env.exampleIt caught the API_KEY / API_KEYS typo both ways β in the code and in the .env.
Related MCP server: envdoc
β¨ Features
Feature | What it does |
π€ MCP server |
|
π οΈ Auto-fix |
|
π΄ Missing detection | Variables read by code but absent from |
π‘ Unused detection | Dead entries cluttering your |
π΅ Typo suggestion | Fuzzy matching links |
βͺ Default-aware |
|
π§ Code-provided vars | Understands |
π |
|
πͺ Exit codes |
|
π¦ JSON output |
|
Zero dependencies β pure standard library. pip install is instant, and
envdoc mcp starts with no extra install step.
π Install
pip install envdocOr from source:
git clone https://github.com/tarkeebdev/envdoc.git
cd envdoc && pip install .Requires Python 3.9+. No other dependencies.
π Usage
envdoc # check the current directory (default command)
envdoc check path/to/proj # check somewhere else
envdoc fix # preview repairs (dry run)
envdoc fix --apply # repair .env in place
envdoc example # generate / sync .env.example
envdoc mcp # run the MCP server on stdio
envdoc list --missing # just the names, one per line (pipeable)
envdoc --json # machine-readable outputOptions
Flag | Available on | Meaning |
|
| Emit a JSON report |
|
| Also fail on unused variables |
|
| Disable ANSI colours (also honours |
| all | Pick the env file explicitly (repeatable) |
| all | Silence a variable (repeatable) |
| all | Skip paths (repeatable) |
|
| Write changes (default is a dry run) |
|
| Also drop |
|
| Output path (default |
|
| Overwrite instead of merging |
|
| Copy real values β οΈ may include secrets |
Exit codes
Code | Meaning |
| No blocking issues |
| Blocking issues found ( |
| Usage error / path not found |
π€ MCP server for AI agents
This is the headline feature. Environment-variable mistakes are the #1 way an
AI coding agent gets stuck: it runs the app, hits KeyError: 'DATABASE_URL',
guesses, retries, burns tokens, and gives up.
envdoc mcp gives the agent a ground-truth answer instead of guesswork.
ββββββββββββββββββββββββββββ
β Claude / Cursor / agent β ββ 1. "what's missing in this project?"
ββββββββββββββ¬ββββββββββββββ
βΌ
ββββββββββββββββββββββββββββ
β envdoc mcp (stdio) β ββ 2. JSON: missing[], unused[], typo links
β β’ env_check β ββ 3. unified diff (dry run)
β β’ env_fix β ββ 4. apply β .env repaired
β β’ env_example β
ββββββββββββββββββββββββββββConnect it
Claude Code
claude mcp add envdoc -- envdoc mcpClaude Desktop / any MCP client β add to your MCP config:
{
"mcpServers": {
"envdoc": { "command": "envdoc", "args": ["mcp"] }
}
}Tools it exposes
Tool | What it returns | When the agent should call it |
| JSON: | Before running, building or deploying β and first when debugging a |
| Plan + unified diff. | Once |
|
| Scaffolding, onboarding, PRs |
Try it right now
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"env_check","arguments":{}}}' \
| envdoc mcpDesign notes (why it's safe for agents)
Dry run by default β
env_fixreturns a diff and touches nothing until you passapply: true.Renames before adds β a typo repair frees the key it needs; order is deterministic.
Never deletes on a guess β
include_unusedis opt-in, and keys that look like typos are never auto-removed.Values preserved β renames keep the existing value and comments intact.
Zero dependencies β plain stdio JSON-RPC, so
envdoc mcpstarts anywhere Python does.
π οΈ Fix mode
envdoc fix # preview (dry run)
envdoc fix --apply # write the changes$ envdoc fix
would fix .env:
! rename API_KEYS -> API_KEY (code reads API_KEY; .env has API_KEYS)
add DEBUG=0 (read by the code but not configured)
! add REDIS_URL= (read by the code but not configured)
--- a/.env
+++ b/.env
@@ -1,4 +1,8 @@
-API_KEYS=oops-wrong-name
+API_KEY=oops-wrong-name
+DEBUG=0
+REDIS_URL=Notice DEBUG=0 β the default came from the source itself
(os.getenv("DEBUG", "0")). envdoc doesn't just find the gap, it fills it
with the value your code already agreed to fall back on.
π What it understands
envdoc reads environment variables across 12+ language families:
Language | Syntax detected |
Python |
|
JavaScript / TypeScript |
|
Deno |
|
Go |
|
Ruby |
|
PHP |
|
Java |
|
Rust |
|
Vite / webpack |
|
Shell / Docker / YAML |
|
It also:
walks the tree respecting your
.gitignoreskips
node_modules/,.venv/,dist/, binaries and assetsignores OS noise (
PATH,HOME,LANG,SSH_*, β¦) so you only see your config
π€« Silencing a variable
Add a comment to any entry in your .env:
# Used by the ops team's cron job only β envdoc:ignore
CRON_TOKEN=abc123β¦or pass --ignore CRON_TOKEN.
π§ͺ Tests
pip install -e ".[dev]"
pytest67 passed in 0.91sCovers pattern extraction across all supported languages, .env parsing,
fix planning (renames, adds, order, dry-run vs apply), the full MCP handshake,
tool dispatch, and CLI exit codes.
π Drop it into CI
GitHub Actions
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install envdoc
- run: envdoc --strictGit hook (pre-commit)
# .pre-commit-config.yaml
- repo: local
hooks:
- id: envdoc
name: envdoc
entry: envdoc --strict
language: system
pass_filenames: falseπΊοΈ Roadmap
fixmode β auto-correct detected typos, append missing keysMCP server β
env_check/env_fix/env_examplefor AI agentsGitHub Action that comments the
env_checkdiff on PRsSupport for
.env.templateinheritance / variable interpolationSecret-scanning warnings for committed real values
npx-style one-liner so non-Python agents can spawn itEditor integrations (VS Code diagnostics)
Contributions welcome β open an issue and let's talk.
π License
MIT Β© tarkeebdev
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
A vault for .env files and project credentials: one encryption key per project, a second factor before protected values open, an audit row for every reveal, and scoped MCP access for coding agents.
Risk-scan a diff, flag AI-generated-code tells, find secrets. 5 of 7 tools need no account.
Scores your code across 12 areas, with findings, fix prompts, and re-assessment in your AI agent
Related MCP Servers
- AlicenseAqualityCmaintenanceCompares 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.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables 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.54 npmMIT
- AlicenseAqualityBmaintenanceEnables 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.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to validate .env files against .env.example, detecting missing keys, type mismatches, placeholders, and undocumented entries while reporting only key names, line numbers, and issue codes so secret values never enter LLM context.1MIT