Skip to main content
Resources are URI-addressed content exposed by MCP servers.
Use listAllResources() when you want the complete resource list. It follows pagination cursors for you and returns { resources }.

Paginate resources

listResources(cursor?) returns an envelope with resources and an optional nextCursor. Handle the cursor yourself when you want to process one page at a time:

Resource templates

Parameterized URIs such as db://users/{id} are discovered with listResourceTemplates(). Its result contains resourceTemplates and may contain nextCursor. The current MCPConnection method retrieves the first template page and does not accept a cursor argument.
Resolve a template to a concrete URI in your application, then pass that URI to readResource(uri).

Subscribe to updates

If the server supports resource subscriptions, subscribe and unsubscribe with the same concrete URI:

React

useMcpServer exposes the resource contents envelope returned by readResource(uri):

Reference

MCPConnectionlistResources, listAllResources, listResourceTemplates, readResource, subscribeToResource, and unsubscribeFromResource.