Skip to content

Commit a286143

Browse files
authored
fix: prevent dotenv from outputting to STDIO in MCP mode (#82)
- Add { quiet: true } to dotenv.config() call - Prevents dotenv log messages from interfering with MCP JSON-RPC communication - Fixes "Unexpected token" JSON parsing errors in Claude Desktop - No functional changes to environment variable loading behavior Resolves STDIO pollution that breaks MCP protocol in STDIO transport mode.
1 parent 23de122 commit a286143

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/config.util.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ class ConfigLoader {
5858
);
5959

6060
try {
61-
const result = dotenv.config();
61+
// Use quiet mode to prevent dotenv from outputting to STDIO
62+
// which interferes with MCP's JSON-RPC communication
63+
const result = dotenv.config({ quiet: true });
6264
if (result.error) {
6365
envLogger.debug('No .env file found or error reading it');
6466
return;

0 commit comments

Comments
 (0)