MCP Issues with Cursor SDK

This is a known limitation with the local SDK. When you enable sandboxOptions, the SDK runs in headless mode with no interactive approval flow. The sandbox approval provider blocks all MCP tool calls that need approval, not just OAuth ones, and there’s currently no mechanism to pre-approve or trust specific MCP servers within a sandboxed local SDK run.

There’s also a separate gap: the local SDK can’t access OAuth tokens stored by the Cursor desktop app, even though the docs say it should reuse saved logins. The cloud SDK has a fix for this, but the local SDK doesn’t have an equivalent path yet. Our team is aware and tracking both issues.

For your use case (sandbox required for compliance), the recommended path is cloud SDK mode. Cloud agents run inside isolated VMs, which provides sandboxing at the infrastructure level without needing sandboxOptions. Cloud mode also supports OAuth MCP credentials from the backend:

const agent = await Agent.create({
apiKey: process.env.CURSOR_API_KEY,
model: { id: "composer-2.5-fast" },
cloud: {
envVars: { /* any env vars needed */ },
},
mcpServers: {
yourServer: {
type: "http",
url: "https://your-mcp-server.example.com/mcp",
headers: { Authorization: `Bearer ${process.env.YOUR_API_KEY}` },
},
},
});

If cloud mode isn’t viable for your setup, the only current local workaround is disabling sandboxOptions and using inline MCP configs with explicit headers — but I understand that doesn’t meet your compliance requirements.

You may also find this related thread helpful: SDK local agents cannot access HTTP MCPs with OAuth from settingSources

Let me know if the cloud SDK approach works for your team’s requirements.