
Env Contract Mcp
io.github.mrfentmen由 GitHub 账号 mrfentmen 发布v1.0.1更新于 Nov 5, 2026
Local value-free environment contract and configuration drift inspection. Tools include inspect...
概览
本地 MCP 服务器,对比项目中声明的环境变量名与源码及配置文件里的引用,找出配置漂移。
- 可以做什么
- 检查项目的环境变量契约:列出 .env.example 与 dotenv 文件中声明的名称、源码和配置文件中引用的名称,以及各自出现的文件。
- 找出被引用但未声明的缺失名称,以及已声明但从未被引用的未使用名称。
- 可将分析范围限定在某个工作区根目录,并跳过 node_modules、构建产物、覆盖率目录和 Git 内部文件。
- 适用场景
- 适合在项目因环境变量缺失或过期而在运行时出错之前排查,或在接手陌生仓库时快速了解哪些配置名称在哪些地方被使用。它只是启发式检查,不能替代真正的构建、部署检查或密钥扫描。
- 运行要求
- 以本地 stdio 进程运行,从 npm 包 env-contract-mcp 安装(需要 Node.js,通过 npm install 和 npm run build 构建)。可选设置 ENV_CONTRACT_ROOT 将分析限定在工作区根目录,默认取 MCP 包的上级目录。未声明任何认证或 API 密钥。
安装
在 SourceWeft 中
- 打开 控制台中的 Env Contract Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
env-contract-mcp
Env Contract is a local MCP tool for finding configuration drift before a project fails at runtime. It compares variable names declared in .env.example and dotenv files with likely environment references in source and config files.
Tool
inspect_contract: report declared names, referenced names, missing names, unused names, and the files where they occur.
Safety
- Reads local project files only; it never fetches URLs.
- Never reads or emits environment values. Only names and bounded file paths are returned.
- Ignores
node_modules, build output, coverage, and Git internals. - Caps file count, file size, recursion depth, and output.
- Matching is heuristic and is not a replacement for a build, deployment check, or secret scanner.
Set ENV_CONTRACT_ROOT to bound analysis to a workspace root. It defaults to the parent of the MCP package when launched normally.
Run
来源:README.md,提交 e50f0ed
工具
0版本历史
1- v1.0.1最新Sep 22, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。