Create a new MCP Server
client.zeroTrust.access.aiControls.mcp.servers.create(ServerCreateParams { account_id, id, auth_type, 6 more } params, RequestOptionsoptions?): ServerCreateResponse { id, auth_type, hostname, 16 more }
POST/accounts/{account_id}/access/ai-controls/mcp/servers
Creates a new MCP portal for managing AI tool access through Cloudflare Access.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Create a new MCP Server
import Cloudflare from 'cloudflare';
const client = new Cloudflare({
apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});
const server = await client.zeroTrust.access.aiControls.mcp.servers.create({
account_id: 'a86a8f5c339544d7bdc89926de14fb8c',
id: 'my-mcp-server',
auth_type: 'unauthenticated',
hostname: 'https://example.com/mcp',
name: 'My MCP Server',
});
console.log(server.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",
"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",
"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
}