Architecture Overview
Frontend, Gateway, MCP servers, Factory Simulation
System Overview
OpenShopFloor consists of four main layers that work together to provide a complete manufacturing AI platform:
Frontend (Next.js)
The frontend is a statically exported Next.js application hosted on Cloudflare Pages. It provides:
- AI Chat — Conversational interface with SSE streaming
- Agent Hub — Browse, run, and manage built-in and community agents
- Flow Editor — Embedded Node-RED editor (iframe)
- Challenges — Gamified factory optimization tasks
- Documentation — This wiki and the MCP tool reference
output: "export", all routes are statically generated at build time. Dynamic routes use generateStaticParams().Gateway (Express)
The OSF Gateway is the backend API server running as a Kubernetes deployment. It handles:
- Authentication — JWT-based auth with email/password registration
- Chat API — Streams LLM responses with MCP tool calls via SSE
- Agent Runner — Executes built-in and code agents in V8 sandboxes
- Flow Engine — Executes Node-RED flows with the custom OSF engine
- MCP Proxy — Routes tool calls to the appropriate MCP server
- Node-RED — Embeds the Node-RED editor for visual flow building
- Code Agents — GitHub integration, webhook sync, isolated-vm execution
The gateway runs as a single Express process with Node-RED embedded at the /flows path. Authentication uses JWT tokens via Bearer headers, API keys, or the osf_editor_token cookie for the Node-RED iframe.
MCP Servers
Multiple MCP servers expose factory data via the Model Context Protocol:
factory-sim:8020Factory Simulator — ERP, OEE, capacity, MRP, maintenance, energy, stock, purchasing, subcontracting, TMS, SGM (injection molding), assembly, pre-assembly, and test field. Prefix: factory_, tms_,sgm_, montage_
mqtt-uns:8025UNS (Unified Namespace) — live machine data via MQTT, topic search, alerts, cross-machine comparisons. Prefix: uns_
kg-server:8035Knowledge Graph — Neo4j graph queries, impact analysis, semantic search (vector embeddings), chart generation, delivery snapshots. Prefix: kg_
historian:8030Time-series analytics — trends, comparisons, aggregations, anomaly detection. Prefix: history_
Factory Simulation
The factory simulation provides realistic manufacturing data. It simulates:
- CNC Machines — 5 CNC turning/milling centers with real-time OEE, availability, and performance data
- Injection Molding (SGM) — 3 injection molding machines with cycle times and quality data
- Assembly Lines — Final assembly with station-level tracking
- Pre-Assembly — Sub-assembly operations
- Test Field — End-of-line testing with pass/fail data
Data is stored in PostgreSQL databases and updated by simulation routines. The simulation runs continuously, generating realistic production events, machine states, quality data, and order progress.
LLM Integration
OSF uses locally hosted LLMs for all AI operations. Two model servers are available:
- Port 5001 — Larger model for moderation, synthesis, and debate tasks
- Port 5002 — qwen2.5-14b for specialist tasks (agents, flow nodes)
The chat API and flow engine route requests to the appropriate model based on the task type. All LLM calls include the user's MCP tool results as context.
Deployment
The platform runs on Kubernetes with the following setup:
- Frontend — Cloudflare Pages (static export)
- Gateway — K8s Deployment in namespace
osf - MCP Servers — K8s Deployments in namespace
demo - LLM Servers — GPU-attached pods