Skip to content
Start here

List MCP Servers

zero_trust.access.ai_controls.mcp.servers.list(ServerListParams**kwargs) -> SyncV4PagePaginationArray[ServerListResponse]
GET/accounts/{account_id}/access/ai-controls/mcp/servers

Lists all MCP portals configured for the account.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
MCP Portals WriteMCP Portals Read
ParametersExpand Collapse
account_id: str
page: Optional[int]
minimum1
per_page: Optional[int]
maximum100
minimum1
ReturnsExpand Collapse
class ServerListResponse:
id: str

server id

maxLength32
minLength1
auth_type: Literal["oauth", "bearer", "unauthenticated"]
One of the following:
"oauth"
"bearer"
"unauthenticated"
hostname: str
formaturi
name: str
maxLength350
prompts: List[Dict[str, object]]
tools: List[Dict[str, object]]
created_at: Optional[datetime]
formatdate-time
created_by: Optional[str]
description: Optional[str]
maxLength512
error: Optional[str]
error_details: Optional[ErrorDetails]
cause: Optional[str]

Underlying error message

is_upstream: Optional[bool]

True = MCP server returned an error. False = couldn’t reach the server

mcp_code: Optional[float]

MCP protocol error code

retryable: Optional[bool]

Whether the error is transient and worth retrying

status_code: Optional[float]

HTTP status code from the server

is_shared_oauth_callback_enabled: Optional[bool]

When true, the gateway worker uses the shared Cloudflare-owned OAuth callback endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the customer portal hostname. Defaults to false (off); opt in per server by setting true. Effective behavior is gated by the gateway worker’s per-env rollout mode KV key.

last_successful_sync: Optional[datetime]
formatdate-time
last_synced: Optional[datetime]
formatdate-time
modified_at: Optional[datetime]
formatdate-time
modified_by: Optional[str]
secure_web_gateway: Optional[bool]

Route outbound traffic to this MCP server through Zero Trust Secure Web Gateway

status: Optional[str]
updated_prompts: Optional[List[UpdatedPrompt]]
name: str
alias: Optional[str]
maxLength40
description: Optional[str]
enabled: Optional[bool]
updated_tools: Optional[List[UpdatedTool]]
name: str
alias: Optional[str]
maxLength40
description: Optional[str]
enabled: Optional[bool]

List MCP Servers

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
page = client.zero_trust.access.ai_controls.mcp.servers.list(
    account_id="a86a8f5c339544d7bdc89926de14fb8c",
)
page = page.result[0]
print(page.id)
{
  "result": [
    {
      "id": "my-mcp-server",
      "auth_type": "unauthenticated",
      "hostname": "https://example.com/mcp",
      "name": "My MCP Server",
      "prompts": [
        {
          "foo": "bar"
        }
      ],
      "tools": [
        {
          "foo": "bar"
        }
      ],
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "description": "This is one remote mcp server",
      "error": "error",
      "error_details": {
        "cause": "cause",
        "is_upstream": true,
        "mcp_code": 0,
        "retryable": true,
        "status_code": 0
      },
      "is_shared_oauth_callback_enabled": true,
      "last_successful_sync": "2019-12-27T18:11:19.117Z",
      "last_synced": "2019-12-27T18:11:19.117Z",
      "modified_at": "2019-12-27T18:11:19.117Z",
      "modified_by": "modified_by",
      "secure_web_gateway": false,
      "status": "status",
      "updated_prompts": [
        {
          "name": "name",
          "alias": "my-custom-alias",
          "description": "description",
          "enabled": true
        }
      ],
      "updated_tools": [
        {
          "name": "name",
          "alias": "my-custom-alias",
          "description": "description",
          "enabled": true
        }
      ]
    }
  ],
  "success": true
}
Returns Examples
{
  "result": [
    {
      "id": "my-mcp-server",
      "auth_type": "unauthenticated",
      "hostname": "https://example.com/mcp",
      "name": "My MCP Server",
      "prompts": [
        {
          "foo": "bar"
        }
      ],
      "tools": [
        {
          "foo": "bar"
        }
      ],
      "created_at": "2019-12-27T18:11:19.117Z",
      "created_by": "created_by",
      "description": "This is one remote mcp server",
      "error": "error",
      "error_details": {
        "cause": "cause",
        "is_upstream": true,
        "mcp_code": 0,
        "retryable": true,
        "status_code": 0
      },
      "is_shared_oauth_callback_enabled": true,
      "last_successful_sync": "2019-12-27T18:11:19.117Z",
      "last_synced": "2019-12-27T18:11:19.117Z",
      "modified_at": "2019-12-27T18:11:19.117Z",
      "modified_by": "modified_by",
      "secure_web_gateway": false,
      "status": "status",
      "updated_prompts": [
        {
          "name": "name",
          "alias": "my-custom-alias",
          "description": "description",
          "enabled": true
        }
      ],
      "updated_tools": [
        {
          "name": "name",
          "alias": "my-custom-alias",
          "description": "description",
          "enabled": true
        }
      ]
    }
  ],
  "success": true
}