1. Architecture and scope
MCP separates an application calling tools from the server exposing them. For a protected HTTP endpoint, authorization determines which requests that resource accepts. The protocol’s authorization specification describes OAuth roles, discovery and token handling; this notebook focuses on the resource-server decision after token validation. It does not describe the complete login flow. [1]
A token can be validly issued yet intended for another resource. RFC 8707 distinguishes where a token can be redeemed from what access a scope requests. The MCP server must check that the token was issued for its own intended audience. A matching permission name does not repair an audience mismatch. [1] [2]
Scope. Protected HTTP MCP resources. This is an authorization study, not an implementation of an OAuth client or a token validator.
Workflow and scope notes
- Protected request. A client calls an HTTP MCP resource using its issued access token. Record the requested resource and operation without logging the token.
- Validate token. Validate authenticity, issuer, expiry and the resource audience using the applicable authorization system. The lab receives validation outcomes; parsing claims alone does not establish validity.
- Check permission. Compare trusted granted permissions with the operation’s required permission. A valid token can still lack permission for a particular operation.
- Return outcome. Invalid or expired tokens receive 401; insufficient permission is a 403 case. Keep error responses useful without exposing token material.
2. Token validation and permission decisions
Set three trusted outcomes. These switches stand in for real validation that has already happened; the page never accepts a token. The requested operation requires the fictional scope notes:read.
Token validation and permission decisions
Original synthetic experiment · Change an input to update the figure.
This is a decision table over trusted booleans. It does not validate a signature, discover metadata, refresh credentials or secure an endpoint.
Calculation record
{
"inputs": {
"valid": "yes",
"audience": "yes",
"scope": "no"
},
"status": 403,
"outcome": "Insufficient permission"
}| Case | Result | Interpretation |
|---|---|---|
| Valid token; wrong audience | 401 | The resource cannot accept a token issued for a different audience. |
| Valid token and audience; missing scope | 403 | The token is accepted as valid but does not authorize this operation. |
| All three checks pass | Allow in this toy model | Real deployments also enforce operation-specific policy and the rest of the protocol. |
3. Interpretation and limitations
Invalid-token and insufficient-scope errors are different cases in the standards. In the experiment, an invalid validation result takes priority over the scope result. The diagram shows that decision order explicitly. Neither a status code nor a successful local boolean test proves that the real validation system is correct. [1] [3]
Editorial implementation checklist: verify token handling at the actual server boundary, avoid token logging, test cross-resource rejection, and test each sensitive operation’s permission rule. Keep discovery, redirect validation and client security work in the full specification; they are outside this lesson’s simulator. [1]
Set the audience to No while keeping the required scope. Predict the result before looking at the decision path. Then restore the audience and remove the scope. Explain why the two failures differ.
4. Worked Python example
The core calculation below uses only the Python standard library. The full download adds the verification assertions and input fixtures. It runs locally on synthetic data; it does not load a model or contact a service.
from itertools import product
def decision(valid, audience, scope):
# Inputs are trusted validation outcomes, not token claims.
if not valid or not audience:
return {"status": 401, "outcome": "Reject token"}
if not scope:
return {"status": 403, "outcome": "Insufficient permission"}
return {"status": 200, "outcome": "Allow in toy model"}
Download full Python example and checks ↓
Run: python -I lab.py. Recorded run: Python 3.13; 8 fixture states plus scenario assertions passed. The JSON output is a reproducibility record, not a real-system benchmark.
5. Questions and explanations
Predict before opening the explanation. Answers refer to the stated scope and synthetic inputs.
References and source links
- Model Context Protocol contributors. (Specification 2026-07-28). Authorization - Model Context Protocol.https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization
- Campbell, B., Bradley, J., & Tschofenig, H. (2020). RFC 8707: Resource Indicators for OAuth 2.0.https://www.rfc-editor.org/rfc/rfc8707.html
- Jones, M., & Hardt, D. (2012). RFC 6750: The OAuth 2.0 Authorization Framework: Bearer Token Usage.https://www.rfc-editor.org/rfc/rfc6750.txt
Source checks and provenance
Primary publisher pages and relevant passages checked on 13 Nov 2026. Source support is not independent expert fact verification. Main documentation can change; retrieved-body hashes, dates, version labels and saved revision IDs are in the audit download.
Evidence: Token Handling; Error Handling. HTTP transport and token handling; stdio uses a different credential arrangement.
Public ResearchNode original 7467b89a07147fb5713bd8ab0a705b91
Revision 576ab5a15ec1e4ce1d73c9cf9b1b561e. Captured 2026-11-07.
Evidence: RFC 8707 §1–2. Resource indicators bind the intended resource; a scope string alone is not that binding.
Evidence: RFC 6750 §3.1. Bearer-token errors; tokens are secrets. No token is entered or sent by this notebook.