Same issue here with the cursor-agent CLI, which is what third-party harnesses use (T3 Code starts one cursor-agent acp process per thread, in a fresh git worktree). Adding CLI-specific detail and a minimal repro, because the token side turns out to be simpler than the IDE side described above.
Root cause in the CLI (2026.10.01-e373342, macOS)
- The agent resolves the project root as the git top-level of the cwd. For a worktree, that’s the worktree path, not the main checkout.
- MCP OAuth tokens are read from and written to
~/.cursor/projects/<slug(project root)>/mcp-auth.json. There is no user-level fallback, and a login from the Cursor app isn’t used.
- So each worktree is a new project. On first connect, the agent writes only
clientInfo (dynamic client registration) and no tokens, and every OAuth server reports requires_authentication.
- The file is cached in memory per path for the life of the process and never re-read. Logging in from another terminal while an agent is running doesn’t reach it, and it needs a restart.
This matches what @nkoynov found for the SDK in topic 173938.
Minimal repro, no third-party tools
mkdir /tmp/repo && cd /tmp/repo && git init -q && git commit -q --allow-empty -m init
cursor-agent mcp login Atlassian-MCP-Server # any remote OAuth MCP server
cursor-agent mcp list # Atlassian-MCP-Server: ready
git worktree add -q /tmp/repo-wt -b wt
cd /tmp/repo-wt && cursor-agent mcp list # Atlassian-MCP-Server: requires_authentication
Afterwards, ~/.cursor/projects/private-tmp-repo-wt/mcp-auth.json contains only clientInfo for each server.
Tokens are portable
If ~/.cursor/projects/<worktree slug>/mcp-auth.json is a symlink to an authenticated file before the agent starts, every OAuth server is ready in the worktree immediately. Refreshes are written back through the symlink, since the store uses a plain writeFile. For the CLI at least, nothing ties the tokens to the original folder. The blocker is only where the agent looks for them.
I’m using that as a workaround: a wrapper around cursor-agent links each project’s mcp-auth.json to one shared file before exec. It relies on undocumented storage, though. It also races when several agents run at once: each process keeps its own in-memory snapshot and writes the whole file, so a rotated refresh token (Atlassian rotates them) can be overwritten by a stale one. The T3 Code maintainers closed the matching report as upstream for those reasons (pingdotgg/t3code#19552). They said they’d pass through a supported setting if Cursor adds one.
What would fix it, in order of preference:
- A user-level MCP token store keyed by server URL, shared by the CLI, SDK, and app, with a per-project override only when needed.
- Failing that, key the token file by the repository’s git common dir instead of the worktree top-level, so all worktrees of a repo share one login.
- At minimum, a supported setting or environment variable for the auth file path, such as
CURSOR_MCP_AUTH_FILE, so harnesses can point every session at one store.
- Re-read the auth file, or watch it, when a server is
needsAuth, so a login takes effect without restarting the agent.
With 1–3, the store should also lock and re-read the file before writing refreshed tokens, so concurrent agents don’t overwrite each other’s rotated refresh tokens.