# harikrishna8121999/email-design-mcp architecture

> Architecture diagram of the GitHub repository harikrishna8121999/email-design-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harikrishna8121999/email-design-mcp
- Repository: https://github.com/harikrishna8121999/email-design-mcp

## Overview

email-design-mcp is an MCP server that prepares branded email-generation instructions for the host AI, then supports compilation, refinement, validation, export, and preview. Users enter through MCP tools, resources, or guided prompts; generated MJML is compiled to HTML and stored for later use. The graph includes the documented template and guided-workflow capabilities. Some tool implementations and preview-server details were only sampled partially, so unsupported internal calls are omitted.

Main entry points: [`src/index.ts`](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/index.ts) (MCP Server), [`src/tools/generate-email.ts`](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/generate-email.ts) (Email Generation), [`src/lib/storage.ts`](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/storage.ts) (JSON Storage), [`src/tools/refine-email.ts`](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/refine-email.ts) (Email Refinement)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["MCP Interface"]
  node_server["MCP Server<br/>[index.ts]"]
  node_guided["Guided Prompts"]
  node_resources["MCP Resources"]
end

subgraph group_design["Design Workflows"]
  node_brandsetup["Brand Setup<br/>[setup-brand.ts]"]
  node_extractor["Brand Extractor<br/>[brand-extractor.ts]"]
  node_generation["Email Generation<br/>[generate-email.ts]"]
  node_screenshots["Screenshot Recreation"]
  node_refinement["Email Refinement<br/>[refine-email.ts]"]
  node_brandcontext["Brand Context<br/>[brand-injector.ts]"]
  node_designprompts["Design Prompt Stack"]
  node_designrules["Design Rules<br/>[index.ts]"]
  node_layouts["Layout Variants"]
  node_images["Image Library<br/>[image-library.ts]"]
end

subgraph group_render["Email Processing"]
  node_compiler["MJML Compiler<br/>[mjml-compiler.ts]"]
  node_compiletool["Compile Tool<br/>[compile-mjml.ts]"]
  node_validator["Email Validation<br/>[email-validator.ts]"]
  node_validatetool["Validation Tool<br/>[validate-email.ts]"]
  node_export["Email Export<br/>[export-email.ts]"]
  node_sectionlabel["Section Labeling<br/>[section-labeler.ts]"]
end

subgraph group_state["Storage and Preview"]
  node_storage[("JSON Storage<br/>[storage.ts]")]
  node_housekeeping["History Housekeeping"]
  node_preview["Live Preview<br/>[server.ts]"]
end

node_user(("Assistant User"))
node_host(("Host AI Model"))

node_user -->|"uses tools"| node_server
node_server -->|"registers tool"| node_brandsetup
node_server -->|"registers tool"| node_generation
node_server -->|"registers tool"| node_screenshots
node_server -->|"registers tool"| node_refinement
node_server -->|"registers tool"| node_compiletool
node_server -->|"registers tool"| node_validatetool
node_server -->|"registers tool"| node_export
node_server -->|"registers prompts"| node_guided
node_server -->|"registers resources"| node_resources
node_brandsetup -->|"extracts branding"| node_extractor
node_brandsetup -->|"saves profile"| node_storage
node_generation -->|"loads brand, saves email"| node_storage
node_generation -->|"builds context"| node_brandcontext
node_generation -->|"selects variant"| node_layouts
node_generation -->|"adds rules"| node_designrules
node_generation -->|"uses prompt guidance"| node_designprompts
node_generation -->|"adds image choices"| node_images
node_generation -->|"returns instructions"| node_host
node_host -->|"submits MJML"| node_compiletool
node_compiletool -->|"compiles MJML"| node_compiler
node_screenshots -->|"loads brand, saves email"| node_storage
node_screenshots -->|"builds image prompt"| node_images
node_screenshots -->|"returns instructions"| node_host
node_refinement -->|"loads and saves email"| node_storage
node_refinement -->|"labels sections"| node_sectionlabel
node_refinement -->|"builds context"| node_brandcontext
node_refinement -->|"returns instructions"| node_host
node_validatetool -->|"checks email"| node_validator
node_export -->|"loads email"| node_storage
node_resources -->|"reads stored data"| node_storage
node_server -->|"starts server"| node_preview
node_server -->|"starts cleanup"| node_housekeeping
node_preview -->|"loads email"| node_storage

