
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 分
請在儲存庫或註冊中心條目中宣告授權條款。