Cloudflare Pages Integration with OIP
Cloudflare Pages integration defines the deployment of static web assets and serverless functions as an Object Invocation Protocol (OIP) work object. This object specifies the source repository, build configuration, and environment variables for a Cloudflare Pages project. Invocation of this object via /api/dispatch initiates a deployment process. The resulting receipt confirms the successful provisioning and update of the Cloudflare Pages site. Conformant behavior ensures the deployed assets are accessible at the specified Uniform Resource Locator (URL).
Cloudflare Pages Integration Definition
Cloudflare Pages integration is an OIP work object that orchestrates the deployment of web projects to Cloudflare Pages. This object encapsulates the necessary configuration for a Cloudflare Pages site, including repository details, build commands, and environment variables. The /api/dispatch route processes this object, triggering the Cloudflare Pages deployment pipeline. A successful deployment yields a receipt, proving the site's update or creation. The conformant behavior is the public availability of the deployed application at its designated URL.
Cloudflare Pages Deployment Object
The Cloudflare Pages deployment object is a JavaScript Object Notation (JSON) structure submitted to the OIP Application Programming Interface (API) for deploying a web project. This object specifies the key as oip-cloudflare-pages-deploy and includes a body containing deployment parameters. The body includes projectName, repositoryUrl, branch, buildCommand, publishDirectory, and environmentVariables. The oip-cloudflare-pages-deploy object is invoked via POST /api/dispatch {key: "oip-cloudflare-pages-deploy", body: {...}}.
{
"key": "oip-cloudflare-pages-deploy",
"body": {
"projectName": "my-oip-app",
"repositoryUrl": "https://github.com/user/my-oip-app.git",
"branch": "main",
"buildCommand": "npm run build",
"publishDirectory": "dist",
"environmentVariables": {
"OIP_API_URL": "https://miscsubjects.com/api/dispatch"
}
}
}Invocation Mechanism
The invocation mechanism for Cloudflare Pages deployment utilizes the OIP /api/dispatch route. A client sends an HTTP POST request to https://miscsubjects.com/api/dispatch with a JSON payload representing the oip-cloudflare-pages-deploy object. This action appends the invocation request to the OIP ledger. The OIP system then processes the request, interacting with the Cloudflare Pages API to initiate the deployment. The invocation returns a receipt identifier (inv_ID) for tracking the operation's status.
Deployment Receipt
A deployment receipt is a JSON document returned by the OIP system, proving the successful initiation or completion of a Cloudflare Pages deployment. This receipt is retrieved by querying /api/dispatch?receipt=inv_ID where inv_ID is the identifier received from the initial invocation. The receipt includes invocationId, status, deploymentId, siteName, and url. The status field indicates the state of the deployment process, such as initiated or completed. The url field specifies the public Uniform Resource Locator (URL) of the deployed Cloudflare Pages site.
{
"invocationId": "inv_1234567890abcdef",
"status": "completed",
"objectKey": "oip-cloudflare-pages-deploy",
"timestamp": "2023-10-27T10:00:00Z",
"details": {
"deploymentId": "cf_deploy_abc123def456",
"siteName": "my-oip-app",
"url": "https://my-oip-app.pages.dev",
"cloudflareProjectId": "cf_proj_xyz789"
}
}Ledger Record
The ledger record for a Cloudflare Pages deployment invocation is an immutable entry within the OIP ledger. Every invocation to POST /api/dispatch appends a record of the oip-cloudflare-pages-deploy object and its body to the ledger. This record includes the invocationId, timestamp, and the full JSON payload of the invoked object. The ledger provides an auditable history of all deployment operations, enabling replay and repair mechanisms as part of the OIP loop (object, invoke, ledger, receipt, replay, repair). Access to ledger records is available via specific OIP API routes, such as /api/dispatch?ledger=inv_ID.
End-to-End Deployment Example
This example demonstrates invoking a Cloudflare Pages deployment using curl, a Command Line Interface (CLI) tool for transferring data with URLs. The invocation deploys a project from a GitHub repository.
curl -X POST https://miscsubjects.com/api/dispatch \
-H "Content-Type: application/json" \
-d '{
"key": "oip-cloudflare-pages-deploy",
"body": {
"projectName": "example-oip-site",
"repositoryUrl": "https://github.com/miscsubjects/example-oip-site.git",
"branch": "main",
"buildCommand": "npm install && npm run build",
"publishDirectory": "public",
"environmentVariables": {
"API_ENDPOINT": "https://api.example.com"
}
}
}'Upon successful invocation, the OIP API returns an invocationId:
{
"invocationId": "inv_abcdef1234567890",
"status": "initiated"
}To retrieve the deployment receipt, use the invocationId:
curl "https://miscsubjects.com/api/dispatch?receipt=inv_abcdef1234567890"The receipt confirms the deployment status and details:
{
"invocationId": "inv_abcdef1234567890",
"status": "completed",
"objectKey": "oip-cloudflare-pages-deploy",
"timestamp": "2023-10-27T10:05:30Z",
"details": {
"deploymentId": "cf_deploy_xyz987abc654",
"siteName": "example-oip-site",
"url": "https://example-oip-site.pages.dev",
"cloudflareProjectId": "cf_proj_def321"
}
}Receipt Validation Rule
A Cloudflare Pages deployment receipt is valid if it contains an invocationId matching the initial request, a status of completed, and a details object with deploymentId, siteName, and a valid url pointing to the deployed resource. The objectKey field must be oip-cloudflare-pages-deploy. The presence of these fields confirms the OIP system's successful interaction with Cloudflare Pages and the availability of deployment specifics.
Conformance Rule
Conformant behavior for a Cloudflare Pages integration requires that an oip-cloudflare-pages-deploy object, when successfully invoked and receipted, results in a publicly accessible web application or static site at the url specified in the receipt's details. The content served at this URL must correspond to the source repository and build configuration defined in the original OIP object. Any deviation from the expected content or accessibility constitutes non-conformance.
Cloudflare Pages Deployment and Model Context Protocol
Cloudflare Pages deployment within OIP focuses on the automated provisioning and updating of web assets and serverless functions. The Model Context Protocol (MCP) defines how a model connects to a server that exposes tools, resources, and prompts over a session. An OIP Cloudflare Pages deployment object specifies the infrastructure for a web application, while an MCP session defines the operational context for a computational model. An OIP deployment provides the hosting environment for a web application; an MCP session provides the execution environment for a model. A deployed OIP application on Cloudflare Pages can serve as a front-end for an MCP-driven backend, where the application interacts with an MCP server via its API. The OIP object defines the static deployment; the MCP session defines the dynamic interaction.