click node_server "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/index.ts"
click node_guided "https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/prompts/mcp-prompts"
click node_resources "https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/resources"
click node_brandsetup "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/setup-brand.ts"
click node_extractor "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/brand-extractor.ts"
click node_generation "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/generate-email.ts"
click node_screenshots "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/screenshot-to-email.ts"
click node_refinement "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/refine-email.ts"
click node_brandcontext "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/prompts/system/brand-injector.ts"
click node_designprompts "https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/prompts/system"
click node_designrules "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/prompts/design-rules/index.ts"
click node_layouts "https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/prompts/layouts"
click node_images "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/prompts/system/image-library.ts"
click node_compiler "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/mjml-compiler.ts"
click node_compiletool "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/compile-mjml.ts"
click node_validator "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/email-validator.ts"
click node_validatetool "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/validate-email.ts"
click node_export "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/export-email.ts"
click node_sectionlabel "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/section-labeler.ts"
click node_storage "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/storage.ts"
click node_housekeeping "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/storage-housekeeping.ts"
click node_preview "https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/preview/server.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_guided,node_resources,node_user toneBlue
class node_brandsetup,node_extractor,node_generation,node_screenshots,node_refinement,node_brandcontext,node_designprompts,node_designrules,node_layouts,node_images toneAmber
class node_compiler,node_compiletool,node_validator,node_validatetool,node_export,node_sectionlabel toneMint
class node_storage,node_housekeeping,node_preview toneRose
class node_host toneIndigo
```

## Components

### MCP Interface

- [MCP Server](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/index.ts): `src/index.ts`
- [Guided Prompts](https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/prompts/mcp-prompts): `src/prompts/mcp-prompts`
- [MCP Resources](https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/resources): `src/resources`

### Design Workflows

- [Brand Setup](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/setup-brand.ts): `src/tools/setup-brand.ts`
- [Brand Extractor](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/brand-extractor.ts): `src/lib/brand-extractor.ts`
- [Email Generation](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/generate-email.ts): `src/tools/generate-email.ts`
- [Screenshot Recreation](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/screenshot-to-email.ts): `src/tools/screenshot-to-email.ts`
- [Email Refinement](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/refine-email.ts): `src/tools/refine-email.ts`
- [Brand Context](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/prompts/system/brand-injector.ts): `src/prompts/system/brand-injector.ts`
- [Design Prompt Stack](https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/prompts/system): `src/prompts/system`
- [Design Rules](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/prompts/design-rules/index.ts): `src/prompts/design-rules/index.ts`
- [Layout Variants](https://github.com/harikrishna8121999/email-design-mcp/tree/main/src/prompts/layouts): `src/prompts/layouts`
- [Image Library](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/prompts/system/image-library.ts): `src/prompts/system/image-library.ts`

### Email Processing

- [MJML Compiler](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/mjml-compiler.ts): `src/lib/mjml-compiler.ts`
- [Compile Tool](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/compile-mjml.ts): `src/tools/compile-mjml.ts`
- [Email Validation](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/email-validator.ts): `src/lib/email-validator.ts`
- [Validation Tool](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/validate-email.ts): `src/tools/validate-email.ts`
- [Email Export](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/tools/export-email.ts): `src/tools/export-email.ts`
- [Section Labeling](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/section-labeler.ts): `src/lib/section-labeler.ts`

### Storage and Preview

- [JSON Storage](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [History Housekeeping](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/lib/storage-housekeeping.ts): `src/lib/storage-housekeeping.ts`
- [Live Preview](https://github.com/harikrishna8121999/email-design-mcp/blob/main/src/preview/server.ts): `src/preview/server.ts`

### Other components

- **Assistant User**
- **Host AI Model**

## Connections

- Assistant User → MCP Server: uses tools (evidence: `README.md`)
- MCP Server → Brand Setup: registers tool (evidence: `src/index.ts`)
- MCP Server → Email Generation: registers tool (evidence: `src/index.ts`)
- MCP Server → Screenshot Recreation: registers tool (evidence: `src/index.ts`)
- MCP Server → Email Refinement: registers tool (evidence: `src/index.ts`)
- MCP Server → Compile Tool: registers tool (evidence: `src/index.ts`)
- MCP Server → Validation Tool: registers tool (evidence: `src/index.ts`)
- MCP Server → Email Export: registers tool (evidence: `src/index.ts`)
- MCP Server → Guided Prompts: registers prompts (evidence: `src/index.ts`)
- MCP Server → MCP Resources: registers resources (evidence: `src/index.ts`)
- Brand Setup → Brand Extractor: extracts branding (evidence: `src/tools/setup-brand.ts`)
- Brand Setup → JSON Storage: saves profile (evidence: `src/tools/setup-brand.ts`)
- Email Generation → JSON Storage: loads brand, saves email (evidence: `src/tools/generate-email.ts`)
- Email Generation → Brand Context: builds context (evidence: `src/tools/generate-email.ts`)
- Email Generation → Layout Variants: selects variant (evidence: `src/tools/generate-email.ts`)
- Email Generation → Design Rules: adds rules (evidence: `src/tools/generate-email.ts`)
- Email Generation → Design Prompt Stack: uses prompt guidance (evidence: `src/tools/generate-email.ts`)
- Email Generation → Image Library: adds image choices (evidence: `src/tools/generate-email.ts`)
- Email Generation → Host AI Model: returns instructions (evidence: `README.md`)
- Host AI Model → Compile Tool: submits MJML (evidence: `README.md`)
- Compile Tool → MJML Compiler: compiles MJML (evidence: `src/tools/compile-mjml.ts`)
- Screenshot Recreation → JSON Storage: loads brand, saves email (evidence: `src/tools/screenshot-to-email.ts`)
- Screenshot Recreation → Image Library: builds image prompt (evidence: `src/tools/screenshot-to-email.ts`)
- Screenshot Recreation → Host AI Model: returns instructions (evidence: `README.md`)
- Email Refinement → JSON Storage: loads and saves email (evidence: `src/tools/refine-email.ts`)
- Email Refinement → Section Labeling: labels sections (evidence: `src/tools/refine-email.ts`)
- Email Refinement → Brand Context: builds context (evidence: `src/tools/refine-email.ts`)
- Email Refinement → Host AI Model: returns instructions (evidence: `README.md`)
- Validation Tool → Email Validation: checks email (evidence: `src/tools/validate-email.ts`)
- Email Export → JSON Storage: loads email (evidence: `src/tools/export-email.ts`)
- MCP Resources → JSON Storage: reads stored data (evidence: `src/resources/brand.ts`)
- MCP Server → Live Preview: starts server (evidence: `src/index.ts`)
- MCP Server → History Housekeeping: starts cleanup (evidence: `src/index.ts`)
- Live Preview → JSON Storage: loads email (evidence: `src/preview/server.ts`)
