MCP server portals
Last updated Oct 26, 2026 An MCP server portal centralizes multiple Model Context Protocol (MCP) servers ↗︎ onto a single HTTP endpoint.

This guide explains how to add MCP servers to Cloudflare Access, create an MCP portal with customized tools and policies, and connect users to the portal using an MCP client.
Key features
MCP server portals provide the following capabilities:
- Streamlined access to multiple MCP servers: MCP server portals support both unauthenticated MCP servers and MCP servers secured using OAuth (for example, via Access for SaaS or a third-party OAuth provider). Users log in to the portal URL through Cloudflare Access and are prompted to authenticate separately to each server that requires OAuth.
- MCP protocol compatibility: The portal supports stateless MCP
2026-07-28and earlier 2025 Streamable HTTP clients and servers. The portal selects the supported protocol for each connection without requiring protocol settings. - Customized tools per portal: Admins can tailor an MCP portal to a particular use case by choosing the specific tools and prompt templates that they want to make available to users through the portal. This allows users to access a curated set of tools and prompts — the less external context exposed to the AI model, the better the AI responses tend to be.
- Tool and prompt aliases: Admins can rename tools and prompts and edit their descriptions at the portal or server level without modifying the upstream MCP server. Aliases help end users find the right tool and help AI agents select the correct one.
- Context optimization: Portals support query parameter options that reduce context window usage by minimizing or hiding tool definitions. Refer to Optimize context for details.
- Non-browser client support: MCP clients authenticate to the portal using a standard OAuth 2.0 authorization code flow via managed OAuth. This managed OAuth configuration applies to the portal's Access application. It is separate from upstream OAuth used by individual MCP servers in the portal. Non-browser clients receive a
401response with aWWW-Authenticateheader pointing to Access's OAuth discovery endpoints, rather than a browser redirect. You can also connect using Access service tokens for machine-to-machine access. - Code Mode: Code Mode collapses all upstream tools into two tools for search and code execution. The AI agent writes JavaScript that calls typed methods for each tool. The code runs in an isolated Dynamic Worker environment. Admins can control whether Code Mode is unavailable, optional, on by default, or required. Refer to Code Mode for configuration and connection instructions.
- Observability: Once the user's AI agent is connected to the portal, Cloudflare Access logs the individual requests made using the tools in the portal. You can optionally route portal traffic through Cloudflare Gateway for richer HTTP logging and data loss prevention (DLP) scanning.
How it works
The following diagram shows how requests flow through an MCP server portal.

