38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
|
|
"""
|
||
|
|
Cloudflare Code Mode MCP Server - Configuration
|
||
|
|
|
||
|
|
Remote MCP server that exposes the entire Cloudflare API through just two tools:
|
||
|
|
- search(): Query the OpenAPI spec to find endpoints
|
||
|
|
- execute(): Run JavaScript against the Cloudflare API
|
||
|
|
|
||
|
|
Environment variables:
|
||
|
|
CLOUDFLARE_API_TOKEN - Your Cloudflare API token (required)
|
||
|
|
CLOUDFLARE_MCP_URL - Remote MCP server URL (default: https://mcp.cloudflare.com/mcp)
|
||
|
|
CLOUDFLARE_MCP_ENABLED - Enable/disable integration (default: true)
|
||
|
|
"""
|
||
|
|
|
||
|
|
import os
|
||
|
|
|
||
|
|
|
||
|
|
# ---------------------------------------------------------------------------
|
||
|
|
# Connection settings
|
||
|
|
# ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# Cloudflare API token — create one at https://dash.cloudflare.com/profile/api-tokens
|
||
|
|
# Recommended permissions: Account Resources (Read) + whatever you need
|
||
|
|
CLOUDFLARE_API_TOKEN = os.getenv("CLOUDFLARE_API_TOKEN", "")
|
||
|
|
|
||
|
|
# The remote MCP server URL (Cloudflare runs this as a Worker)
|
||
|
|
CLOUDFLARE_MCP_URL = os.getenv(
|
||
|
|
"CLOUDFLARE_MCP_URL", "https://mcp.cloudflare.com/mcp"
|
||
|
|
)
|
||
|
|
|
||
|
|
# ---------------------------------------------------------------------------
|
||
|
|
# Feature flag
|
||
|
|
# ---------------------------------------------------------------------------
|
||
|
|
|
||
|
|
# Set to "false" to disable the integration without removing config
|
||
|
|
CLOUDFLARE_MCP_ENABLED = os.getenv(
|
||
|
|
"CLOUDFLARE_MCP_ENABLED", "true"
|
||
|
|
).lower() in ("true", "1", "yes")
|