worker-orchestrator-service
A specialized MCP backend component designed to orchestrate image synthesis tasks via a Cloudflare Edge Function. This system facilitates non-blocking image creation workflows, delivers immediate operational status updates, and manages execution failures. It exposes a strongly-typed programmatic interface for submitting textual inputs to initiate visual asset production.
Author

agan2023416
Quick Info
Actions
Tags
Cloudflare Edge Execution Toolkit
This repository aggregates several discrete Cloudflare Worker deployments and complementary management utilities, each engineered to deliver specific backend functionalities and networked resources.
Integrated Components
replicate-integration-r2
A distributed microservice leveraging Replicate's generative AI capabilities, storing resultant media within Cloudflare's R2 object storage infrastructure. Key features: - Leverages the Replicate API for artifact generation. - Persists finished graphical assets in Cloudflare R2 buckets. - Instantly furnishes asset access URIs. - Incorporates webhook subscription handling for external callbacks. - Fully integrated within the MCP server framework for unified AI operations.
👉 Detailed documentation for replicate-integration-r2
synthesis-interface
A Model Context Protocol (MCP) abstraction layer providing a streamlined facade to the replicate-integration-r2 edge function. This server implementation:
- Acts as the intermediary layer to the replicate-integration-r2 asset.
- Enforces schema validation via strictly typed API contracts.
- Manages the state transitions for deferred (asynchronous) image generation.
- Supports polling or push mechanisms for result notification.
👉 Detailed documentation for synthesis-interface
n8n-gateway-adapter ⭐ NEW
A dedicated MCP routing engine tailored for seamless integration within the n8n automation platform, featuring native Server-Sent Events (SSE) support. This adapter:
- Native n8n Compatibility: Optimized for consumption by n8n's proprietary MCP Client Tool.
- Live Feedback Mechanism: Implements the SSE protocol for low-latency, real-time progress streaming.
- Multimodal Capacity: Accommodates various diffusion engines, including Flux and Stable Diffusion variants.
- Operational Robustness: Engineered with comprehensive failure detection and performance telemetry.
- Zero Dependency on Worker Alteration: Utilizes the existing replicate-integration-r2 component without modification.
👉 Detailed documentation for n8n-gateway-adapter
🚀 Quick Deployment Guide for n8n Automation Users
To embed AI media creation within your n8n execution flows, adhere to these sequence steps:
1. Deploy the Origin Worker
bash cd replicate-integration-r2 npm install npm run deploy
2. Initialize the MCP Routing Server
bash cd mcps/n8n-gateway-adapter npm install npm run build
3. Configure Runtime Environment Variables
bash export CLOUDFLARE_WORKERS_URL=https://your-deployed-endpoint.workers.dev export WORKER_API_TOKEN=your-secret-access-key npm start
4. Integrate into n8n
Within your n8n execution canvas:
1. Introduce the MCP Client Tool node.
2. Establish the connection endpoint pointing to your running MCP server.
3. Invoke the image generation procedure using the designated tool name (e.g., synthesize_visual_asset) alongside the input specification.
System Flow Diagram
mermaid graph TB A[n8n Automation Canvas] -->|SSE/MCP Contract| B[n8n-gateway-adapter MCP Server] B -->|Secure HTTP Invocation| C[replicate-integration-r2 Edge Function] C -->|AI Synthesis Request| D[Replicate External Service] C -->|Artifact Deposition| E[Cloudflare R2 Storage] C -->|Status Notification| C
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
style D fill:#fff3e0
style E fill:#fce4ec
Initial Setup Instructions
Each project directory contains self-contained documentation. To commence utilization:
- Select the desired functional module.
- Navigate into its corresponding directory.
- Execute the installation and configuration guidance outlined within its local README file.
Directory Layout
cloudflare-workers/ ├── README.md ├── replicate-integration-r2/ # Replicate integration worker deployment │ ├── README.md # Worker-specific operational guides │ ├── src/ # Source code artifacts │ └── ... # Supporting configuration files └── mcps/ # Model Context Protocol servers ├── synthesis-interface/ # Original MCP server implementation │ ├── README.md # Server operational manual │ ├── src/ # Application source │ └── ... # Auxiliary files └── n8n-gateway-adapter/ # ⭐ NEW: Dedicated n8n communication layer ├── README.md # Comprehensive setup procedure ├── src/ # TypeScript codebase └── ... # Runtime configuration files
🔄 Transition Path: From synthesis-interface to n8n-gateway-adapter
Users currently employing the legacy synthesis-interface MCP service are strongly encouraged to migrate to the feature-rich n8n-gateway-adapter for improved automation integration:
Advantages of n8n-gateway-adapter:
- ✅ Superior SSE Handling: Optimized exclusively for n8n's communication protocols.
- ✅ Robust Exception Management: Enhanced logging fidelity and more granular error reporting.
- ✅ Throughput Optimization: Tuned specifically for common n8n workflow execution patterns.
- ✅ Enriched Documentation: Clearer instructions for deployment and operationalizing.
- ✅ Active Maintenance Focus: Development efforts prioritize n8n-centric feature parity.
Migration Sequence:
- Deploy the successor component:
cd mcps/n8n-gateway-adapter && npm install - Modify your n8n MCP Client Tool settings to point to the new endpoint.
- Validate all associated workflows against the updated server endpoint.
- Benefit from increased stability and optimized throughput!
Future iterations of this project collection will introduce additional specialized utilities. Stay subscribed for enhancements!
