Vercel

Create MCP Server OAuth Authorization URL

Creates an OAuth authorization URL for an OAuth MCP server. Redirect the user to the returned URL to complete authorization without visiting v0.app.

POST/v1/mcp-servers/{mcpServerId}/oauth/authorize

Usage

TypeScript Example
import { v0 } from 'v0-sdk'const authorization = await v0.mcpServers.createOAuthAuthorizationUrl({  mcpServerId: 'mcp_123',  returnUrl: 'https://your-app.example.com/oauth/v0-mcp/callback',})// Redirect the user to authorization.url in your application.console.log(authorization.url)

After the user authorizes with the MCP provider, v0 stores the OAuth tokens and redirects to your returnUrl with oauth_success=true and mcpServerId. If authorization fails, v0 redirects to your returnUrl with error and error_description.

API Signature

Request

Path Parameters

mcpServerId: string

The ID of the OAuth MCP server to authorize.

Body

returnUrl: string

An absolute URL in your application where v0 redirects after OAuth completes. HTTPS is required in production.

Response

object: 'mcp_server_oauth_authorization'

Fixed value identifying this object as an MCP server OAuth authorization.

mcpServerId: string

The MCP server being authorized.

url: string

The provider authorization URL to redirect the user to.

state: string

The OAuth state value. This expires after 5 minutes.

expiresAt: string

The ISO 8601 timestamp when the authorization URL expires.

OAuth Callback

Register this redirect URI with the MCP provider:

https://api.v0.dev/v1/mcp-servers/oauth/callback

This callback is handled by v0. Your application should handle the returnUrl you pass to this endpoint.

On this page