Skip to content

Commit 27b2e09

Browse files
committed
update authless example
1 parent 826a455 commit 27b2e09

File tree

2 files changed

+76
-56
lines changed

2 files changed

+76
-56
lines changed

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

Lines changed: 75 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -9,100 +9,120 @@ sidebar:
99

1010
import { Details, Render, PackageManagers } from "~/components";
1111

12-
## Deploy your first MCP server
13-
1412
This guide will show you how to deploy your own remote MCP server on Cloudflare using [Streamable HTTP transport](/agents/model-context-protocol/transport/), the current MCP specification standard. You have two options:
1513

1614
- **Without authentication** — anyone can connect and use the server (no login required).
1715
- **With [authentication and authorization](/agents/guides/remote-mcp-server/#add-authentication)** — users sign in before accessing tools, and you can control which tools an agent can call based on the user's permissions.
1816

17+
## Deploy your first MCP server
18+
1919
You can start by deploying a [public MCP server](https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authless) without authentication, then add user authentication and scoped authorization later. If you already know your server will require authentication, you can skip ahead to the [next section](/agents/guides/remote-mcp-server/#add-authentication).
2020

21-
The button 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-authless) to your Cloudflare account:
21+
### Deploy using a quickstart button
22+
23+
The button below will guide you through everything you need to do to deploy an [example MCP server](https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authless) to your Cloudflare account:
2224

2325
[![Deploy to Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/ai/tree/main/demos/remote-mcp-authless)
2426

25-
Once deployed, this server will be live at your workers.dev subdomain (e.g. remote-mcp-server-authless.your-account.workers.dev/mcp). You can connect to it immediately using the [AI Playground](https://playground.ai.cloudflare.com/) (a remote MCP client), [MCP inspector](https://github.com/modelcontextprotocol/inspector) or [other MCP clients](/agents/guides/remote-mcp-server/#connect-your-remote-mcp-server-to-claude-and-other-mcp-clients-via-a-local-proxy). Then, once you're ready, you can customize the MCP server and add your own [tools](/agents/model-context-protocol/tools/).
27+
Once deployed, this server will be live at your `workers.dev` subdomain (for example, `remote-mcp-server-authless.your-account.workers.dev/mcp`). You can connect to it immediately using the [AI Playground](https://playground.ai.cloudflare.com/) (a remote MCP client), [MCP inspector](https://github.com/modelcontextprotocol/inspector) or [other MCP clients](/agents/guides/remote-mcp-server/#connect-your-remote-mcp-server-to-claude-and-other-mcp-clients-via-a-local-proxy).
2628

27-
If you're using the "Deploy to Cloudflare" button, a new git repository will be set up on your GitHub or GitLab account for your MCP server, configured to automatically deploy to 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/guides/remote-mcp-server/#local-development), and start writing code and building.
29+
If you are using the **Deploy to Cloudflare** button, a new git repository will be set up on your GitHub or GitLab account for your MCP server, configured to automatically deploy to Cloudflare each time you push a change or merge a pull request to the main branch of the repository. You can clone this repository, [develop locally](/agents/guides/remote-mcp-server/#local-development), and start customizing the MCP server with your own [tools](/agents/model-context-protocol/tools/).
2830

29-
### Set up and deploy your MCP server via CLI
31+
### Deploy using the CLI
3032

31-
Alternatively, you can use the command line as shown below to create a new MCP Server on your local machine.
33+
You can use the [Wrangler CLI](/workers/wrangler) to create a new MCP Server on your local machine and deploy it to Cloudflare.
3234

33-
<PackageManagers
34-
type="create"
35-
pkg="cloudflare@latest"
36-
args={"my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless"}
37-
/>
35+
1. Open a terminal and run the following command:
3836

39-
Now, you have the MCP server setup, with dependencies installed. Move into that project folder:
37+
<PackageManagers
38+
type="create"
39+
pkg="cloudflare@latest"
40+
args={"remote-mcp-server-authless --template=cloudflare/ai/demos/remote-mcp-authless"}
41+
/>
4042

41-
```sh
42-
cd my-mcp-server
43-
```
43+
Now, you have the MCP server setup, with dependencies installed.
4444

45-
#### Local development
45+
2. Move into the project folder:
4646

47-
In the directory of your new project, run the following command to start the development server:
47+
```sh
48+
cd remote-mcp-server-authless
49+
```
4850

49-
```sh
50-
npm start
51-
```
51+
3. In the directory of your new project, run the following command to start the development server:
5252

53-
Your MCP server is now running on `http://localhost:8788/mcp`.
53+
```sh
54+
npm start
55+
```
5456

55-
In a new terminal, run the [MCP inspector](https://github.com/modelcontextprotocol/inspector). The MCP inspector is an interactive MCP client that allows you to connect to your MCP server and invoke tools from a web browser.
57+
```sh output
58+
⎔ Starting local server...
59+
[wrangler:info] Ready on http://localhost:8788
60+
```
5661

57-
```sh
58-
npx @modelcontextprotocol/inspector@latest
59-
```
62+
Your MCP server is now running on `http://localhost:8788/mcp`.
6063

61-
Open the MCP inspector in your web browser:
64+
4. To test the server locally:
65+
1. In a new terminal, run the [MCP inspector](https://github.com/modelcontextprotocol/inspector). The MCP inspector is an interactive MCP client that allows you to connect to your MCP server and invoke tools from a web browser.
6266

63-
```sh
64-
open http://localhost:5173
65-
```
67+
```sh
68+
npx @modelcontextprotocol/inspector@latest
69+
```
6670

67-
In the inspector, enter the URL of your MCP server, `http://localhost:8788/mcp`, and click **Connect**. You should see the "List Tools" button, which will list the tools that your MCP server exposes.
71+
2. Open the MCP inspector in your web browser:
6872

69-
![MCP inspector — authenticated](~/assets/images/agents/mcp-inspector-authenticated.png)
73+
```sh
74+
open http://localhost:5173
75+
```
7076

71-
#### Deploy your MCP server
77+
3. In the MCP inspector, enter the URL of your MCP server: `http://localhost:8788/mcp`, and select **Connect**. Select **List Tools** to show the tools that your MCP server exposes.
7278

73-
You can deploy your MCP server to Cloudflare using the following [Wrangler CLI command](/workers/wrangler) within the example project:
79+
5. You can now deploy your MCP server to Cloudflare. From your project directory, run:
7480

75-
```sh
76-
npx wrangler@latest deploy
77-
```
81+
```sh
82+
npx wrangler@latest deploy
83+
```
7884

79-
If you have already [connected a git repository](/workers/ci-cd/builds/) to the Worker with your MCP server, you can deploy your MCP server by pushing a change or merging a pull request to the main branch of the repository.
85+
If you have already [connected a git repository](/workers/ci-cd/builds/) to the Worker with your MCP server, you can deploy your MCP server by pushing a change or merging a pull request to the main branch of the repository.
8086

81-
After deploying, take the URL of your deployed MCP server, and enter it in the MCP inspector running on `http://localhost:5173`. You now have a remote MCP server, deployed to Cloudflare, that MCP clients can connect to.
87+
The MCP server will be deployed to your `*.workers.dev` subdomain at `remote-mcp-server-authless.your-account.workers.dev/mcp`.
8288

83-
### Connect your Remote MCP server to Claude and other MCP Clients via a local proxy
8489

85-
Now that your MCP server is running, you can use the [`mcp-remote` local proxy](https://www.npmjs.com/package/mcp-remote) to connect Claude Desktop or other MCP clients to it — even though these tools aren't yet _remote_ MCP clients, and don't support remote transport or authorization on the client side. This lets you test what an interaction with your MCP server will be like with a real MCP client.
90+
6. To test the remote MCP server, take the URL of your deployed MCP server (`remote-mcp-server-authless.your-account.workers.dev/mcp`) and enter it in the MCP inspector running on `http://localhost:5173`.
8691

87-
Update your Claude Desktop configuration to point to the URL of your MCP server. You can use either the `localhost:8788/mcp` URL, or the URL of your deployed MCP server:
92+
You now have a remote MCP server that MCP clients can connect to.
8893

89-
```json
90-
{
91-
"mcpServers": {
92-
"math": {
93-
"command": "npx",
94-
"args": [
95-
"mcp-remote",
96-
"https://your-worker-name.your-account.workers.dev/mcp"
97-
]
94+
### Connect from an MCP client via a local proxy
95+
96+
Now that your remote MCP server is running, you can use the [`mcp-remote` local proxy](https://www.npmjs.com/package/mcp-remote) to connect Claude Desktop or other MCP clients to it — even if your MCP client does not support remote transport or authorization on the client side. This lets you test what an interaction with your remote MCP server will be like with a real MCP client.
97+
98+
For example, to connect from Claude Desktop:
99+
100+
1. Update your Claude Desktop configuration to point to the URL of your MCP server:
101+
102+
```json
103+
{
104+
"mcpServers": {
105+
"math": {
106+
"command": "npx",
107+
"args": [
108+
"mcp-remote",
109+
"https://remote-mcp-server-authless.your-account.workers.dev/mcp"
110+
]
111+
}
98112
}
99113
}
100-
}
101-
```
114+
```
115+
116+
2. Restart Claude Desktop to load the MCP Server. Once this is done, Claude will be able to make calls to your remote MCP server.
117+
118+
3. To test, ask Claude to use one of your tools. For example:
119+
```txt
120+
Could you use the math tool to add 23 and 19?
121+
```
102122

103-
Restart Claude Desktop after updating your config file to load the MCP Server. Once this is done, Claude will be able to make calls to your remote MCP server. You can test this by asking Claude to use one of your tools. For example: "Could you use the math tool to add 23 and 19?". Claude should invoke the tool and show the result generated by the MCP server.
123+
Claude should invoke the tool and show the result generated by the remote MCP server.
104124

105-
Learn more about other ways of using remote MCP servers with MCP clients here in [this section](/agents/guides/test-remote-mcp-server).
125+
To learn how to use remote MCP servers with other MCP clients, refer to [Test a Remote MCP Server](/agents/guides/test-remote-mcp-server).
106126

107127
## Add Authentication
108128

src/content/docs/cloudflare-one/access-controls/ai-controls/saas-mcp.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
GlossaryTooltip,
1414
Tabs,
1515
TabItem,
16-
APIRequest,
16+
APIRequest
1717
} from "~/components";
1818

1919
You can secure [Model Context Protocol (MCP) servers](https://www.cloudflare.com/learning/ai/what-is-model-context-protocol-mcp/) by using Cloudflare Access as an OAuth Single Sign-On (SSO) provider.

0 commit comments

Comments
 (0)