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.
The security rules are scattered throughout the spec. This table cross-references them by primitive or utility, with their normative strength and the responsible role. It is the basis of the "input/output validation" section of your gateway.
| Primitive / utility | Server | Client / host |
|---|---|---|
| Tools | MUST validate inputs, access control, rate limiting, sanitise outputs. SHOULD NOT mark sensitive parameters with x-mcp-header. |
SHOULD confirm sensitive operations, show inputs before sending, validate results before the LLM, follow $ref rules, timeouts, audit. MUST treat annotations as untrusted (except trusted servers). MUST exclude tools with an invalid x-mcp-header (HTTP). |
| Resources | MUST validate URIs; MUST sanitise file:// paths; MUST encode binary; SHOULD apply access control and permissions. |
Treat contents as untrusted data; honour cacheScope: private. |
| Prompts | MUST validate inputs and outputs (injection, unauthorised access); SHOULD validate arguments. | Treat messages as server content. |
| Discovery | serverInfo is self-declared. |
SHOULD NOT use serverInfo for decisions; instructions is untrusted content. |
| Elicitation (form) | MUST NOT ask for secrets; MUST bind to client and user; SHOULD validate received data. | MUST identify the server; MUST offer decline/cancel; allow review and editing; SHOULD validate against the schema. |
| Elicitation (url) | MUST NOT include sensitive data or pre-authenticated URLs; MUST verify that whoever opens it is the same user; SHOULD use HTTPS. | MUST NOT prefetch or open without consent; MUST show the full URL and open in a non-inspectable context; SHOULD highlight the domain and warn about Punycode. |
| Sampling | MUST pair tool_use/tool_result; SHOULD limit iterations. |
SHOULD require human approval, rate limiting, honour hints; MUST honour maxTokens; MAY ignore includeContext. |
| Roots | SHOULD respect boundaries and validate paths. | MUST expose with appropriate permissions, validate against traversal, access control. |
| Completion | MUST validate inputs, rate limiting, control sensitive suggestions, avoid information leakage. | SHOULD debounce and cache. |
| Logging | MUST NOT include secrets, PII or internal details; SHOULD rate limit. | Treat as data. |
| Caching | Faithful cacheScope; MUST apply access control per primitive; MUST NOT rely on cacheScope as a control. |
MUST NOT cross contexts with private. |
| Icons | — | MUST: only https:/data:, no credentials, same origin, validate magic bytes, limits, care with SVG. |
| JSON Schema | Valid schemas. | MUST NOT resolve network $ref by default; SHOULD bound composition. |
| MRTR / requestState | MUST treat it as attacker input; integrity (HMAC/AEAD) if it influences authorization; SHOULD include principal + TTL + digest; single-use where applicable. | MUST echo exactly; MUST NOT inspect. |
| State handles | MUST NOT use as authentication; SHOULD be random and bound to the user. | Carry-forward by the model. |
| Tasks (ext.) | MUST bind to authorization context; high-entropy ids; concurrency and TTL limits; logs. | Persist ids; honour pollIntervalMs. |
| Apps (ext.) | Declared CSP and permissions. | Sandboxed iframe; control which tools the app can invoke. |
| Skills (ext.) | Faithful manifest with digests. | MUST verify digests, sizes and frontmatter; approval bound to the manifest; untrusted content; no early retrieval. |
| HTTP transport | MUST validate Origin; SHOULD bind to localhost and authenticate; MUST validate headers against body. |
Close streams to cancel; HTTPS. |
| stdio | MUST keep stdout clean. | Consent before launch (SEP-1024); sandbox. |
readOnlyHint from a non-approved server.1. What must the server do with a resources/read request for file:///a/../../etc/passwd?
MUST sanitise file:// paths against directory traversal; and never return empty contents for non-existent ones.
2. Can a server rely on cacheScope as an access control?
cacheScope is a caching hint, not an authorization mechanism.