Skip to content

Commit 7148ecf

Browse files
authored
Merge branch 'bib/mcp-3-19' into change-20934
2 parents 8199037 + b458d62 commit 7148ecf

File tree

8 files changed

+30
-37
lines changed

8 files changed

+30
-37
lines changed

src/content/docs/agents/guides/build-mcp-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Below we will run you through an example of building an MCP server that fetches
3737
Follow these steps to create and deploy your own MCP server on Cloudflare Workers.
3838

3939
:::note
40-
Looking to deploy a MCP server that supports _remote_ connections over the Internet, with authentication and authorization? Check out our [guide](/docs/agents/model-context-protocol/getting-started) for building and deploying remote MCP servers to Cloudflare.
40+
Looking to deploy a MCP server that supports _remote_ connections over the Internet, with authentication and authorization? Check out our [guide](/agents/model-context-protocol/getting-started) for building and deploying remote MCP servers to Cloudflare.
4141
:::
4242

4343
### Create a new Worker

src/content/docs/agents/guides/remote-mcp-server-github.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: example
33
title: Build a Remote MCP Server with GitHub Auth
44
description: An example MCP server that uses GitHub as an OAuth provider
5-
external_link: https://github.com/cloudflare/ai/demos/remote-mcp-server-github
5+
external_link: https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server-github
66
sidebar:
77
order: 8
88
---

src/content/docs/agents/guides/remote-mcp-server-slack.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: example
33
title: Build a Remote MCP Server that exposes Slack as a tool
44
description: An MCP server that uses Slack as an OAuth provider, and allows MCP clients to send messages to a Slack channel.
5-
external_link: https://github.com/cloudflare/ai/demos/remote-mcp-server-slack
5+
external_link: https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server-slack
66
sidebar:
77
order: 9
88
---

