You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Cursor provider fails to start project MCP servers using ${workspaceFolder} and unresolved environment variables #22199
Checked current main 8acbefefc5. No matching open issue or PR found.
On Linux x64, created the reported server.mjs and .cursor/mcp.json fixture and attempted MCP discovery with bundled Cursor SDK 1.0.35, project settings enabled, and full access. The SDK reports logged-out; the turn fails with Invalid User API Key. The isolated dev server started and browser pairing succeeded, but the web client remained on its splash screen.
The reported placeholder failure remains unverified. An authenticated Cursor environment is needed to continue; Windows desktop was not tested. No implementation changes made.
On Windows 11, a Composer 2.5 thread in such a project fails tool discovery for the server. Calling its tool returns MCP server does not exist: example. Available servers: t3-code, the same error as before the fix.
Why: the merged rule resolves a server only in these cases:
${workspaceFolder} is in command or cwd, or
command is node, bun, tsx, python or python3, and args[0] starts with ${workspaceFolder}/.
A wrapped command like proto run node -- ${workspaceFolder}/… matches neither, so it stays with the SDK, which starts it with the placeholder literal. 80f1a6c removed exactly this case ("wrapped") from the test's expected overrides. The same applies to other launchers, such as pnpm exec tsx … or uv run python ….
Suggested fix: narrowing the rule avoids the duplicate-process leak (8fdb3b6). That leak comes from the SDK itself: with two clients of the same name, qA.load keeps the first and drops the other without closing it:
// @cursor/sdk 1.2.0, dist/cjs/336.js, class qA, load()constn=r+e;nins||(s[n]=t)}}returnnewWk(s)
T3 already ships patches/@cursor__sdk@1.2.0.patch, which touches 336.js. Closing the dropped client there removes the leak at its source:
-const n=r+e;n in s||(s[n]=t)}}return new Wk(s)+const n=r+e;n in s?Promise.resolve(t.close?.()).catch(()=>{}):(s[n]=t)}}return new Wk(s)
I tested that on 1ebaebb, which used the wider rule, with a built server and a signed-in Cursor thread over several turns. Without the patch, the SDK's literal copy of an env-only server survived every turn: 3 turns left 3 orphaned processes. With the patch, the literal copy exited about 70 ms after starting, and the agent still called the resolved copy, with the workspace as cwd and the resolved env. The only processes left were the two create-time file servers that main also keeps. The ESM build is minified differently and would need its own hunk; the server loads the CJS build through createRequire.
With dropped clients closed, a duplicate costs only a brief extra start. T3 could then resolve any stdio server that uses an editor variable, wrapped launchers included, instead of guessing which literal copies can't start.
Activity
juliusmarminge commentedon Oct 22, 2026
Checked current main 8acbefefc5. No matching open issue or PR found.
On Linux x64, created the reported
server.mjsand.cursor/mcp.jsonfixture and attempted MCP discovery with bundled Cursor SDK 1.0.35, project settings enabled, and full access. The SDK reportslogged-out; the turn fails withInvalid User API Key. The isolated dev server started and browser pairing succeeded, but the web client remained on its splash screen.The reported placeholder failure remains unverified. An authenticated Cursor environment is needed to continue; Windows desktop was not tested. No implementation changes made.
Runtime transcript
JeremyMoeglich commentedon Nov 13, 2026
Note
Written by
claude-opus-5-5on my behalf.This still fails on Nightly
0.1.10-nightly.20261113.4616, which includes #24505 (cc97303). Could this be reopened?A wrapped launcher like the one in the report:
On Windows 11, a Composer 2.5 thread in such a project fails tool discovery for the server. Calling its tool returns
MCP server does not exist: example. Available servers: t3-code, the same error as before the fix.Why: the merged rule resolves a server only in these cases:
${workspaceFolder}is incommandorcwd, orcommandisnode,bun,tsx,pythonorpython3, andargs[0]starts with${workspaceFolder}/.A wrapped command like
proto run node -- ${workspaceFolder}/…matches neither, so it stays with the SDK, which starts it with the placeholder literal.80f1a6cremoved exactly this case ("wrapped") from the test's expected overrides. The same applies to other launchers, such aspnpm exec tsx …oruv run python ….Suggested fix: narrowing the rule avoids the duplicate-process leak (
8fdb3b6). That leak comes from the SDK itself: with two clients of the same name,qA.loadkeeps the first and drops the other without closing it:T3 already ships
patches/@cursor__sdk@1.2.0.patch, which touches336.js. Closing the dropped client there removes the leak at its source:I tested that on
1ebaebb, which used the wider rule, with a built server and a signed-in Cursor thread over several turns. Without the patch, the SDK's literal copy of an env-only server survived every turn: 3 turns left 3 orphaned processes. With the patch, the literal copy exited about 70 ms after starting, and the agent still called the resolved copy, with the workspace as cwd and the resolved env. The only processes left were the two create-time file servers that main also keeps. The ESM build is minified differently and would need its own hunk; the server loads the CJS build throughcreateRequire.With dropped clients closed, a duplicate costs only a brief extra start. T3 could then resolve any stdio server that uses an editor variable, wrapped launchers included, instead of guessing which literal copies can't start.
JeremyMoeglich commentedon Nov 13, 2026
I should note that this is much less severe as I can work around it for now by using cwd, so this is only an annoyance at this point.