Agents Window (beta): MCP `envFile` is ignored for stdio servers (works in the IDE)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

In the Agents Window (Beta), a stdio MCP server’s envFile setting from .cursor/mcp.json is not loaded. The server starts without those variables. The same config works in the regular IDE window with Open Folder.

Config

{
  "mcpServers": {
    "geekbot-mcp": {
      "command": "uv",
      "args": ["tool", "run", "geekbot-mcp"],
      "envFile": "${userHome}/.cursor/secrets/geekbot.env"
    }
  }
}

The env file contains GB_API_KEY=....

Actual
The server exits at startup with ValueError: GB_API_KEY is not set, then MCP error -32000: Connection closed. An absolute envFile path gives the same result. Reloading the MCP server does not help.

Expected
envFile is loaded into the server’s environment, as in the IDE.

Likely cause (from the bundled code)
In Cursor.app/Contents/Resources/app/extensions/cursor-agent-host/dist/agent-host-daemon/dist/bin/daemon.cjs, loadCommandBasedServerWithElicitation builds the child environment with const env2 = commandBasedServer.env ?? {} and passes only that to StdioClientTransport. envFile appears in that file only in config schemas and key maps. Nothing reads it.

Workaround
A wrapper script that sources the env file and then runs exec uv tool run geekbot-mcp, used as the MCP command.

Steps to Reproduce

  1. Add the stdio server above, with envFile pointing to a file that defines a required variable.
  2. Open the folder in the Agents Window (Beta).
  3. The server fails because the variable is missing.

Expected Behavior

envFile is loaded into the server’s environment, as in the IDE.

Operating System

MacOS

Version Information

Version: 3.32.10
VS Code Extension API: 1.147.0
Commit: 0d3b96e46ce65af82ed74bc6f14883b33e1a0590
Date: 2026-11-26T05:52:13.242Z
Layout: Agent Window (Molten)
Build Type: Stable
Release Track: Default
Electron: 43.8.9
Chromium: 150.0.7871.250
Node.js: 24.22.1
V8: 15.0.245.31-electron.0
xterm.js: 6.1.0-beta.291
OS: Darwin arm64 25.5.0

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hi @Aliaksei_Tuzik, your reading of it is right. The beta Agents Window currently passes only the env block to a stdio server and never loads envFile, which is why the same entry works in the editor window and fails there. This is a known issue the team is aware of, and I’ve added your report to it.

Your wrapper script is the right workaround for now. If you’d rather not keep it, values in an env block do reach the server, so the key can go in an env block for this server in ~/.cursor/mcp.json, outside the repo. The other option is Cursor Settings → Beta → Agents Window Type → Default, which restarts Cursor into the standard Agents Window, and that one should load envFile the way the editor does.