src/content/docs/agents/guides/remote-mcp-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pcx_content_type: example
33
title: Build a Remote MCP Server
44
description: Complete example of a remote MCP server, with authorization built-in, that you can deploy to Cloudflare
5-
external_link: https://github.com/cloudflare/ai/demos/remote-mcp-server
5+
external_link: https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server
66
sidebar:
77
order: 7
88
---

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ 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/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.
19+
Cloudflare provides an [OAuth Provider Library](https://github.com/cloudflare/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

23-
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 directly with a third-party OAuth provider**, such as GitHub or Google. ([Example](/agents/model-context-protocol/mcp-server/examples/github/))
23+
1. **Your Worker handles authorization itself.** Your MCP server, running on Cloudflare, handles the complete OAuth flow. ([Example](/agents/model-context-protocol/getting-started/))
24+
2. **Integrate directly with a third-party OAuth provider**, such as GitHub or Google. ([Example](/agents/guides/remote-mcp-server-github/))
2525
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.
@@ -30,9 +30,9 @@ The following sections describe each of these options and link to runnable code
3030

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

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.
33+
Your MCP Server, using the [OAuth Provider Library](https://github.com/cloudflare/workers-oauth-provider), can handle the complete OAuth authorization flow, without any third-party involvement.
3434

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.
35+
The [Workers OAuth Provider Library](https://github.com/cloudflare/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.
3636

3737
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:
3838

@@ -49,7 +49,7 @@ export default new OAuthProvider({
4949
});
5050
```
5151

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.
52+
Refer to the [getting started example](/agents/model-context-protocol/getting-started/) for a complete example of the `OAuthProvider` in use, with a mock authentication flow.
5353

5454
The authorization flow in this case works like this:
5555

@@ -73,11 +73,11 @@ sequenceDiagram
7373
Note over C,M: Begin standard MCP message exchange
7474
```
7575

76-
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.
76+
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/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.
7777

7878
### (2) Third-party OAuth Provider
7979

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).
80+
The [OAuth Provider Library](https://github.com/cloudflare/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).
8181

8282
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.
8383

@@ -120,13 +120,13 @@ sequenceDiagram
120120
M->>C: MCP access token
121121
```
122122

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.
123+
Read the docs for the [Workers oAuth Provider Library](https://github.com/cloudflare/workers-oauth-provider) for more details.
124124

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

127127
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).
128128

129129
## Next steps
130130

131-
- [Learn how to use the OAuth Provider SDK](/agents/model-context-protocol/mcp-server/authorization/oauth-provider-api-reference/)
132-
- 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.
131+
- [Learn how to use the Workers OAuth Provider Library](https://github.com/cloudflare/workers-oauth-provider)
132+
- Learn how to use a third-party OAuth provider, using the [GitHub](/agents/guides/remote-mcp-server-github/) example MCP server.

src/content/docs/agents/model-context-protocol/getting-started.mdx

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ You can build both local and remote [Model Context Protocol (MCP)](https://model
1111

1212
Local MCP servers rely on running a local proxy on the same machine as your application. Remote MCP servers run on Cloudflare and support remote, authenticated connections over the Internet.
1313

14-
This guide will teach you how to build and deploy your first remote MCP server to Cloudflare. If you want to build a local MCP server, see the [build a local MCP server](/agents/guides/build-mcp-server/) guide.
14+
This guide will teach you how to build and deploy your first remote MCP server to Cloudflare. If you want to build a local MCP server, see the [build a local MCP server](/agents/guides/build-mcp-server/) guide instead.
1515

1616
### What is the Model Context Protocol (MCP)?
1717

@@ -21,24 +21,24 @@ This guide will teach you how to build and deploy your first remote MCP server t
2121

2222
- **MCP Hosts**: AI assistants (like [Claude](http://claude.ai) or [Cursor](http://cursor.com)), AI agents, or applications that need to access external capabilities.
2323
- **MCP Clients**: Clients embedded within the MCP hosts that connect to MCP servers and invoke tools. Each MCP client instance has a single connection to an MCP server.
24-
- **MCP Servers**: Applications that expose [tools](/agents/model-context-protocol/mcp-server/tools/), [prompts](https://modelcontextprotocol.io/docs/concepts/prompts), and [resources](https://modelcontextprotocol.io/docs/concepts/resources) that MCP clients can use.
24+
- **MCP Servers**: Applications that expose [tools](/agents/model-context-protocol/tools/), [prompts](https://modelcontextprotocol.io/docs/concepts/prompts), and [resources](https://modelcontextprotocol.io/docs/concepts/resources) that MCP clients can use.
2525

2626
#### Remote vs. local MCP connections
2727

2828
The MCP standard supports two modes of operation:
2929

30-
- **Remote MCP connections**: MCP clients connect to MCP servers over the Internet, establishing a [long-lived connection using HTTP and Server-Sent Events (SSE)](/agents/model-context-protocol/mcp-server/transport/), and authorizing the MCP client access to resources on the user's account using [OAuth](/agents/model-context-protocol/mcp-server/authorization/).
30+
- **Remote MCP connections**: MCP clients connect to MCP servers over the Internet, establishing a [long-lived connection using HTTP and Server-Sent Events (SSE)](/agents/model-context-protocol/transport/), and authorizing the MCP client access to resources on the user's account using [OAuth](/agents/model-context-protocol/authorization/).
3131
- **Local MCP connections**: MCP clients connect to MCP servers on the same machine, using [stdio](https://spec.modelcontextprotocol.io/specification/draft/basic/transports/#stdio) as a local transport method.
3232

3333
## Deploy your first MCP server
3434

35-
This guide will walk you through how to deploy an [example MCP server](https://github.com/cloudflare/ai/demos/remote-mcp-server) to your Cloudflare account. You will then customize this example to suit your needs.
35+
This guide will walk you through how to deploy an [example MCP server](https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server) to your Cloudflare account. You will then customize this example to suit your needs.
3636

37-
The link below will guide you through everything you need to do to deploy this [example MCP server](https://github.com/cloudflare/ai/demos/remote-mcp-server) to your Cloudflare account:
37+
The link below will guide you through everything you need to do to deploy this [example MCP server](https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server) to your Cloudflare account:
3838

39-
[![Deploy to Workers](https://deploy.workers.cloudflare.com/button)](https://dash.cloudflare.com/?to=/:account/workers-and-pages/create/deploy-to-workers&repository=https://github.com/cloudflare/ai/demos/remote-mcp-server)
39+
[![Deploy to Workers](https://deploy.workers.cloudflare.com/button)](https://dash.cloudflare.com/?to=/:account/workers-and-pages/create/deploy-to-workers&repository=https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server)
4040

41-
At the end of this process, you will have a new git repository on your GitHub or GitLab account for your MCP server, configured to automatically deploy Cloudflare each time you push a change or merge a pull request to the main branch of the repository. You can then clone this repository, [develop locally](/agents/model-context-protocol/mcp-server/getting-started/#local-development), and start writing code and building.
41+
At the end of this process, you will have a new git repository on your GitHub or GitLab account for your MCP server, configured to automatically deploy Cloudflare each time you push a change or merge a pull request to the main branch of the repository. You can then clone this repository, [develop locally](/agents/model-context-protocol/getting-started/#local-development), and start writing code and building.
4242

4343
Alternatively, you can use the command line as shown below to create a new MCP Server on your local machine.
4444

@@ -80,7 +80,7 @@ In the inspector, enter the URL of your MCP server, `http://localhost:8787/sse`,
8080

8181
![MCP inspector — where to enter the URL of your MCP server](~/assets/images/agents/mcp-inspector-enter-url.png)
8282

83-
You will be redirected to an example OAuth login page. Enter any username and password and click "Log in and approve" to continue. (you can add your own authentication and/or authorization provider to replace this. Refer to the [authorization](/agents/model-context-protocol/mcp-server/authorization/) section for details on how to do this.)
83+
You will be redirected to an example OAuth login page. Enter any username and password and click "Log in and approve" to continue. (you can add your own authentication and/or authorization provider to replace this. Refer to the [authorization](/agents/model-context-protocol/authorization/) section for details on how to do this.)
8484

8585
![MCP OAuth Login Page](~/assets/images/agents/mcp-demo-oauth-flow.png)
8686

@@ -277,18 +277,11 @@ wrangler secret put GITHUB_CLIENT_ID
277277
wrangler secret put GITHUB_CLIENT_SECRET
278278
```
279279

280-
#### Finally, deploy your MCP server
280+
#### Finally, connect to your MCP server
281281

282-
Run the following command to deploy your MCP server:
283-
284-
```sh
285-
npm run deploy
286-
```
287-
288-
You should now be able to connect to your MCP server using the MCP Inspector or other MCP clients ([as shown above](/agents/model-context-protocol/getting-started/#connect-your-mcp-server-to-claude-and-other-mcp-clients)) and allow the user to authenticate with GitHub.
282+
Now that you've added the ID and secret of your production OAuth app, you should now be able to connect to your MCP server running at `worker-name.account-name.workers.dev/sse` using the MCP inspector or ([other MCP clients](/agents/model-context-protocol/getting-started/#connect-your-mcp-server-to-claude-and-other-mcp-clients)), and authenticate with GitHub.
289283

290284
## Next steps
291285

292-
- Add [tools](/agents/model-context-protocol/mcp-server/tools/) to your MCP server.
293-
- Customize your MCP Server's [authentication and authorization](/agents/model-context-protocol/mcp-server/authorization/).
294-
- Try other [example MCP servers](/agents/model-context-protocol/mcp-server/examples/)
286+
- Add [tools](/agents/model-context-protocol/tools/) to your MCP server.
287+
- Customize your MCP Server's [authentication and authorization](/agents/model-context-protocol/authorization/).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ sidebar:
77

88
import { Render } from "~/components";
99

10-
Model Context Protocol (MCP) tools are functions that a [MCP Server](/agents/model-context-protocol/mcp-server) provides and MCP clients can call.
10+
Model Context Protocol (MCP) tools are functions that a [MCP Server](/agents/model-context-protocol) provides and MCP clients can call.
1111

1212
When you build MCP Servers with the `@cloudflare/model-context-protocol` package, you can define tools the [same way as shown in the `@modelcontextprotocol/typescript-sdk` package's examples](https://github.com/modelcontextprotocol/typescript-sdk?tab=readme-ov-file#tools).
1313

14-
For example, the following code from [this example MCP server](https://github.com/cloudflare/ai/demos/remote-mcp-server) defines a simple MCP server that adds two numbers together:
14+
For example, the following code from [this example MCP server](https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-server) defines a simple MCP server that adds two numbers together:
1515

1616
```ts title="src/index.ts"
1717
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The Model Context Protocol (MCP) specification defines [two standard transport m
1212
1. **stdio, communication over standard in and standard out** — designed for local MCP connections
1313
2. **HTTP with Server-Sent Events (SSE)** — designed for remote MCP connections
1414

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.
15+
The [remote MCP examples](/agents/model-context-protocol/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.
1616

1717
:::note
1818
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

Comments
 (0)