Overview
openLink requests the host to open a URL in the user’s browser. Since MCP Apps run inside sandboxed iframes, they cannot navigate directly or open new windows. This method delegates link opening to the host, which can apply its own security policies (such as URL allowlists or user confirmation dialogs) before opening the link.
The host may deny the request, in which case isError will be true in the response.
Signature
Parameters
The link parameters.
The URL to open. Must be a valid absolute URL (e.g.,
https://docs.example.com). The host may restrict which URL schemes and domains are allowed.Optional request configuration.
An
AbortSignal to cancel the request.Returns
true if the host denied the link request (e.g., blocked URL scheme, user cancelled). When absent or false, the link was opened.Usage
Open a documentation link
Open a link from a button click
Open a dynamic URL
Related
- Requests overview — all available View-to-host request methods
useOpenLink— sunpeak React convenience hook- CSP and CORS — security considerations for external resources