MCP Resource URIs and Templates
A resource URI is the stable identifier a client uses to refer to a piece of server-provided context. URI design matters because it becomes part of your public MCP contract.
Stable and descriptive
Prefer URIs that remain stable when internal database IDs or storage layouts change. The scheme and path should communicate the resource domain while avoiding secrets in the URI.
Templates
When a server has millions of possible resources, listing them all is impractical. Resource templates describe parameterized URI families such as a repository path or customer record pattern.
Security
A parseable URI does not imply authorization. Every resource read must enforce access control. Be especially careful with multi-tenant identifiers and path traversal when URIs map to files.
Design rule: treat resource URIs like durable API identifiers. Avoid embedding credentials, access tokens, or sensitive data in them.