You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exercises/05.scopes/01.problem.check-scopes/README.mdx
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,3 +38,10 @@ Once you have the scope validation utilities in place, you'll also need to add a
38
38
This approach means users will only see the tools and features they're actually authorized to use, creating a smooth and intuitive experience that matches their permission level.
39
39
40
40
📜 For more details on OAuth scopes and how they work in MCP servers, see the [OAuth 2.0 Scopes RFC](https://tools.ietf.org/html/rfc6749#section-3.3) and the [MCP Authentication Specification](https://modelcontextprotocol.io/specification/2025-06-18/server/auth).
41
+
42
+
<callout-danger>
43
+
At the time of this writing, there is a bug in the Cloudflare `McpAgent` that
44
+
prevents client capabilities from being provided properly, as a result,
45
+
sampling requests will not be made. Add `console.log`s to check if your logic
Copy file name to clipboardExpand all lines: exercises/05.scopes/03.problem.scope-hints/README.mdx
+4-35Lines changed: 4 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,25 +2,11 @@
2
2
3
3
👨💼 When users try to access our EpicMe journaling app without proper permissions, they need clear guidance on what scopes are available and required. Without this information, clients can't know what to request during the OAuth authorization flow, leading to failed authentication attempts and frustrated users.
4
4
5
-
The solution is to provide **scope hints** in our OAuth responses. These hints tell clients exactly what scopes are supported and help them understand what permissions they need to request from the authorization server.
5
+
The solution is to provide a **scope hint**(called `scopes_supported`) in our OAuth protected resource metadata. This metadata tells clients exactly what scopes are supported and help them understand what permissions they could request from the authorization server.
6
6
7
7
Here's how this works in practice. Imagine a smart home app that controls different devices:
8
8
9
-
```ts lines=8,20-25
10
-
// When a client gets a 401 Unauthorized response, we include scope hints
// The protected resource metadata also lists supported scopes
25
11
function handleOAuthProtectedResourceRequest(request:Request) {
26
12
returnResponse.json({
@@ -36,25 +22,8 @@ function handleOAuthProtectedResourceRequest(request: Request) {
36
22
}
37
23
```
38
24
39
-
The `scope` parameter in the `WWW-Authenticate` header tells the client what scopes are available for this specific resource. The `scopes_supported` in the protected resource metadata provides a complete list of all supported scopes across the entire system.
40
-
41
-
<callout-info>
42
-
The `scope` parameter in OAuth error responses helps clients understand what
43
-
permissions they can request, while `scopes_supported` in the metadata
44
-
endpoint gives them the complete picture of available scopes.
45
-
</callout-info>
46
-
47
-
<callout-warning>
48
-
Note the difference between 401 and 403 responses: In a **401 Unauthorized**
49
-
response, the `scope` parameter lists **all available scopes** for discovery
50
-
("here's what you can request"). In a **403 Forbidden** response, the `scopes`
51
-
parameter would list **required scopes** for that specific request ("here's
52
-
what you need"). We can't use `scopes` in our 403 response because we have
53
-
multiple valid scope combinations rather than a single required set.
54
-
</callout-warning>
55
-
56
-
This approach ensures that when users encounter permission issues, their client apps can automatically request the right scopes and guide users through a smooth authorization flow.
25
+
The `scopes_supported` in the protected resource metadata provides a complete list of all supported scopes across the entire system.
57
26
58
27
📜 For more details on OAuth scope parameters, see the [OAuth 2.0 Authorization Framework RFC](https://tools.ietf.org/html/rfc6749#section-3.3).
59
28
60
-
Now, add the missing scope hints to help clients understand what permissions are available for our EpicMe journaling app.
29
+
Now, add the missing `scopes_supported` to help clients understand what permissions are available for our EpicMe journaling app.
0 commit comments