part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
MCP resources are identified by URI, resource templates use URI Templates, icons and URL elicitations travel as URIs, and authorization compares issuer URIs "character by character". Three specifications need to be clearly understood.
https://mcp.example.com:8443/server/mcp?x=1#frag
\___/ \______________/\__/\_________/ \_/ \__/
scheme host port path query fragment
./.. segments); scheme-based normalisation (default port, trailing slash).iss (RFC 9207): "no case folding of scheme or host, no elision of default port, no trailing slash, no percent-encoding normalisation". That is, https://as.example and https://AS.example/ are different for the purposes of that validation.resource (RFC 8707): scheme + host (+ port) (+ path if it identifies the server), no fragment, preferably no trailing slash. mcp.example.com without a scheme is invalid.resources/templates/list returns templates such as file:///{path} or db://{database}/tables/{table}. Level 1 ({var}) is the usual case; expansion applies percent-encoding. The client can request autocompletion of each variable with completion/complete (ref/resource with uri = the template).
{ "uriTemplate": "github://repos/{owner}/{repo}/issues/{number}", "name": "Issue", "mimeType": "application/json" }
| Scheme | Use | Rules |
|---|---|---|
https:// |
Resource available on the web. | SHOULD be used only if the client can fetch it by itself without going through the MCP server; otherwise, use another scheme. |
file:// |
Filesystem-like resources (not necessarily real). | May mark directories with MIME inode/directory. Servers MUST sanitise paths against traversal. |
git:// |
Version control integration. | |
ui:// |
MCP Apps HTML resources. | Referenced from a tool's _meta.ui.resourceUri. |
skill:// |
Skills over MCP. | Recommended, not mandatory; the host does not identify a skill by the scheme alone. |
| custom | Anything else. | MUST comply with RFC 3986. |
For roots (deprecated), the URI MUST be file://.
A resources/read with file:///project/../../etc/passwd or with percent-encoding (%2e%2e) is the classic attack. Normalise before comparing with the permitted root, resolve symbolic links and check the prefix after resolution, not before.
file:// or ui:// is an anomaly.iss and redirect URI comparisons, use exact string equality as the spec mandates; for resource policy, use canonicalisation.1. When must a server use the https:// scheme for a resource?
If the server is the one downloading the content, it must use another scheme (or a custom one).
2. What normalisation does the client apply before comparing iss with the registered issuer?
MCP expressly forbids normalising before that comparison.
3. Which scheme MUST a root's URI have?
Roots are file:// in the current specification.