Describe the Bug
Similar to this report it seems that environmental variables created by direnv are not part of the cursor-agent environment.
This is very problematic for me because I need to use a specific GitHub personal access token with one project. We check in .cursor/mcp.json to our Git repository, and have this config:
{
"mcpServers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/",
"headers": {
"Authorization": "Bearer ${env:GITHUB_PERSONAL_ACCESS_TOKEN}"
}
}
}
Since cursor is not correctly inheriting the PAT from .envrc, I cannot access GitHub MCP.
Steps to Reproduce
Set up direnv, create an .envrc with this content:
export DIRENV_ENABLED_FOR_CURSOR="yes"
Then start cusor-agent and run ! echo $DIRENV_ENABLED_FOR_CURSOR and there will be no output.
Expected Behavior
The cursor agent should inherit the shell environment.
Operating System
MacOS
Version Information
About Cursor CLI
CLI Version 2026.02.27-e7d2ef6
Model Claude 4.6 Sonnet
OS darwin (arm64)
Terminal wezterm
Shell zsh
Does this stop you from using Cursor
Sometimes - I can sometimes use Cursor