Skip to main content
This page demonstrates live WebMCP resources that register themselves with the browser and can be read by AI agents in real-time. Resources expose data that AI models can access asynchronously.
These resources are live and ready! The WebMCP polyfill is included with this documentation site. Install the MCP-B browser extension to enable AI agents (like Claude) to discover and read these resources directly.

Resource Registration

Understanding resource registration

Live Tools

Interactive tool demonstrations

Live Prompts

Interactive prompt demonstrations

WebMCP Status

Check if the WebMCP polyfill is loaded and ready:

What are Resources?

Resources in MCP are data endpoints that AI agents can read. Unlike tools (which execute actions) or prompts (which generate messages), resources provide access to dynamic or static content like configuration, files, or API data.

App Settings Resource

Demonstrates: Static resource with fixed URI This resource shows the fundamentals of registerResource() - a static resource with a fixed URI that returns configuration data. The resource content updates dynamically based on the current settings.
Try it with your AI assistant: Ask Claude to “read the app-settings resource” and watch it retrieve the current configuration!

File Reader Resource

Demonstrates: Resource template with URI parameters This resource shows advanced usage with URI templates - the {path} placeholder allows AI agents to read different files by specifying the path parameter. Templates enable flexible, parameterized data access.
Try it with your AI assistant: Ask Claude to “read the file readme.txt” and watch it access the virtual filesystem!

Resource API Reference

registerResource(descriptor)

Registers a new resource with the browser.

listResources()

Returns all registered static resources.

listResourceTemplates()

Returns all registered resource templates.
The readResource() method is called by AI agents through the MCP protocol, not directly from your application code. When an AI agent calls readResource('config://app-settings'), your registered read() handler is invoked and the result is returned to the agent.

Static vs Template Resources

Static resources have fixed URIs and provide single data endpoints.
Use cases:
  • Application configuration
  • User preferences
  • System status
  • Single data endpoints

Best Practices

Use descriptive URI schemes that indicate the data type: config://, file://, user://, api://. This helps AI agents understand what they’re accessing.
Always provide mimeType to help AI agents parse content correctly. Use standard MIME types like application/json or text/plain.
Return helpful error messages in the content when resources can’t be read. Include context about what went wrong.
When exposing multiple similar items (files, users, records), use URI templates instead of registering each item separately.
Return only the relevant data. Avoid dumping entire databases - let AI agents request specific resources as needed.

URI Scheme Examples


Concepts: Resources

Deep dive into resource architecture and patterns

Live Tool Examples

Interactive tool demonstrations

Live Prompt Examples

Interactive prompt demonstrations

Best Practices

Guidelines for effective WebMCP usage