- An MCP client connects to the portal URL and receives a
401response with OAuth discovery metadata. - The user authenticates through Cloudflare Access via their identity provider or uses service token headers.
- Access validates the user's identity, and the portal returns the tools available from enabled upstream servers.
- When the user calls a tool, the portal identifies the target server from the tool namespace, attaches the appropriate credentials, and proxies the request. If Gateway routing is turned on, the request passes through Cloudflare Gateway for HTTP logging and DLP inspection.
- The upstream server processes the request and returns a response through the same path.
For servers that use Dynamic Client Registration (DCR), background synchronization of tools and prompts runs approximately every two hours using admin credentials. When server-level Gateway routing is turned on, DCR and background synchronization route through Gateway.
Transport
The portal accepts stateless MCP 2026-07-28 ↗︎ and earlier 2025 Streamable HTTP clients at its /mcp endpoint. The portal selects the protocol from each request. You do not need to configure a protocol version.
The portal connects to upstream MCP servers using Streamable HTTP ↗︎ or SSE ↗︎ transport. For Streamable HTTP servers, the portal checks for MCP 2026-07-28 support and uses the stateless protocol when available. If the upstream server does not support it, the portal falls back to the 2025 handshake on the same connection. SSE connections always use the legacy protocol.
Client and upstream protocol selection are independent. For example, a 2025 client can connect through a portal to a stateless upstream server. A stateless client can also connect to a legacy upstream server.
You do not need to specify which transport your upstream server uses. The portal automatically detects the correct transport by trying multiple connection strategies in order:
| Upstream URL pattern | Connection strategies (in order) |
|---|---|
Ends in /mcp |
Streamable HTTP only |
Ends in /sse |
SSE (or Streamable HTTP if Gateway routing is turned on) |
| All other URLs | Streamable HTTP on original URL, then SSE on original URL, then Streamable HTTP on {url}/mcp, then SSE on {url}/sse |
If a connection attempt returns a 404, 405, or 406 error, the portal falls back to the next strategy. All other errors stop the connection attempt.
Client identity header
When a portal sends a request to an upstream MCP server, it adds an X-Forwarded-User-Agent header that identifies the downstream MCP client.
The portal selects the header value in the following order:
| Source | Behavior |
|---|---|
clientInfo.name |
Preferred when the MCP client sends a valid value. The portal removes the (via mcp-remote <VERSION>) suffix before forwarding the name. |
HTTP User-Agent |
Used when valid MCP client information is unavailable. |
| Neither is present | The portal omits X-Forwarded-User-Agent and continues the request. |
An upstream server can record this header in logs or use it for diagnostics. Do not use it for authentication or authorization because the MCP client controls the value.
Built-in portal tools
Every portal exposes the following built-in tools to MCP clients, in addition to the upstream server tools:
| Tool | Description |
|---|---|
portal_list_servers |
Lists all available upstream servers with their ID, name, and whether they are currently turned on. |
portal_toggle_servers |
Opens a URL-based server selection page where you can turn servers on or off. |
portal_toggle_single_server |
Turns a single server on or off by server ID, without leaving the MCP client. |
When context optimization is turned on, additional tools are exposed depending on the mode:
| Mode | Additional tools |
|---|---|
minimize_tools |
portal_query_tools — Search tools by regex pattern and return full definitions. |
search_and_execute |
portal_query_tools and portal_execute — Search tools and execute them via proxy. |
Session lifecycle
MCP 2026-07-28 requests are stateless and do not create an MCP protocol session. The portal retains authentication, server selection, and upstream OAuth state for the user's portal authorization grant.
Earlier 2025 clients create a session that persists until the user disconnects or the session expires after 24 hours of inactivity.
Users can turn individual servers on or off without disconnecting. For stateless requests, server toggles apply to every request that uses the same portal authorization grant. For legacy clients, toggles are scoped to the MCP session. Toggles do not affect other users.
Naming
MCP server portals were previously referred to as Agents Gateway in some contexts. The API paths, Terraform resources, and internal codebases may still use agents_gateway or agw prefixes. The product name is MCP server portals and the dashboard navigation is MCP Portals.
Prerequisites
- An active domain on Cloudflare for the portal URL that uses either a full setup or a partial (
CNAME) setup - An identity provider configured on Cloudflare Zero Trust
Add an MCP server
Add individual MCP servers to Cloudflare Access to bring them under centralized management.
To add an MCP server:
- In the Cloudflare dashboard ↗︎, go to Zero Trust > Access controls > MCP Portals.
- Go to the MCP servers tab.
- Select Add MCP server.
- Enter any name for the server.
- (Optional) Enter a custom string for the Server ID.
- In HTTP URL, enter the full URL of your MCP server. For example, if you want to add the Cloudflare Documentation MCP server ↗︎, enter
https://docs.mcp.cloudflare.com/mcp. - Add Access policies to show or hide the server in an MCP server portal. The MCP server link will only appear in the portal for users who match an Allow policy. Users who do not pass an Allow policy will not see this server through any portals.
Caution
Blocked users can still connect to the server (and bypass your Access policies) by using its direct URL. If you want to enforce authentication through Cloudflare Access, configure Access as the server's OAuth provider. 8. Under OAuth credentials, select Automatic (recommended) to use DCR. Add the dashboard callback URL to the OAuth provider's redirect URI allowlist. 9. Select Save and connect server. 10. If the MCP server supports OAuth, you will be redirected to log in to your OAuth provider. You can log in to any account on the MCP server. The account used to authenticate will serve as the admin credential for that MCP server. You can configure an MCP portal to use this admin credential to make requests.
Cloudflare Access will validate the server connection and retrieve a list of prompts and tools. Once the server is successfully connected, the server status will change to Ready. You can now add the MCP server to an MCP server portal.
Connect a private MCP server
MCP server portals can connect to an MCP server available only on your private network. The MCP server URL, OAuth protected resource metadata ↗︎, and DCR endpoint can use a private hostname when server-level Gateway routing is turned on. OAuth authorization and token endpoints must be accessible on the public Internet.
Before you add the server, connect its network to Cloudflare. Use Cloudflare Tunnel or another Cloudflare One connector. Configure a private hostname route or CIDR route for the server.
To add the private MCP server:
- Follow the steps in Add an MCP server, and enter the private URL in HTTP URL.
- Turn on Route traffic through Cloudflare Gateway. Private server registration and capability synchronization require this setting.
- Select Save and connect server.
- Complete the upstream OAuth flow, if required.
- Wait for the server status to change to Ready. You can then add the server to a portal.
Configure manual OAuth credentials
Use manual OAuth credentials when the upstream provider does not support OAuth Dynamic Client Registration ↗︎. This flow uses an OAuth application that you register with the upstream provider.
- Add the MCP server with OAuth as its authentication method.
- In Zero Trust > Access controls > MCP Portals, go to the MCP servers tab.
- Find the server, select the three dots > Edit, and go to Authentication.
- Under OAuth credentials, select Manual credentials.
- Copy the displayed Redirect URI to register at the upstream provider. Add it to the OAuth application's allowed redirect URIs. For more information, refer to Shared Cloudflare callback URL.
- Select Discover OAuth endpoints. If discovery fails, expand Show OAuth endpoints (advanced) and enter the Authorization endpoint and Token endpoint. You can also enter an optional Revocation endpoint and Issuer.
- Enter the OAuth application's Client ID and Client secret.
- (Optional) Enter the space-separated Scope values requested from users.
- (Optional) Enter the Token endpoint auth method expected by the provider. Supported values are
client_secret_postandclient_secret_basic. - Select Save server.
Cloudflare stores the client secret encrypted and does not return it through the dashboard or API. When editing the server, leave Client secret blank to keep the existing value. To rotate the secret, create or activate the replacement at the upstream provider, enter the new value, and save the server.
