2.0.0
Use this when you need to read data from server-exposed resources like configuration files, generated content, or external data sources.
Resources are data sources exposed by MCP servers. They can be static files with fixed content, or dynamic templates that generate content based on parameters in the URI.
Reading Resources
Read a resource using its URI:weather://{city}/current, and you fill in the parameters when reading:
Content Types
Resources return different content types depending on what they expose. Text resources include configuration files, JSON data, and other human-readable content:BlobResourceContents, whose blob field is a base64 string, so decode it before writing bytes to disk:
Multi-Server Clients
When using multi-server clients, the server name is inserted after the URI scheme, soweather://icons/sunny on the weather server becomes weather://weather/icons/sunny:
Version Selection
New in version3.0.0
When a server exposes multiple versions of a resource, you can request a specific version:
Raw Protocol Access
For complete control, useread_resource_mcp() which returns the full MCP protocol object: