Skip to content

Commit 1b68329

Browse files
committed
More updates
1 parent 5d39540 commit 1b68329

File tree

11 files changed

+88
-303
lines changed

11 files changed

+88
-303
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Authentication
3+
sidebar:
4+
order: 4
5+
group:
6+
hideIndex: false
7+
---
8+
9+
import { DirectoryListing } from "~/components";
10+
11+
WIP
12+
13+
Explain / reiterate difference between authN and authz
14+
15+
This section should have some examples of using other services / libraries for authentication.
16+
17+
It should show you how to rip out the mock auth from the example project, and replace it with your own.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ When building a [Model Context Protocol (MCP)](https://modelcontextprotocol.io)
1616

1717
The Model Context Protocol uses [a subset of OAuth 2.1 for authorization](https://spec.modelcontextprotocol.io/specification/draft/basic/authorization/). OAuth allows your users to grant limited access to resources, without them having to share API keys or other credentials.
1818

19-
Cloudflare provides an OAuth SDK that implements the provider side of the OAuth 2.1 protocol, allowing you to easily add authorization to your MCP server.
19+
Cloudflare provides an [OAuth Provider Library](https://github.com/geelen/mcp-remote-examples/tree/main/.vendor/workers-oauth-provider) that implements the provider side of the OAuth 2.1 protocol, allowing you to easily add authorization to your MCP server.
2020

21-
You can use the OAuth SDK in three ways:
21+
You can use the OAuth Provider Library in three ways:
2222

2323
1. **Your Worker handles authorization itself.** Your MCP server, running on Cloudflare, handles the complete OAuth flow. ([Example](/agents/model-context-protocol/mcp-server/getting-started/))
2424
2. **Integrate with a third-party OAuth provider**, such as GitHub or Google. ([Example](/agents/model-context-protocol/mcp-server/examples/third-party-oauth-provider/))
@@ -30,12 +30,12 @@ The following sections describe each of these options and link to runnable code
3030

3131
### (1) Your MCP Server handles authorization itself
3232

33-
Your MCP Server, using the Cloudflare MCP Server and OAuth Provider SDKs, can handle the complete OAuth authorization flow, without any third-party involvement.
33+
Your MCP Server, using the Cloudflare [MCP Server SDK](/agents/model-context-protocol/mcp-server/getting-started/) and [OAuth Provider Library](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/), can handle the complete OAuth authorization flow, without any third-party involvement.
3434

35-
The [Workers OAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-sdk/) is a Cloudflare Worker that implements a [`fetch()` handler](/workers/runtime-apis/handlers/fetch/), and handles incoming requests to your MCP server. You provide your own handlers for your MCP Server's API, and autentication and authorization logic, and URI paths for the OAuth endpoints, and the SDK handles the rest.
35+
The [Workers OAuth Provider Library](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/) is a Cloudflare Worker that implements a [`fetch()` handler](/workers/runtime-apis/handlers/fetch/), and handles incoming requests to your MCP server. You provide your own handlers for your MCP Server's API, and autentication and authorization logic, and URI paths for the OAuth endpoints, and the SDK handles the rest.
3636

3737
{/* TODO: Update link */}
38-
The OAuth Provider SDK comes with an [example handler implementation](https://github.com/geelen/mcp-remote-examples/tree/main/02-user-password/src/routes) for autentication and authorization, referenced below as `defaultHandler`:
38+
The OAuth Provider Library comes with an [example handler implementation](https://github.com/geelen/mcp-remote-examples/tree/main/02-user-password/src/routes) for autentication and authorization, referenced below as `defaultHandler`:
3939

4040
{/* TODO: GithubCodeComponent */}
4141

@@ -82,7 +82,7 @@ For a step-by-step example, refer to the [Worker as OAuth Provider](/agents/mode
8282

8383
### (2) Third-party OAuth Provider
8484

85-
The OAuth Provider SDK can be configured to use a third-party OAuth provider, such as [GitHub](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) or [Google](https://developers.google.com/identity/protocols/oauth2).
85+
The OAuth Provider Library can be configured to use a third-party OAuth provider, such as [GitHub](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) or [Google](https://developers.google.com/identity/protocols/oauth2).
8686

8787
When you use a third-party OAuth provider, you must provide a handler to the `OAuthProvider` that implements the OAuth flow for the third-party provider.
8888

@@ -128,19 +128,19 @@ sequenceDiagram
128128
M->>C: MCP access token
129129
```
130130

131-
Read the docs for the [Workers oAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-sdk/) for more details.
131+
Read the docs for the [Workers oAuth Provider Library](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/) for more details.
132132

133133
### (3) Bring your own OAuth Provider
134134

135-
If your application already implements an Oauth Provider itself, or you use Stytch, Auth0, 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.
135+
If your application already implements an Oauth Provider itself, or you use Stytch, Auth0, 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).
136136

137-
The following examples show how to use the OAuth Provider SDK with an external OAuth provider:
137+
The following examples show how to use the OAuth Provider Library with an external OAuth provider:
138138

139139
- [Stytch](/agents/model-context-protocol/mcp-server/examples/stytch/)
140140
- [Auth0](/agents/model-context-protocol/mcp-server/examples/auth0/)
141141

142142
## Next steps
143143

144-
- [Learn how to use the OAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-sdk/)
144+
- [Learn how to use the OAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/)
145145
- [Learn how to use a third-party OAuth provider](/agents/model-context-protocol/mcp-server/examples/third-party-oauth-provider/)
146146
- [Learn how to bring your own OAuth provider](/agents/model-context-protocol/mcp-server/examples/external-oauth-provider/)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
pcx_content_type: navigation
3+
title: OAuth Provider Library
4+
# TODO: Update link to published library
5+
external_link: https://github.com/geelen/mcp-remote-examples/tree/main/.vendor/workers-oauth-provider
6+
sidebar:
7+
order: 5
8+
head: []
9+
---

src/content/docs/agents/model-context-protocol/mcp-server/authorization/oauth-sdk.mdx

Lines changed: 0 additions & 290 deletions
This file was deleted.

src/content/docs/agents/model-context-protocol/mcp-server/authorization/third-party-oauth-provider.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { Render, GitHubCode } from "~/components";
99

1010
{/* TODO: Why doesn't GitHub Code Component work? */}
1111

12+
WIP
13+
14+
Refer to the [GitHub OAuth Provider example](https://github.com/geelen/mcp-remote-examples/tree/main/04-oauth-pivot) for a complete example of how to use a third-party OAuth provider with the MCP Server SDK.
15+
1216
```ts
1317
import OAuthProvider, {
1418
AuthRequest,

0 commit comments

Comments
 (0)