Skip to content

Commit 1b3c70a

Browse files
Add instructions for Oauth proxy (#20967)
* Update MCP server documentation with improved Claude Desktop connection section * Add page for how to test your remote mcp server * Apply suggestions from code review * Simplify the section that explains testing with Claude Desktop And link to newly created section in the docs --------- Co-authored-by: Brendan Irvine-Broque <[email protected]>
1 parent b458d62 commit 1b3c70a

File tree

2 files changed

+97
-1
lines changed

2 files changed

+97
-1
lines changed

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

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,29 @@ If you have already [connected a git repository](/workers/ci-cd/builds/) to the
100100

101101
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.
102102

103+
### Connect your remote MCP server to Claude and other MCP Clients via a local proxy
104+
105+
Now that your MCP server is running with OAuth authentication, 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 to test what an interaction with your OAuth-enabled MCP server will be like with a real MCP client.
106+
107+
Update your Claude Desktop configuration to point to the URL of your MCP server. You can use either the `localhost:8787/sse` URL, or the URL of your deployed MCP server:
108+
109+
```json
110+
{
111+
"mcpServers": {
112+
"math": {
113+
"command": "npx",
114+
"args": [
115+
"mcp-remote",
116+
"https://your-worker-name.your-account.workers.dev/sse"
117+
]
118+
}
119+
}
120+
}
121+
```
122+
Restart Claude Desktop and complete the authentication flow again. 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+
124+
Learn more about other ways of using remote MCP servers with MCP clients here in [this section](/agents/model-context-protocol/test-remote-mcp-server.mdx).
125+
103126
## Add Authentication
104127

105128
The example MCP server you just deployed above acts as an OAuth provider to MCP clients, handling authorization, but has a placeholder authentication flow. It lets you enter any username and password to log in, and doesn't actually authenticate you against any user database.
@@ -218,7 +241,7 @@ wrangler secret put GITHUB_CLIENT_SECRET
218241

219242
#### Finally, connect to your MCP server
220243

221-
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, and authenticate with GitHub.
244+
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.
222245

223246
## Next steps
224247

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
pcx_content_type: concept
3+
title: Testing your remote MCP Server
4+
sidebar:
5+
order: 6
6+
---
7+
8+
import { Render } from "~/components";
9+
10+
Remote, authorized connections are an evolving part of the [Model Context Protocol (MCP) specification](https://spec.modelcontextprotocol.io/specification/draft/basic/authorization/). Not all MCP clients support remote connections yet.
11+
12+
This guide will show you options for how to start using your remote MCP server with MCP clients that support remote connections.
13+
14+
## The Model Context Protocol (MCP) inspector
15+
16+
The [`@modelcontextprotocol/inspector` package](https://github.com/modelcontextprotocol/inspector) is a visual testing tool for MCP servers.
17+
18+
You can run it locally by running the following command:
19+
20+
```bash
21+
npx @modelcontextprotocol/inspector
22+
```
23+
24+
Then, enter the URL of your remote MCP server. You can use an MCP server running on your local machine on localhost, or you can use a remote MCP server running on Cloudflare.
25+
26+
![MCP inspector](~/assets/images/agents/mcp-inspector-enter-url.png)
27+
28+
Once you have authenticated, you will be redirected back to the inspector. You should see the "List Tools" button, which will list the tools that your MCP server exposes.
29+
30+
![MCP inspector — authenticated](~/assets/images/agents/mcp-inspector-authenticated.png)
31+
32+
## Connect your remote MCP server to Claude Desktop via a local proxy
33+
34+
Even though [Claude Desktop](https://claude.ai/download) doesn't yet support remote MCP clients, you can use the [`mcp-remote` local proxy](https://www.npmjs.com/package/mcp-remote) to connect it to your remote MCP server. This lets you to test what an interaction with your remote MCP server will be like with a real-world MCP client.
35+
36+
1. Open Claude Desktop and navigate to Settings -> Developer -> Edit Config. This opens the configuration file that controls which MCP servers Claude can access.
37+
2. Replace the content with a configuration like this:
38+
39+
```json
40+
{
41+
"mcpServers": {
42+
"math": {
43+
"command": "npx",
44+
"args": ["mcp-remote", "http://my-mcp-server.my-account.workers.dev/sse"]
45+
}
46+
}
47+
}
48+
```
49+
50+
This tells Claude to communicate with your MCP server running at `http://localhost:8787/sse`.
51+
52+
3. Save the file and restart Claude Desktop (command/ctrl + R). When Claude restarts, a browser window will open showing your OAuth login page. Complete the authorization flow to grant Claude access to your MCP server.
53+
54+
Once authenticated, you'll be able to see your tools by clicking the tools icon in the bottom right corner of Claude's interface.
55+
56+
## Connect your remote MCP server to Cursor
57+
58+
To connect [Cursor](https://www.cursor.com/) with your remote MCP server, choose `Type`: "Command" and in the `Command` field, combine the command and args fields into one (e.g.`npx mcp-remote https://your-worker-name.your-account.workers.dev/sse`).
59+
60+
## Connect your remote MCP server to Windsurf
61+
62+
You can connect your remote MCP server to [Windsurf](https://codeium.com/windsurf) by editing the [`mcp_config.json` file](https://docs.codeium.com/windsurf/mcp), and adding the following configuration:
63+
64+
```json
65+
{
66+
"mcpServers": {
67+
"math": {
68+
"command": "npx",
69+
"args": ["mcp-remote", "http://my-mcp-server.my-account.workers.dev/sse"]
70+
}
71+
}
72+
}
73+
```

0 commit comments

Comments
 (0)