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
1. Add the Worker as an Access for SaaS application (OIDC) following the [Secure MCP servers guide](https://developers.cloudflare.com/cloudflare-one/access-controls/applications/http-apps/mcp-servers/saas-mcp/).
76
+
2. Record the SaaS application `id` (API: `GET /client/v4/accounts/:id/access/apps`).
77
+
3. For each internal HTTP service the MCP server should call, create or update the Access policy to include a `linked_app_token` rule referencing the SaaS app `id` ([docs](https://developers.cloudflare.com/cloudflare-one/access-controls/applications/http-apps/mcp-servers/linked-apps/)).
78
+
4. Update the self-hosted app configuration to require the new policy so tokens issued to the MCP portal are accepted.
79
+
5. Expose the MCP portal via **Access → AI Controls → MCP Portals** and associate it with the SaaS app and Access policies.
80
+
81
+
### Phase 3 – Deploy AI Gateway Control Plane
54
82
55
83
1. Create an AI Gateway (e.g., `m365-egress-gateway`).
56
84
2. Enable logging, caching, rate limiting, and DLP policies as required.
-**`path`**: Relative to Microsoft Graph base URL, allowing the gateway to centralise origin logic.
94
105
-**Metadata**: Supply user identifier, MCP tool name, and correlation IDs so that gateway logs
95
106
support incident response and analytics.
107
+
-**Gateway helpers**: Capture `env.AI.aiGatewayLogId` for the most recent call or invoke
108
+
`env.AI.gateway("m365-egress-gateway").patchLog(...)` / `getLog(...)` when you need to append
109
+
metadata or fetch request bodies ([binding methods](https://developers.cloudflare.com/ai-gateway/integrations/worker-binding-methods/)).
96
110
-**Error Handling**: The worker should translate non-2xx responses into structured MCP errors,
97
111
indicating whether the issue is policy (429/DLP) vs Graph-specific (403/401).
98
112
99
113
## 4. Access Awareness
100
114
115
+
Cloudflare Access for SaaS issues the OAuth token that the worker presents on each request. If the worker later needs to call internal HTTP applications, configure `linked_app_token` policies so the same token is honoured downstream ([docs](https://developers.cloudflare.com/cloudflare-one/access-controls/applications/http-apps/mcp-servers/linked-apps/)).
116
+
101
117
The worker can read Access-derived headers to enrich logs or enforce additional checks, for example:
102
118
103
119
```ts
@@ -119,6 +135,7 @@ This data can be injected into the AI Gateway metadata payload for end-to-end tr
119
135
## 6. Logging & Observability
120
136
121
137
-**AI Gateway**: Primary location for monitoring outbound traffic, rate limiting, and DLP violations.
138
+
- Dynamic routes expose provider/model decisions and quotas ([docs](https://developers.cloudflare.com/ai-gateway/features/dynamic-routing/)).
122
139
-**Workers Tail**: Use `wrangler tail --metadata` to surface request IDs and Access identity info.
123
140
-**Access Audit Logs**: Provide authentication history, device posture evaluation, and policy results.
0 commit comments