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.
Usage
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
The ID of the OAuth MCP server to authorize.
Body
An absolute URL in your application where v0 redirects after OAuth completes. HTTPS is required in production.
Response
Fixed value identifying this object as an MCP server OAuth authorization.
The MCP server being authorized.
The provider authorization URL to redirect the user to.
The OAuth state value. This expires after 5 minutes.
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/callbackThis callback is handled by v0. Your application should handle the returnUrl you pass to this endpoint.