Meet "Aegis", Your Automated Tech Lead

Goal: Transform Aegis into a true DevSecOps Tech Lead by exposing it as a Model Context Protocol (MCP) Server. Instead of hacking together background scripts to push code, Aegis will plug directly into Lovable as a "Chat Connector". Lovable's AI will consult Aegis during the development process, allowing Aegis to enforce strict architectural rules and force Lovable to self-correct before the code is even committed!

Proposed Architecture: Aegis as an MCP Server

1. Backend: The MCP Server Endpoint

[MODIFY] index.js

  • Build an official MCP Server into the Aegis Cloudflare Worker (using the @modelcontextprotocol/sdk).
  • Expose an SSE (Server-Sent Events) or standard HTTP endpoint (e.g., POST /api/mcp) that Lovable can connect to.
  • Define a strict MCP Tool named aegis_quality_audit.
  • The Tool Logic: When Lovable's AI calls this tool with its generated code (or repository context), Aegis will run the static analysis engine to check for:
    • dangerouslySetInnerHTML
    • Missing React Router <Link> components
    • Missing SEO tags (react-helmet)
    • Bloated Index.jsx files lacking componentization
  • The Feedback Loop: If the code fails, the Aegis MCP server returns a strict failure payload outlining exactly what rules were broken and how Lovable must fix them. Lovable's AI will read this response and autonomously rewrite the code to comply!

2. Backend: Deployment Enforcer (The Final Gate)

[MODIFY] index.js

  • When you click "🚀 Promote" in the Aegis dashboard, Aegis will run one final scan on the GitHub repository.
  • If Lovable somehow bypassed the MCP tool and pushed non-compliant code to GitHub, Aegis will hard-block the deployment and show a big red warning in the dashboard preventing it from going live to Cloudflare/Shopify.

3. Frontend: The MCP Setup Dashboard

[MODIFY] index.html & app.js

  • Create a new "Settings" or "Integrations" panel in the Aegis dashboard.
  • This panel will generate a secure Aegis MCP Connection URL (and an authentication token).
  • You simply copy this URL, paste it into Lovable's MCP integration settings, and Aegis instantly becomes a permanent member of your Lovable chat!

User Review Required

This is a brilliant architectural pivot. By making Lovable the client and Aegis the server, we perfectly align with how MCP is designed to work, and we catch the bad code at the source (inside Lovable) rather than trying to fix it after the fact.

Do you approve of this "Aegis as an MCP Server" architecture? If so, I am ready to start building the MCP endpoints into the backend!

prompts and checks tha the MCP should know

Lovable Failure Modes & MCP Auto-Fixes

A matrix of known ways Lovable deployments fail, to be exposed via MCP tools with built-in auto-fix prompts.

Routing & Asset Failures

  • Double Slash Injection: // paths breaking nested CSS/JS/images on proxy. (MCP Auto-Fix: Prompt AI to wrap URL string concatenations in a path normalizer function).
  • Missing Trailing Slashes: Breaks React Router relative bounds inside Shopify. (MCP Auto-Fix: Force route index to exact match pathname === basename /\/$/).
  • React Router Collisions: BrowserRouter clashing with Liquid routing. (MCP Auto-Fix: Prompt AI to swap BrowserRouter for MemoryRouter on export).
  • Hardcoded Absolute URLs: Assets explicitly linking to .lovable.app instead of relative paths. (MCP Auto-Fix: RegEx pass to strip origin domains from src= attributes).
  • uses iframes: Detect Iframes

Prompts

Native React

I need you to TRULY convert the HTML into native JSX. Do NOT use dangerouslySetInnerHTML. Rewrite the entire structure using standard React

tags, and make sure EVERY image is explicitly imported at the top of the file (e.g., import logo from './assets/logo.svg') and used as DO NOT use dangerouslySetInnerHTML

Fonts and Icons

The Google Fonts and FontAwesome icons are missing on the live site because the HTML isn't being deployed. Please add @import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css'); and the @import for the Google Fonts (Outfit and DM Serif Display) to the very top of index file

Image Compress

Please make sure all the images are optimized and compressed.

Componentization

Componentization Do not dump the entire HTML structure into one massive Index.jsx file. Break the page down into logical, reusable React components (e.g., , ,