.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 集成