Overview
readServerResource reads a resource from the originating MCP server by URI. The request is proxied through the host, so the View never communicates directly with the server. This is useful for fetching data, binary assets (images, video, audio), or structured content that a server exposes via MCP Resources.
The returned ReadResourceResult contains a contents array where each item is either a text resource (with a text field) or a binary resource (with a base64-encoded blob field).
Signature
Parameters
The URI of the resource to read. Must match a URI registered on the MCP server via
registerAppResource or a standard MCP resource.Optional request configuration such as timeout or abort signal.
Returns
Array of resource contents. Each entry includes a
uri and mimeType, plus either a text field (for text resources) or a blob field (base64-encoded binary).Usage
Reading a binary resource
Reading a text resource
Error handling
Related
useReadServerResource— React hook that wraps this method.- MCP Resources — How resources work in the MCP protocol.
listServerResources— Discover available resources before reading them.registerAppResource— Register resources on the server side.