Skip to content

Commit 28c9b5b

Browse files
committed
Pared down MCP docs
1 parent a7795dc commit 28c9b5b

File tree

14 files changed

+98
-376
lines changed

14 files changed

+98
-376
lines changed

src/content/docs/agents/model-context-protocol/mcp-client.mdx

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

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

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

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

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Authorization
33
sidebar:
44
order: 3
55
group:
6-
hideIndex: false
6+
hideIndex: true
77
---
88

99
import { DirectoryListing } from "~/components";
@@ -16,40 +16,33 @@ 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 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.
19+
Cloudflare provides an [OAuth Provider Library](https://github.com/cloudflare/ai/demos/remote-mcp-server/lib/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

2121
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/))
24-
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/))
25-
3. **Integrate with your own OAuth provider**, including authorization-as-a-service providers such as Stytch and Auth0. ([Example](/agents/model-context-protocol/mcp-server/examples/external-oauth-provider/))
24+
2. **Integrate directly with a third-party OAuth provider**, such as GitHub or Google. ([Example](/agents/model-context-protocol/mcp-server/examples/github/))
25+
3. **Integrate with your own OAuth provider**, including authorization-as-a-service providers you might already rely on, such as Stytch and Auth0.
2626

2727
The following sections describe each of these options and link to runnable code examples for each.
2828

2929
## Authorization options
3030

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

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.
33+
Your MCP Server, using [`workers-mcp`](/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 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.
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.
3636

37-
{/* TODO: Update link */}
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`:
39-
40-
{/* TODO: GithubCodeComponent */}
37+
You provide your own handlers for your MCP Server's API, and autentication and authorization logic, and URI paths for the OAuth endpoints, as shown below:
4138

4239
```ts
43-
import OAuthProvider from "workers-oauth-provider";
44-
45-
// TODO: Bunch of naming decisions here
4640
export default new OAuthProvider({
4741
apiRoute: "/mcp",
4842
// Your MCP server:
4943
apiHandler: MyMCPServer.Router,
5044
// Your handler for authentication and authorization:
5145
defaultHandler: OAuthProvider.defaultHandler,
52-
// TODO: Should these have default values?
5346
authorizeEndpoint: "/authorize",
5447
tokenEndpoint: "/token",
5548
clientRegistrationEndpoint: "/register",
@@ -76,28 +69,23 @@ sequenceDiagram
7669
Note over C,M: Begin standard MCP message exchange
7770
```
7871

79-
Remember — [authentication is different from authorization](https://www.cloudflare.com/learning/access-management/authn-vs-authz/). Your MCP Server can handle authorization itself, while still relying on an external authentication service to first authenticate users. The [example](/agents/model-context-protocol/mcp-server/) in getting started provides a mock authentdcation flow. You will need to implement your own authentication handler — either handling authentication yourself, or using an external authentication service such as Clerk, Stytch, Auth0 or others.
80-
81-
For a step-by-step example, refer to the [Worker as OAuth Provider](/agents/model-context-protocol/mcp-server/authorization/worker-as-oauth-provider/) section., and refer to the [API reference docs for the OAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-sdk/).
72+
Remember — [authentication is different from authorization](https://www.cloudflare.com/learning/access-management/authn-vs-authz/). Your MCP Server can handle authorization itself, while still relying on an external authentication service to first authenticate users. The [example](/agents/model-context-protocol/mcp-server/getting-started) in getting started provides a mock authentdcation flow. You will need to implement your own authentication handler — either handling authentication yourself, or using an external authentication services.
8273

8374
### (2) Third-party OAuth Provider
8475

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).
76+
The OAuth Provider Library can be configured to use a third-party OAuth provider, such as GitHub or Google. You can see a complete example of this in the [GitHub example](/agents/model-context-protocol/mcp-server/examples/github/).
8677

8778
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.
8879

89-
```ts
90-
import OAuthProvider from "workers-oauth-provider";
80+
```ts ins="MyAuthHandler"
9181
import MyAuthHandler from "./auth-handler";
9282

93-
// TODO: Bunch of naming decisions here
9483
export default new OAuthProvider({
9584
apiRoute: "/mcp",
9685
// Your MCP server:
9786
apiHandler: MyMCPServer.Router,
98-
// Your handler for authentication and authorization with the third-party provider:
87+
// Replace this handler with your own handler for authentication and authorization with the third-party provider:
9988
defaultHandler: MyAuthHandler,
100-
// TODO: Should these have default values?
10189
authorizeEndpoint: "/authorize",
10290
tokenEndpoint: "/token",
10391
clientRegistrationEndpoint: "/register",
@@ -134,13 +122,7 @@ Read the docs for the [Workers oAuth Provider Library](/agents/model-context-pro
134122

135123
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).
136124

137-
The following examples show how to use the OAuth Provider Library with an external OAuth provider:
138-
139-
- [Stytch](/agents/model-context-protocol/mcp-server/examples/stytch/)
140-
- [Auth0](/agents/model-context-protocol/mcp-server/examples/auth0/)
141-
142125
## Next steps
143126

144127
- [Learn how to use the OAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/)
145-
- [Learn how to use a third-party OAuth provider](/agents/model-context-protocol/mcp-server/examples/third-party-oauth-provider/)
146-
- [Learn how to bring your own OAuth provider](/agents/model-context-protocol/mcp-server/examples/external-oauth-provider/)
128+
- Learn how to use a third-party OAuth provider, using the [GitHub](/agents/model-context-protocol/mcp-server/examples/github/) and [Slack](/agents/model-context-protocol/mcp-server/examples/slack/) examples.

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)