.env checker: dotenv, Node, Vite, Next.js

io.github.Lawatch由 GitHub 帳號 Lawatch 發布v1.0.0更新於 Nov 17, 2026

Real value of each .env variable and the file:line that decides, for dotenv, node, Vite, Next.js

發布方自己的服務:check.tattoo: tattoo size and placement guide

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

說明每個 .env 變數最後取得的值,以及決定它的檔案與行號,涵蓋 dotenv、node --env-file、Vite 與 Next.js。

可以做什麼
  • 依指定載入器與模式解析多個 .env 檔案,給出每個變數的最終值、決定它的 file:line、失效的定義及原因
  • 以真實的 dotenv 或 Node 解析器解析單一 .env 檔案,顯示被忽略的行、在 # 處截斷的值、未閉合的引號、多行值與重複鍵
  • 比較 dotenv 與 Node 解析器對同一批變數的讀取差異
  • 列出發現的陷阱,以及該模式下載入器根本不會讀取的檔案
適用情境
當某個環境變數是空的、值不對或顯示 undefined,需要釐清是哪個檔案哪一行生效時;或在專案從 dotenv 改用 node --env-file、Vite、Next.js 載入器之前使用。
執行需求
以 stdio 在本機執行:Claude Desktop 安裝包、Docker 映像,或以 Node 18+ 從原始碼執行。未宣告帳號、金鑰或環境變數。可離線運作,.env 檔案內容由你自行提供。
安裝前請注意
需要把 .env 檔案內容傳給工具,其中的真實密鑰會交給助理與模型供應商。據稱唯讀、離線且不存取檔案。不涵蓋 .env.vault/dotenvx 加密、Docker Compose 的 .env 規則,也不讀取 Vite 的 envDir 與 define 設定。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 .env checker: dotenv, Node, Vite, Next.js,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

dotenv-check — MCP server

Why is my environment variable empty, wrong or undefined? The exact value each .env variable gets, and the file and line that decide it, with the four loaders developers use: npm dotenv (+ dotenv-expand), node --env-file, Vite and Next.js. Offline.

One-click install for Claude Desktop, VS Code and Cursor: https://lawatch.github.io/10aday/mcp/dotenv-check/
Question, wrong answer or missing case? Open an issue — we read them.

AI assistants answer .env questions from memory, and the loaders disagree with each other:

  • PASSWORD=abc#123 gives abc: an unquoted # starts a comment, even with no space before it.
  • API_URL= (a trailing space) followed by a new line: Node and Vite 8 take the next line as the value, and that variable disappears.
  • Which file wins? dotenv and Next.js: the first file that defines it. Node and Vite: the last. The shell environment wins over all files.
  • $VAR is expanded by dotenv-expand, Vite and Next.js, even inside single quotes, but never by Node or plain dotenv.
  • Vite only exposes VITE_* to client code, Next.js only NEXT_PUBLIC_*, and .env.local is skipped by Next.js when NODE_ENV=test.
  • A=$A$A makes Vite and dotenv-expand loop until the process runs out of memory.

Tools

ToolWhat it does
resolve_envGive the .env files and the loader (dotenv, node, vite, nextjs) with the mode. For each variable: final value, the file:line that decides, the definitions that lose and why, the text before $VAR expansion, whether it reaches browser code. Plus every trap found and the files the loader never reads in this mode.
parse_env_fileOne file, parsed with the real dotenv or Node parser: each value with its line, lines silently ignored, values cut at #, unclosed quotes, multi-line values, duplicate keys.
compare_env_parsersThe variables that read differently with dotenv and with Node's parser (node --env-file, Vite 8). Run it before switching.

Example

json
{ "name": "resolve_env", "arguments": { "loader": "vite", "mode": "production", "files": {  ".env": "VITE_API_URL=http://localhost:3000\nDB_PASSWORD=abc#123\n",  ".env.production": "VITE_API_URL= \nVITE_TITLE=My app\n" } } }

Result: VITE_API_URL = "VITE_TITLE=My app" (from .env.production:1, the .env:1 value loses), VITE_TITLE does not exist, DB_PASSWORD is cut to abc and is not in import.meta.env anyway (no VITE_ prefix).

How exact is it?

The real code runs inside: npm dotenv 17.4.2 and dotenv-expand 12.0.3 (unchanged), the copy of dotenv-expand bundled in Vite 8.3.8 (unchanged), @next/env 16.4.6 (unchanged, run with the files in memory), and a line-by-line port of Node's C++ parser (src/node_dotenv.cc, identical in Node 22 to 25). The only addition: a guard that stops a value growing without end, where the real loader would crash. test.js compares the server with util.parseEnv, node --env-file, Vite's loadEnv, Next's loadEnvConfig and dotenv + dotenv-expand on thousands of random files (quotes, #, $VAR, ${VAR:-default}, multi-line values, CRLF, export, several files, mode, shell variables): 0 differences.

Limits: .env.vault / dotenvx encryption and Docker Compose .env rules are not covered. Vite's envDir and define are not read: give the files Vite would see.

Install

  • Claude Desktop: open dotenv-check-1.0.0.mcpb from the GitHub release.
  • Any MCP client (Docker): {"command": "docker", "args": ["run", "-i", "--rm", "ghcr.io/lawatch/dotenv-check:1.0.0"]}
  • From source (Node 18+, no install): {"command": "node", "args": ["/path/to/server.js"]}

Offline, read-only, no file access: you pass the file contents, nothing is sent anywhere.

Licenses

Server code: MIT. Bundled unchanged: dotenv and dotenv-expand (BSD-2-Clause, Scott Motte and contributors), @next/env (MIT, Vercel). License texts in vendor/.

Built by AI agents (project 10aday).

來源:products/mcp/dotenv-check/README.md,提交 6e1ca13

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Nov 17, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。

其他 Check 整合