Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,28 @@ describe('config', () => {
delete process.env.MCP_STRICT_ENV;
});


test('treats MCP_STRICT_ENV with surrounding-CRLF leading-space mixed-case true as strict mode', async () => {
process.env.MCP_STRICT_ENV = '\r\n True\r\n';

const configPath = join(tempDir, 'missing_env_leading_space_mixed_case_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;
Expand Down