Skip to content

Commit 9213d91

Browse files
committed
Adding instructions for using Descope
1 parent f7ece33 commit 9213d91

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/content/docs/agents/model-context-protocol/authorization.mdx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Read the docs for the [Workers oAuth Provider Library](https://github.com/cloudf
124124

125125
### (3) Bring your own OAuth Provider
126126

127-
If your application already implements an OAuth Provider itself, or you use [Stytch](https://stytch.com/), [Auth0](https://auth0.com/), [WorkOS](https://workos.com/), or authorization-as-a-service provider, you can use this in the same way that you would use a third-party OAuth provider, described above in (2).
127+
If your application already implements an OAuth Provider itself, or you use authorization-as-a-service provider, you can use this in the same way that you would use a third-party OAuth provider, described above in (2).
128128

129129
You can use the auth provider to:
130130
- Allow users to authenticate to your MCP server through email, social logins, SSO (single sign-on), and MFA (multi-factor authentication).
@@ -133,6 +133,7 @@ You can use the auth provider to:
133133
- Enforce the permissions so that agents can only invoke permitted tools.
134134

135135
#### Stytch
136+
136137
Get started with a [remote MCP server that uses Stytch](https://stytch.com/docs/guides/connected-apps/mcp-servers) to allow users to sign in with email, Google login or enterprise SSO and authorize their AI agent to view and manage their company's OKRs on their behalf. Stytch will handle restricting the scopes granted to the AI agent based on the user's role and permissions within their organization. When authorizing the MCP Client, each user will see a consent page that outlines the permissions that the agent is requesting that they are able to grant based on their role.
137138

138139
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/mcp-stytch-b2b-okr-manager)
@@ -142,6 +143,7 @@ For more consumer use cases, deploy a remote MCP server for a To Do app that use
142143
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/mcp-stytch-consumer-todo-list)
143144

144145
#### Auth0
146+
145147
Get started with a remote MCP server that uses Auth0 to authenticate users through email, social logins, or enterprise SSO to interact with their todos and personal data through AI agents. The MCP server securely connects to API endpoints on behalf of users, showing exactly which resources the agent will be able to access once it gets consent from the user. In this implementation, access tokens are automatically refreshed during long running interactions.
146148

147149
To set it up, first deploy the protected API endpoint:
@@ -158,6 +160,12 @@ Get started with a remote MCP server that uses WorkOS's AuthKit to authenticate
158160

159161
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authkit)
160162

163+
#### Descope
164+
165+
Get started with a remote MCP server that uses [Descope](https://www.descope.com/) Inbound Apps to authenticate and authorize users (for example, email, social login, SSO) to interact with their data through AI agents. Leverage Descope custom scopes to define and manage permissions for more fine-grained control.
166+
167+
[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server-descope-auth)
168+
161169
## Using Authentication Context in Your MCP Server
162170

163171
When a user authenticates to your MCP server through Cloudflare's OAuth Provider, their identity information and tokens are made available through the `props` parameter.
@@ -196,7 +204,7 @@ function requirePermission(permission, handler) {
196204
status: 403
197205
};
198206
}
199-
207+
200208
// If permission check passes, execute the handler
201209
return handler(request, context);
202210
};
@@ -208,7 +216,7 @@ async init() {
208216
this.server.tool("basicTool", "Available to all users", {}, async () => {
209217
// Implementation for all users
210218
});
211-
219+
212220
// Protected tool using the permission wrapper
213221
this.server.tool(
214222
"adminAction",
@@ -221,7 +229,7 @@ async init() {
221229
};
222230
})
223231
);
224-
232+
225233
// Conditionally register tools based on user permissions
226234
if (this.props.permissions?.includes("special_feature")) {
227235
this.server.tool("specialTool", "Special feature", {}, async () => {
@@ -231,7 +239,7 @@ async init() {
231239
}
232240
```
233241
234-
Benefits:
242+
Benefits:
235243
- Authorization check at the tool level ensures proper access control
236244
- Allows you to define permission checks once and reuse them across tools
237245
- Provides clear feedback to users when permission is denied

0 commit comments

Comments
 (0)