Learning resourcesReviewed · Anysphere

Connect a private MCP server with OAuth

This Cursor documentation guide helps agent developers connect private MCP servers with OAuth, but local authorization does not transfer to Cursor-hosted agents. It explains browser authorization, interactive connection prompts, restricted tool wrappers and credential-location choices.

Researched 14 Nov 2026

In short.

This Cursor guide teaches developers to give agents access to private MCP tools, but host OAuth does not give each caller a separate downstream identity. It provides local configuration and authorization steps, explains which interactions can wait for a browser connection, and shows a wrapper that limits tool exposure. To use an OAuth server from a Cursor-hosted agent, the page directs adding the server under MCP in the Cursor dashboard and reaching it through a cursorAccount connection, because tokens from mcp oauth stay on the machine that authorized them. SDK versions, pricing and detailed token protections are not established, and nothing was executed.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete page at [https://cursor.com/docs/agent-sdk/guides/mcp-oauth.md]: local configuration, first-use authorization, wrapper examples, hosted-agent instructions, the credential-location table and Related/Sitemap notices. Contents of linked pages, the dashboard, the referenced bdk-mcp-auth skill and the sitemap are excluded. No additional library files or explicit license notices were supplied. Nothing was executed; runtime behavior, security properties, compatibility and current service availability remain unverified.

The overview

Identity

Connect a private MCP server with OAuth is a focused documentation guide at [https://cursor.com/docs/agent-sdk/guides/mcp-oauth.md]. It covers authorization for remote MCP servers used by agents, including local operation and Cursor-hosted deployment.

The resource is instructional documentation with TypeScript examples and a CLI command. It does not supply an MCP server implementation or a complete agent application.

Assessment

The guide is useful when an agent needs private tools and the developer must decide where credentials belong, how authorization happens and which tools the model can access. Its most useful details concern operational boundaries: credentials remain on the authorizing machine, background work cannot wait for a connection prompt, and a hosted connection can be used by anyone who can use the agent.

It supports an implementation starting point, but does not establish installation compatibility, successful authorization against a particular server or production reliability. No commands or examples were run.

Users

The intended readers are developers building agents that call private remote tools, such as an inventory lookup. It is relevant to interactive chat, Slack integrations and unattended tasks, although those environments have different authorization behavior.

Beginners receive concrete file locations and a command to follow, but the page assumes familiarity with TypeScript, CLI use and agent connections. Developers who need access permissions tied to each individual caller should investigate the separately mentioned per-session auth mechanism; this page does not explain its setup.

Capabilities

The page shows how to declare an OAuth connection, authorize it in a browser and advertise its tools to the model. It also describes first-use authorization that can resume a pending tool call in the same running process.

For more restricted access, it shows a connection hidden from the model under bot/host-connections/ and a separate tool that calls one permitted server operation through ctx.host.mcp. Hosted access is covered through a Cursor dashboard connection.

Using it

Requirements

The local example assumes an agent project, the agent-sdk CLI and a remote MCP server that supports the documented OAuth connection. The wrapper example additionally uses Zod for input validation. Browser access is needed to complete authorization.

Although the page is hosted on cursor.com, its examples import from @grok/agent-sdk/connections and @grok/agent-sdk/tools. The page does not explain that namespace or specify package versions, installation commands, runtime versions or operating-system support. Compatibility with an existing project remains unverified.

Mechanism

Host OAuth lets the machine running the agent authorize the remote server. The documentation says this avoids placing tokens in source files or the workspace, and that tokens obtained through mcp oauth remain on the machine that authorized them.

The credential-location table distinguishes three arrangements: cursorAccount connections use Cursor's backend, URL connections with oauth enabled use the serving host, and URL connections with headers use supplied secrets. Host OAuth cannot be combined with per-session auth on the same connection. Encryption, token refresh, revocation and storage details are not described.

Setup

For the local example, create bot/mcp-connections/inventory.ts with defineConnection, the server URL, oauth set to true and advertiseTools set to true. Authorize it with agent-sdk mcp oauth inventory. The filename determines the connection name, and changing the server URL requires authorization again.

For a Cursor-hosted agent, add the server under MCP in the Cursor dashboard, reference it through a cursorAccount: true connection and connect it from [https://cursor.com/dashboard/deployed-agents]. The page advises narrowing the servers list because anyone who can use the agent can use that connection. The linked connection reference is outside the supplied evidence.

Example

The restricted inventory example places a connection in bot/host-connections/inventory.ts and allows only lookup_stock. A separate get_stock tool accepts a SKU string and a region restricted to us-east or us-west, then calls that server operation through ctx.host.mcp.callTool.

The wrapper returns an ok value based on whether result.isError is true and returns result.structuredContent as stock, falling back to null. This demonstrates constrained inputs and output mapping. It does not show a permission check for an individual caller, validate the returned stock structure or provide a working inventory backend.

Assessment & evidence

Limitations

An eligible interactive turn can pause for first-use authorization, show Connect and retry the call after browser authorization. Waiting ends after ten minutes or an interruption. Supported contexts are playground or HTTP chat turns and Slack messages whose channel exposes Connect through toolApprovals or buildToolApprovalEvents.

Schedules, reminders, webhooks, evals and Slack channels without Connect cannot wait. In contexts that cannot wait, a required connection fails the call with Reconnect <connection>. The page also says an optional connection is skipped, even in the playground. These connections should be authorized beforehand.

A hidden connection and narrow wrapper limit exposed operations, but the example does not establish caller-specific authorization. Hosted connection access is shared with the agent's users, and the page does not document broader tenant isolation or audit controls.

Reasoning

The documented design suggests a useful separation between credentials, remote server access and the tool interface presented to the model. A wrapper can expose a smaller operation with constrained inputs while keeping the underlying connection hidden.

The practical tradeoff is shared authority: host OAuth uses the host's connection, and a Cursor-hosted connection is available through the agent. This makes credential ownership and the permitted user population central design decisions. The evidence does not establish that the sample wrapper alone enforces all access requirements.

Alternatives

The page compares connection arrangements rather than competing products. Use cursorAccount when the server is connected in the Cursor dashboard, host OAuth when the serving host should own access, or headers when the server accepts an API key or bearer token.

Per-session auth is identified as the route for giving each caller a separate downstream identity, but its configuration is not included. The supplied evidence does not support comparisons with other SDKs or authentication systems.

Evidence

The evidence consists of the complete selected page from [https://cursor.com/docs/agent-sdk/guides/mcp-oauth.md], retained as selected-page.txt and captured at 2026-11-14T20:39:49.736Z. Its recorded source revision is sha256:9aa2d2466f9996098f4182c49bd322be97185cfc2364a962794c694a0503dd22.

The page supports the configuration examples and documented behavior described here. It supplies no execution receipts, measured results or independent security evaluation. No installation, authorization flow, remote tool call or deployment was executed.

Access & freshness

Costs

The page gives no prices, subscription requirements, usage allowances or billing terms. Costs for the SDK, Cursor-hosted agents, model calls, infrastructure and the private MCP service are unknown from this evidence. The examples do not establish that deployment or operation is free.

Rights

The selected page contains no explicit license or redistribution terms for its text or example code. Permission to redistribute the captured page or reuse its examples under a particular license cannot be established. Terms for the SDK and connected services are also outside the supplied evidence.

Freshness

The capture records the page as obtained on 14 November 2026. The page itself supplies no publication date, last-updated date or supported SDK version. The capture timestamp does not establish when the documented behavior was introduced or last verified.

Current package availability, dashboard behavior and compatibility with installed SDK releases remain unverified.

Actions

Before implementation, confirm the package namespace, CLI version and connection APIs for the intended project. Decide whether access should belong to the serving machine, a Cursor account or each individual caller.

For unattended work, complete authorization before scheduling calls. For shared hosted agents, narrow the servers list and permitted operations. Use a wrapper where constrained inputs are useful, and establish any required caller permissions separately.

Verify authorization, interruption, timeout and reconnect behavior in the intended environment. Resolve pricing, reuse rights and token-management requirements from the applicable package and service documentation; this page leaves them unknown.

Evidence for this report

selected-page.txtselected · checked 2026-11-14