Skip to main content
Resources expose content clients can discover and read by URI. Use a static resource for one stable URI and a resource template for a family of URIs.

Register a static resource

A static callback receives the requested URL and request context:
Return the raw { contents: [...] } resource envelope. Each entry identifies its own URI and contains either text or a base64 blob with an appropriate MIME type.

Register a resource template

A template callback receives (uri, params, ctx). Inferred template values are string | string[] because RFC 6570 expressions can expand one or many values.
Completion providers belong in the definition’s top-level complete map. Use a string array for fixed suggestions or a callback for live lookup.

Return several content entries

One resource read may return several entries:
Deprecated response-helper results are accepted as conversion inputs, but raw resource envelopes are the direct return path and make URIs and MIME types explicit.

Notify listeners

Publish a list invalidation when the available resources or templates change:
Publish a URI invalidation when existing content changes:
Clients with an active subscription listener re-read the authoritative resource. Delivery is non-durable; see Resource Subscriptions.

Test resources

Run mcp-use dev, then use the built-in inspector to list resources, read static and templated URIs, exercise autocomplete, and verify successful and not-found results.