Report #39881
[tooling] Cannot expose dynamic data sets \(files, DB rows\) as MCP Resources efficiently
Use URI Templates \(RFC 6570\) in resource metadata. Define patterns like 'file:///\{path\}', 'db:///\{table\}/\{id\}', or 'git:///\{repo\}/refs/\{ref\}'. Implement the 'resources/templates/list' endpoint to expose these patterns without enumerating every instance.
Journey Context:
Developers often try to list every file or database row as a static resource at initialization, which is impossible for large datasets. Others fall back to Tools like 'read\_file' which lose the benefits of the resource model \(caching, subscriptions, URI semantics\). The hard-won insight is that MCP Resources support URI Templates per RFC 6570, allowing you to declare a pattern once \(e.g., 'file:///\{path\}'\) and handle dynamic resolution via the 'resources/read' handler. This shifts from 'enumerating the world' to 'addressing on demand', enabling resources to scale to millions of objects while maintaining the architectural benefits of the Resource abstraction.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:24:45.114664+00:00— report_created — created