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: src/content/docs/agents/model-context-protocol/authorization.mdx
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,11 +28,11 @@ The following sections describe each of these options and link to runnable code
28
28
29
29
## Authorization options
30
30
31
-
### (1) Your MCP Server handles authorization itself
31
+
### (1) Your MCP Server handles authorization and authentication itself
32
32
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.
33
+
Your MCP Server, using the [OAuth Provider Library](https://github.com/cloudflare/ai/demos/remote-mcp-server/lib/workers-oauth-provider), can handle the complete OAuth authorization flow, without any third-party involvement.
34
34
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.
35
+
The [Workers OAuth Provider Library](https://github.com/cloudflare/ai/demos/remote-mcp-server/lib/workers-oauth-provider) is a Cloudflare Worker that implements a [`fetch()` handler](/workers/runtime-apis/handlers/fetch/), and handles incoming requests to your MCP server.
36
36
37
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:
38
38
@@ -42,13 +42,17 @@ export default new OAuthProvider({
42
42
// Your MCP server:
43
43
apiHandler: MyMCPServer.Router,
44
44
// Your handler for authentication and authorization:
45
-
defaultHandler: OAuthProvider.defaultHandler,
45
+
defaultHandler: MyAuthHandler,
46
46
authorizeEndpoint: "/authorize",
47
47
tokenEndpoint: "/token",
48
48
clientRegistrationEndpoint: "/register",
49
49
});
50
50
```
51
51
52
+
Refer to the [getting started example](/agents/model-context-protocol/mcp-server/getting-started/) for a complete example of the `OAuthProvider` in use, with a mock authentication flow.
53
+
54
+
The authorization flow in this case works like this:
55
+
52
56
```mermaid
53
57
sequenceDiagram
54
58
participant B as User-Agent (Browser)
@@ -73,11 +77,11 @@ Remember — [authentication is different from authorization](https://www.cloud
73
77
74
78
### (2) Third-party OAuth Provider
75
79
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/).
80
+
The [OAuth Provider Library](https://github.com/cloudflare/ai/demos/remote-mcp-server/lib/workers-oauth-provider) 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/guides/remote-mcp-server-github).
77
81
78
82
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.
79
83
80
-
```ts ins="MyAuthHandler"
84
+
```ts ins="defaultHandler: MyAuthHandler,"
81
85
importMyAuthHandlerfrom"./auth-handler";
82
86
83
87
exportdefaultnewOAuthProvider({
@@ -116,7 +120,7 @@ sequenceDiagram
116
120
M->>C: MCP access token
117
121
```
118
122
119
-
Read the docs for the [Workers oAuth Provider Library](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/) for more details.
123
+
Read the docs for the [Workers oAuth Provider Library](https://github.com/cloudflare/ai/demos/remote-mcp-server/lib/workers-oauth-provider) for more details.
Copy file name to clipboardExpand all lines: src/content/docs/agents/model-context-protocol/transport.mdx
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ The Model Context Protocol (MCP) specification defines [two standard transport m
12
12
1.**stdio, communication over standard in and standard out** — designed for local MCP connections
13
13
2.**HTTP with Server-Sent Events (SSE)** — designed for remote MCP connections
14
14
15
-
`workers-mcp` supports remote MCP connections, using HTTP with Server-Sent Events (SSE) as transport. SSE requires a persistent HTTP connection, which is supported by Cloudflare [Durable Objects](/durable-objects/).
15
+
The [remote MCP examples](/agents/model-context-protocol/mcp-server/getting-started/) support remote MCP connections, using HTTP with Server-Sent Events (SSE) as transport. SSE requires a persistent HTTP connection, which is supported by Cloudflare [Durable Objects](/durable-objects/). Transport is configured and handled automatically. You don't need to configure anything — it just works.
16
16
17
-
Transport is configured and handled automatically by `workers-mcp`. You don't need to configure anything — it just works.
17
+
:::note
18
+
If you are looking to deploy a MCP server that supports _local_ MCP connections, you should follow the [guide](/agents/guides/build-mcp-server/) for building local MCP servers using Cloudflare Workers.
0 commit comments