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
When you build an Agent that connects to OAuth-protected MCP servers (like GitHub, Slack, or Notion), your end users will need to authenticate before the Agent can access their data. This guide shows you how to implement OAuth flows so your users can authorize access seamlessly.
12
+
When you build an Agent that connects to OAuth-protected MCP servers (like Slack or Notion), your end users will need to authenticate before the Agent can access their data. This guide shows you how to implement OAuth flows so your users can authorize access seamlessly.
13
13
14
14
## Understanding the OAuth flow
15
15
@@ -18,26 +18,26 @@ When your Agent connects to an OAuth-protected MCP server, here's what happens:
18
18
1.**Your code calls**`addMcpServer()` with the server URL
19
19
2.**If OAuth is required**, it returns an `authUrl` instead of immediately connecting
20
20
3.**Your application presents** the `authUrl` to your user
21
-
4.**Your user authenticates** on the provider's site (GitHub, Slack, etc.)
21
+
4.**Your user authenticates** on the provider's site (Slack, etc.)
22
22
5.**The provider redirects** back to your Agent's callback URL with an authorization code
23
23
6.**Your Agent completes** the connection automatically
24
24
25
25
## Connect and initiate OAuth
26
26
27
-
When you connect to an OAuth-protected server (like GitHub), check if `authUrl` is returned. If present, automatically redirect your user to complete authorization:
27
+
When you connect to an OAuth-protected server (like Cloudflare Observability), check if `authUrl` is returned. If present, automatically redirect your user to complete authorization:
-**User canceled**: Closed OAuth window before completing authorization
290
-
-**Invalid credentials**: GitHub/Slack credentials were incorrect
290
+
-**Invalid credentials**: Slack credentials were incorrect
291
291
-**Permission denied**: User lacks required permissions (e.g., not a workspace admin)
292
292
-**Expired session**: OAuth session timed out
293
293
294
294
Failed connections remain in state until you remove them with `removeMcpServer(serverId)`.
295
295
296
296
## Complete example
297
297
298
-
This example demonstrates a complete GitHub OAuth integration. Users click "Connect GitHub", authorize in a popup window, and the connection becomes available. The Agent provides endpoints to connect, check status, and disconnect.
298
+
This example demonstrates a complete Cloudflare Observability OAuth integration. Users connect to Cloudflare Observability, authorize in a popup window, and the connection becomes available. The Agent provides endpoints to connect, check status, and disconnect.
299
299
300
300
:::note
301
301
@@ -310,10 +310,10 @@ import { Agent, type AgentNamespace, routeAgentRequest } from "agents";
0 commit comments