diff --git a/tests/config.test.ts b/tests/config.test.ts index a48602c..d12f591 100644 --- a/tests/config.test.ts +++ b/tests/config.test.ts @@ -108,6 +108,28 @@ describe('config', () => { delete process.env.MCP_STRICT_ENV; }); + + test('treats MCP_STRICT_ENV with surrounding-CRLF tab-padded true as strict mode', async () => { + process.env.MCP_STRICT_ENV = '\r\n\ttrue\t\r\n'; + + const configPath = join(tempDir, 'missing_env_tab_padded_true_surrounded_crlf.json'); + await writeFile( + configPath, + JSON.stringify({ + mcpServers: { + test: { + command: 'echo', + env: { TOKEN: '${NONEXISTENT_VAR}' }, + }, + }, + }) + ); + + await expect(loadConfig(configPath)).rejects.toThrow('Missing environment variable'); + + delete process.env.MCP_STRICT_ENV; + }); + test('throws error on missing env vars in strict mode (default)', async () => { // Ensure strict mode is enabled (default) delete process.env.MCP_STRICT_ENV;