env-guard-mcp
by monkestor888
README.md
# env-guard-mcp — Token, Secret & Config Defense for AI Agents
[](https://github.com/monkestor888/env-guard-mcp/actions/workflows/ci.yml)
[](https://www.python.org/)
[](https://github.com/modelcontextprotocol/python-sdk)
[](LICENSE)
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.
## 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+.
```bash
pip install git+https://github.com/monkestor888/env-guard-mcp
```
From a clone, for development:
```bash
pip install -e ".[dev]"
pytest
```
## Claude Code / Desktop Setup
**Claude Code** (available in all your projects):
```bash
claude mcp add -s user env-guard -- env-guard-mcp
```
**Claude Desktop** (`claude_desktop_config.json`):
```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](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues