.env not accessible via @Files

It seems that .env files cannot be added to model context via the ‘@’ symbol. That is very reasonable behavior.

However, I do not see a way to change this. We have a .env file that contains non-sensitive staging information (mostly various AWS ARNs). We would like to add these values to prompts that use AWS MCP tools, and including the .env as content would make this easier.

Is it possible to override this behavior for specific .env files?

I realize we could just change the filename, but that would be slightly more work.

Please check documentation fabout Global Ignore Files. You can adjust the behavior there, though staging could also be used as .env.staging if your system allows.

Note that MCP integration does not use .env secrets.

create a .cursorignore file and write !.env in that file. This will tell cursor not to ignore .env file. By default it ignore all files that are in .gitignore

2 Likes

Before that, you also need to remove it from the Global Cursor ignore list.

1 Like