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/guides/build-mcp-server.mdx
+16-15Lines changed: 16 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
pcx_content_type: tutorial
3
-
title: Build an MCP Server
3
+
title: Build a Local MCP Server
4
4
sidebar:
5
5
order: 100
6
6
group:
@@ -19,7 +19,7 @@ import { Aside } from "@astrojs/starlight/components";
19
19
20
20
[Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) is an open standard that allows AI agents and assistants (like [Claude Desktop](https://claude.ai/download) or [Cursor](https://www.cursor.com/)) to interact with services directly. If you want users to access your service through an AI assistant, you can spin up an MCP server for your application.
21
21
22
-
### Building an MCP Server on Workers
22
+
### Building a local MCP Server on Workers
23
23
24
24
With Cloudflare Workers, you can turn any API or service into an MCP server with minimal setup.
25
25
@@ -36,11 +36,9 @@ Below we will run you through an example of building an MCP server that fetches
36
36
37
37
Follow these steps to create and deploy your own MCP server on Cloudflare Workers.
38
38
39
-
<Asidetype="note">
40
-
Remote MCP servers are not supported yet. The workers-mcp tooling creates a
41
-
local proxy that forwards requests to your Worker, allowing the server to be
42
-
used by an MCP client.
43
-
</Aside>
39
+
:::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.
41
+
:::
44
42
45
43
### Create a new Worker
46
44
@@ -63,8 +61,14 @@ cd my-mcp-worker
63
61
When you run the setup command, it will build your Worker using the configuration in your wrangler.toml or wrangler.jsonc file. By default, no additional configuration is needed, but if you have multiple Cloudflare accounts, you'll need to specify your account ID as shown below.
64
62
65
63
<WranglerConfig>
66
-
```toml name = "my-mcp-worker" main = "src/index.ts" compatibility_date =
67
-
"2025-03-03" account_id = "your-account-id"```
64
+
65
+
```toml
66
+
name = "my-mcp-worker"
67
+
main = "src/index.ts"
68
+
compatibility_date = "2025-03-03"
69
+
account_id = "your-account-id"
70
+
```
71
+
68
72
</WranglerConfig>
69
73
70
74
### Install the MCP tooling
@@ -224,11 +228,8 @@ For [Windsurf](https://modelcontextprotocol.io/clients#windsurf-editor) and othe
224
228
225
229
Make sure to replace the placeholders with your actual server name, URL, and project path.
226
230
227
-
### Coming soon
231
+
##Next steps
228
232
229
-
The Model Context Protocol spec is [actively evolving](https://github.com/modelcontextprotocol/specification/discussions)and we're working on expanding Cloudflare's MCP support. Here's what we're working on:
233
+
Now that you've built an MCP server that users can install and run locally, you should consider building a remote MCP server that supports _remote_ connections over the Internet.
230
234
231
-
-**Remote MCP support**: Connect to MCP servers directly without requiring a local proxy
232
-
-**Authentication**: OAuth support for secure MCP server connections
233
-
-**Real-time communication**: SSE (Server-Sent Events) and WebSocket support for persistent connections and stateful interactions between clients and servers
234
-
-**Extended capabilities**: Native support for more MCP protocol capabilities like [resources](https://modelcontextprotocol.io/docs/concepts/resources), [prompts](https://modelcontextprotocol.io/docs/concepts/prompts) and [sampling](https://modelcontextprotocol.io/docs/concepts/sampling)
235
+
Cloudflare provides [everything you need to start building a remote MCP server](/agents/model-context-protocol/getting-started), so that you're ready for when MCP clients become capable of connecting to remote servers.
You can build both local and remote MCP servers on Cloudflare.
11
+
12
+
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.
13
+
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.
15
+
16
+
### What is the Model Context Protocol (MCP)?
17
+
18
+
[Model Context Protocol (MCP)](https://modelcontextprotocol.io) is an open standard that connects AI systems with external applications. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various accessories, MCP provides a standardized way to connect AI agents to different services.
19
+
20
+
#### MCP Terminology
21
+
22
+
-**MCP Hosts**: AI assistants (like [Claude](http://claude.ai) or [Cursor](http://cursor.com)), AI agents, or applications that need to access external capabilities.
23
+
-**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.
25
+
26
+
#### Remote vs. local MCP connections
27
+
28
+
The MCP standard supports two modes of operation:
29
+
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/).
31
+
-**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.
32
+
10
33
## Deploy your first MCP server
11
34
12
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.
Copy file name to clipboardExpand all lines: src/content/docs/agents/model-context-protocol/index.mdx
+1-35Lines changed: 1 addition & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,39 +4,5 @@ pcx_content_type: navigation
4
4
sidebar:
5
5
order: 4
6
6
group:
7
-
hideIndex: false
7
+
hideIndex: true
8
8
---
9
-
10
-
# Deploy MCP Servers to Cloudflare
11
-
12
-
You can build and deploy MCP servers on Cloudflare, using the [`workers-mcp` package](https://github.com/cloudflare/workers-mcp), which provides an SDK for [authorization](/agents/model-context-protocol/mcp-server/authorization/), [transport](/agents/model-context-protocol/mcp-server/transport/), and [tool definition and discovery](/agents/model-context-protocol/mcp-server/tools/).
13
-
14
-
The [getting started section](/agents/model-context-protocol/mcp-server/getting-started/) will guide you to build and deploy your first MCP server to Cloudflare.
15
-
16
-
### What is the Model Context Protocol (MCP)?
17
-
18
-
[Model Context Protocol (MCP)](https://modelcontextprotocol.io) is an open standard that connects AI systems with external applications. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various accessories, MCP provides a standardized way to connect AI agents to different services.
19
-
20
-
#### MCP Terminology
21
-
22
-
-**MCP Hosts**: AI assistants (like [Claude](http://claude.ai) or [Cursor](http://cursor.com)), AI agents, or applications that need to access external capabilities.
23
-
-**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.
25
-
26
-
#### Remote vs. local MCP connections
27
-
28
-
The MCP standard supports two modes of operation:
29
-
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/).
31
-
-**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.
32
-
33
-
[`workers-mcp`](https://github.com/cloudflare/workers-mcp) is designed to support remote MCP connections. Remote MCP connections allow MCP clients that run in web browsers, mobile apps, and other environments outside of the end-user's machine to connect to your MCP server, such as [Claude.ai](https://www.anthropic.com/claude), and other AI agents.
34
-
35
-
### Why deploy your MCP server to Cloudflare?
36
-
37
-
- Authorization is [built-in](/agents/model-context-protocol/mcp-server/authorization/). Cloudflare handles the hard parts of the OAuth flow for you.
38
-
- Transport over HTTP with Server-Sent Events (SSE) is [built-in](/agents/model-context-protocol/mcp-server/transport/)
39
-
40
-
### Next step — deploy your first MCP server to Cloudflare
41
-
42
-
Go to [getting started](/agents/model-context-protocol/mcp-server/getting-started/) to learn how to build and deploy MCP servers to Cloudflare.
Copy file name to clipboardExpand all lines: src/content/docs/agents/model-context-protocol/tools.mdx
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,9 @@ import { Render } from "~/components";
9
9
10
10
Model Context Protocol (MCP) tools are functions that a [MCP Server](/agents/model-context-protocol/mcp-server) provides and MCP clients can call.
11
11
12
-
When you build MCP Servers with the `@cloudflare/model-context-protocol` package, you can define tools using the `@modelcontextprotocol/typescript-sdk` package.
12
+
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).
13
13
14
-
For example, the following code defines a simple MCP server that adds two numbers together:
15
-
16
-
{/* TODO: Reference code in Github, link to a runnable example, use Deploy to Workers button */}
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:
0 commit comments