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: README.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ Model Context Protocol (MCP) is a [new, standardized protocol](https://modelcont
4
4
5
5
This lets you use Claude Desktop, or any MCP Client, to use natural language to accomplish things on your Cloudflare account, e.g.:
6
6
7
-
*`List all the Cloudflare workers on my <some-email>@gmail.com account.`
8
-
*`Can you tell me about any potential issues on this particular worker '...'?`
7
+
-`List all the Cloudflare workers on my <some-email>@gmail.com account.`
8
+
-`Can you tell me about any potential issues on this particular worker '...'?`
9
9
10
10
## Access the remote MCP server from Claude Desktop
11
11
12
12
Open Claude Desktop and navigate to Settings -> Developer -> Edit Config. This opens the configuration file that controls which MCP servers Claude can access.
13
13
14
-
Replace the content with the following configuration. Once you restart Claude Desktop, a browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server. After you grant access, the tools will become available for you to use.
14
+
Replace the content with the following configuration. Once you restart Claude Desktop, a browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server. After you grant access, the tools will become available for you to use.
15
15
16
16
```
17
17
{
@@ -44,17 +44,20 @@ Ensure your Cloudflare account has the necessary subscription level for the feat
44
44
## Features
45
45
46
46
### Workers Management
47
+
47
48
-`worker_list`: List all Workers in your account
48
49
-`worker_get_worker`: Get a Worker's script content
49
50
50
51
### Workers Logs
52
+
51
53
-`worker_logs_by_worker_name`: Analyze recent logs for a Cloudflare Worker by worker name
52
54
-`worker_logs_by_ray_id`: Analyze recent logs across all workers for a specific request by Cloudflare Ray ID
53
55
-`worker_logs_keys`: Get available telemetry keys for a Cloudflare Worker
54
56
55
57
## Developing
56
58
57
59
### Apps
60
+
58
61
-[workers-observability](apps/workers-observability/): The Workers Observability MCP server
Copy file name to clipboardExpand all lines: apps/workers-observability/README.md
+31-16Lines changed: 31 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,44 +6,50 @@ You can deploy it to your own Cloudflare account, and after you create your own
6
6
7
7
You can use this as a reference example for how to integrate other OAuth providers with an MCP server deployed to Cloudflare, using the [`workers-oauth-provider` library](https://github.com/cloudflare/workers-oauth-provider).
8
8
9
-
The MCP server (powered by [Cloudflare Workers](https://developers.cloudflare.com/workers/)):
9
+
The MCP server (powered by [Cloudflare Workers](https://developers.cloudflare.com/workers/)):
10
10
11
-
* Acts as OAuth _Server_ to your MCP clients
12
-
* Acts as OAuth _Client_ to your _real_ OAuth server (in this case, Cloudflare)
11
+
- Acts as OAuth _Server_ to your MCP clients
12
+
- Acts as OAuth _Client_ to your _real_ OAuth server (in this case, Cloudflare)
13
13
14
14
## Getting Started
15
15
16
16
### For Production
17
+
17
18
- Set secrets via Wrangler
19
+
18
20
```bash
19
21
wrangler secret put CLOUDFLARE_CLIENT_ID
20
22
wrangler secret put CLOUDFLARE_CLIENT_SECRET
21
23
```
24
+
22
25
#### Set up a KV namespace
23
-
- Create the KV namespace:
24
-
`wrangler kv:namespace create "OAUTH_KV"`
26
+
27
+
- Create the KV namespace:
28
+
`wrangler kv:namespace create "OAUTH_KV"`
25
29
- Update the Wrangler file with the KV ID
26
30
27
31
#### Deploy & Test
28
-
Deploy the MCP server to make it available on your workers.dev domain
32
+
33
+
Deploy the MCP server to make it available on your workers.dev domain
29
34
` wrangler deploy`
30
35
31
-
Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector):
36
+
Test the remote server using [Inspector](https://modelcontextprotocol.io/docs/tools/inspector):
32
37
33
38
```
34
39
npx @modelcontextprotocol/inspector@latest
35
40
```
36
-
Enter `https://mcp-cloudflare-staging.<your-subdomain>.workers.dev/sse` and hit connect. Once you go through the authentication flow, you'll see the Tools working:
41
+
42
+
Enter `https://mcp-cloudflare-staging.<your-subdomain>.workers.dev/sse` and hit connect. Once you go through the authentication flow, you'll see the Tools working:
#### Access the remote MCP server from Claude Desktop
43
49
44
50
Open Claude Desktop and navigate to Settings -> Developer -> Edit Config. This opens the configuration file that controls which MCP servers Claude can access.
45
51
46
-
Replace the content with the following configuration. Once you restart Claude Desktop, a browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server. After you grant access, the tools will become available for you to use.
52
+
Replace the content with the following configuration. Once you restart Claude Desktop, a browser window will open showing your OAuth login page. Complete the authentication flow to grant Claude access to your MCP server. After you grant access, the tools will become available for you to use.
47
53
48
54
```
49
55
{
@@ -62,21 +68,25 @@ Replace the content with the following configuration. Once you restart Claude De
62
68
Once the Tools (under 🔨) show up in the interface, you can ask Claude to use them. 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.
63
69
64
70
### For Local Development
65
-
If you'd like to iterate and test your MCP server, you can do so in local development. This will require you to create another OAuth App on GitHub:
71
+
72
+
If you'd like to iterate and test your MCP server, you can do so in local development. This will require you to create another OAuth App on GitHub:
73
+
66
74
- For the Homepage URL, specify `http://localhost:8788`
67
75
- For the Authorization callback URL, specify `http://localhost:8788/callback`
68
-
- Note your Client ID and generate a Client secret.
69
-
- Create a `.dev.vars` file in your project root with:
76
+
- Note your Client ID and generate a Client secret.
77
+
- Create a `.dev.vars` file in your project root with:
Run the server locally to make it available at `http://localhost:8788`
77
87
`wrangler dev`
78
88
79
-
To test the local server, enter `http://localhost:8788/sse` into Inspector and hit connect. Once you follow the prompts, you'll be able to "List Tools".
89
+
To test the local server, enter `http://localhost:8788/sse` into Inspector and hit connect. Once you follow the prompts, you'll be able to "List Tools".
80
90
81
91
#### Using Claude and other MCP Clients
82
92
@@ -90,25 +100,30 @@ Note that while Cursor supports HTTP+SSE servers, it doesn't support authenticat
90
100
91
101
You can connect your MCP server to other MCP clients like Windsurf by opening the client's configuration file, adding the same JSON that was used for the Claude setup, and restarting the MCP client.
92
102
93
-
## How does it work?
103
+
## How does it work?
94
104
95
105
#### OAuth Provider
106
+
96
107
The OAuth Provider library serves as a complete OAuth 2.1 server implementation for Cloudflare Workers. It handles the complexities of the OAuth flow, including token issuance, validation, and management. In this project, it plays the dual role of:
97
108
98
109
- Authenticating MCP clients that connect to your server
99
110
- Managing the connection to GitHub's OAuth services
100
111
- Securely storing tokens and authentication state in KV storage
101
112
102
113
#### Durable MCP
114
+
103
115
Durable MCP extends the base MCP functionality with Cloudflare's Durable Objects, providing:
116
+
104
117
- Persistent state management for your MCP server
105
118
- Secure storage of authentication context between requests
106
119
- Access to authenticated user information via `this.props`
107
120
- Support for conditional tool availability based on user identity
108
121
109
122
#### MCP Remote
123
+
110
124
The MCP Remote library enables your server to expose tools that can be invoked by MCP clients like the Inspector. It:
125
+
111
126
- Defines the protocol for communication between clients and your server
112
127
- Provides a structured way to define tools
113
128
- Handles serialization and deserialization of requests and responses
114
-
- Maintains the Server-Sent Events (SSE) connection between clients and your server
129
+
- Maintains the Server-Sent Events (SSE) connection between clients and your server
0 commit comments