mcp-media-forge
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-media-forge Create a mermaid flowchart for user registration"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Media Forge
MCP server that generates diagrams, charts, HTML pages, and slide decks from text DSLs -- designed for AI coding agents to embed into Markdown.
LLM agents call tools like render_mermaid, render_html_page, or render_slides with text input, and get back file paths to assets ready to embed in docs.
Output Gallery
Mermaid Flowchart
Mermaid Sequence Diagram
D2 Architecture Diagram
Graphviz Dependency Graph
Vega-Lite Bar Chart
Related MCP server: kroki_mcp
Tools
Diagram & Chart Renderers (Docker)
Tool | Input | Formats | Use Case |
| Mermaid code | SVG, PNG | Flowcharts, sequence, ER, state, Gantt, git graphs |
| D2 code | SVG, PNG | Architecture diagrams with containers and icons |
| DOT code | SVG, PNG | Dependency graphs, network diagrams |
| Vega-Lite JSON | SVG, PNG | Bar, line, scatter, area, heatmap charts |
HTML Generators (No Docker)
Tool | Input | Output | Use Case |
| HTML body + theme | Self-contained HTML | Technical docs, reports, dashboards |
| JSON slide array + theme | HTML slide deck | Presentations, status updates, walkthroughs |
Utilities
Tool | Description |
| Usage examples, anti-patterns, complexity limits per tool |
| List all generated files in the output directory |
Quick Start
1. Start the rendering container (for diagram tools)
cd docker
docker compose up -dHTML page and slide tools work without Docker.
2. Install the MCP server
Option A -- npx (no install)
npx mcp-media-forgeOption B -- Clone and build
git clone https://github.com/PavelGuzenfeld/mcp-media-forge.git
cd mcp-media-forge
npm install
npm run build3. Register with your MCP client
Any MCP-compatible client (Claude Code, Cursor, VS Code + Copilot, Cline, etc.) can use this server. The standard config:
{
"mcpServers": {
"media-forge": {
"command": "node",
"args": ["/path/to/mcp-media-forge/dist/index.js"],
"env": {
"PROJECT_ROOT": "/path/to/your/project"
}
}
}
}Where to add this depends on your client:
Claude Code:
~/.claude/settings.jsonCursor: MCP settings panel
VS Code (Copilot):
.vscode/mcp.jsonCline: MCP server configuration
4. Use it
Ask your AI assistant to generate diagrams, pages, or presentations:
"Create a sequence diagram showing the OAuth2 flow and embed it in the README"
"Generate an HTML page summarizing the API architecture with KPI cards"
"Make a slide deck with our Q1 metrics and architecture overview"
The agent calls the appropriate tool, gets back a file path, and embeds it in your markdown.
How It Works
AI Agent (any MCP client)
|
| MCP Protocol (JSON-RPC over stdio)
v
MCP Media Forge (Node.js on host)
|
|--- Diagrams: docker exec (sandboxed, no network)
| |
| v
| Rendering Container
| ├── mmdc (Mermaid CLI + Chromium)
| ├── d2 (D2 diagrams)
| ├── dot/neato (Graphviz)
| └── vl2svg (Vega-Lite via vl-convert)
|
|--- HTML/Slides: template engine (no Docker)
| |
| v
| CSS Design System (4 themes, depth tiers, components)
|
v
docs/generated/
mermaid-a1b2c3.svg
d2-7f8e9a.svg
html_page-d4e5f6.html
slides-8b9c0d.htmlKey design decisions:
Text in, file path out -- returns relative paths, never base64 blobs
Content-hash naming -- same input = same file = free caching + git-friendly
SVG preferred -- vector format, small files, diffs cleanly in git
Docker-contained -- diagram renderers run in a sandboxed container with
network_mode: noneSelf-contained HTML -- pages and slides have zero external dependencies (inline CSS/JS)
Input pre-validation -- catches common mistakes before Docker round-trips
Structured errors -- error responses include
error_type,error_message, andsuggestionto enable LLM self-correction
Tool Reference
get_tool_guide
Get usage guide for any tool before rendering. Returns examples, anti-patterns to avoid, complexity limits, and tips.
{ "tool_name": "mermaid" }Available guides: mermaid, d2, graphviz, vegalite, html_page, slides, or all for a summary.
render_mermaid
{
"code": "flowchart TD\n A[Start] --> B{Decision}\n B -->|Yes| C[Done]",
"format": "svg",
"theme": "default"
}Parameter | Type | Default | Description |
| string | required | Mermaid diagram code (must start with diagram type) |
|
|
| Output format |
|
|
| Mermaid theme |
Pre-validation catches: missing diagram type, semicolons, HTML in labels, >25 nodes.
render_d2
{
"code": "client -> server -> database",
"format": "svg",
"layout": "dagre"
}Parameter | Type | Default | Description |
| string | required | D2 diagram code |
|
|
| Output format |
| number | -- | Theme ID (0=default, 1=neutral-grey, 3=terminal) |
|
|
| Layout engine |
Pre-validation catches: Mermaid/D2 syntax confusion, unbalanced braces, >3 nesting depth.
render_graphviz
{
"dot_source": "digraph G { A -> B -> C }",
"engine": "dot",
"format": "svg"
}Parameter | Type | Default | Description |
| string | required | Graphviz DOT source code |
|
|
| Layout engine |
|
|
| Output format |
Pre-validation catches: missing graph wrapper, -> in undirected graphs, unbalanced braces.
render_chart
{
"spec_json": "{\"$schema\":\"https://vega.github.io/schema/vega-lite/v5.json\",\"data\":{\"values\":[{\"x\":1,\"y\":10}]},\"mark\":\"bar\",\"encoding\":{\"x\":{\"field\":\"x\"},\"y\":{\"field\":\"y\"}}}",
"format": "svg"
}Parameter | Type | Default | Description |
| string | required | Vega-Lite JSON specification |
|
|
| Output format |
| number | 1 | Scale factor for PNG output |
Pre-validation catches: invalid JSON, missing $schema/data/mark, >500 inline data rows.
render_html_page
Generates a self-contained themed HTML page. No Docker required.
{
"title": "System Overview",
"body_html": "<section id=\"metrics\"><h2>Metrics</h2><div class=\"mf-grid mf-grid-3\">...</div></section>",
"theme": "swiss",
"description": "Q1 architecture overview",
"nav_sections": ["Metrics", "Architecture", "Roadmap"]
}Parameter | Type | Default | Description |
| string | required | Page title |
| string | required | HTML body content (inner content only, no |
|
|
| Visual theme |
| string | -- | Page description (meta tag + header) |
| string[] | -- | Section names for floating IntersectionObserver navigation |
Design system CSS classes:
Class | Purpose |
| Primary highlight section (large shadow) |
| Secondary highlight (medium shadow) |
| Bordered content card |
| De-emphasized content |
| Responsive 2-column grid |
| Responsive 3-column grid |
| Two equal columns |
| Key metric display |
| Status badges |
Themes:
Theme | Style | Best for |
| White, geometric, blue accent | Technical docs |
| Deep navy, serif, gold accent | Presentations |
| Cream paper, bold sans, terracotta | Reports |
| Dark, monospace, cyan accent | Developer content |
render_slides
Generates a self-contained HTML slide deck with keyboard/touch navigation. No Docker required.
{
"title": "Q1 Review",
"slides": "[{\"title\":\"Q1 Review\",\"content\":\"Engineering update\",\"type\":\"title\"},{\"title\":\"Metrics\",\"content\":\"<ul><li>99.9% uptime</li></ul>\",\"type\":\"content\"}]",
"theme": "midnight",
"author": "Engineering Team"
}Parameter | Type | Default | Description |
| string | required | Presentation title |
| string | required | JSON array of slide objects |
|
|
| Visual theme |
| string | -- | Author (shown on title slide) |
Slide types:
Type | Layout | Best for |
| Centered large text + subtitle | Opening/closing slides |
| Centered heading + description | Topic dividers |
| Heading + body (bullets, text) | Most content |
| Heading + two columns | Before/after, comparisons |
| Heading + code block | Code walkthroughs |
| Large blockquote + attribution | Testimonials, key quotes |
| Heading + auto-grid metrics | Dashboards, stats |
| Heading + centered image | Screenshots, diagrams |
Navigation: Arrow keys, Space, PageUp/PageDown, Home/End. Touch: swipe left/right. Click dots to jump.
list_assets
{ "directory": "" }Returns a JSON array of all generated files with name, path, size, and modification time.
Error Handling
All tools return structured errors that help LLMs self-correct:
{
"status": "error",
"error_type": "syntax_error",
"error_message": "First line must declare diagram type. Got: \"A --> B\"",
"suggestion": "Start with: flowchart TD, sequenceDiagram, erDiagram, ... See https://mermaid.js.org/syntax/"
}Error types: syntax_error, rendering_error, dependency_missing.
Pre-validation catches common LLM mistakes before hitting the renderer:
Mermaid: missing diagram type, semicolons, HTML tags, legacy
graphsyntaxD2: Mermaid syntax confusion (
-->,subgraph), unbalanced bracesGraphviz: missing
digraph/graphwrapper,->in undirected graphsVega-Lite: invalid JSON, missing required fields, oversized inline data
Environment Variables
Variable | Default | Description |
|
| Project root for output path resolution |
|
| Output directory relative to PROJECT_ROOT |
|
| Docker container name |
Development
npm install
npm run build # Build with tsup
npm run dev # Watch mode
npm test # Run all tests (95 total)
npm run test:unit # Unit tests only (no Docker needed)
npm run test:component # Integration tests (Docker tools need container)
npm run lint # Type-check with tscRunning integration tests
cd docker && docker compose up -d # Start renderer (diagram tools only)
cd .. && npm run test:component # All integration testsHTML page and slide integration tests run without Docker.
Examples
See examples/ for sample input files:
File | Tool | Description |
render_mermaid | Decision flowchart | |
render_mermaid | Client-server sequence | |
render_d2 | Backend architecture with containers | |
render_graphviz | npm dependency graph | |
render_chart | Tool performance comparison |
See examples/README.md for MCP tool call examples and expected responses.
License
Available Tools
8 toolsget_tool_guideA
Get usage guide for a rendering tool — includes examples, anti-patterns to avoid, complexity limits, and tips. Call this BEFORE your first render to avoid common mistakes. Available guides: mermaid, d2, graphviz, vegalite, html_page, slides (or "all" for a summary).
Inputs: tool_name (required).
list_assetsB
List all generated media assets in the output directory.
Inputs: directory.
render_chartA
Render a Vega-Lite chart to SVG or PNG. Supports: bar, line, point (scatter), area, rect (heatmap), boxplot, and layered/composite charts. IMPORTANT: spec_json must be valid JSON with "$schema", "data", "mark", and "encoding" fields. Anti-patterns: missing $schema, omitting encoding types, >500 inline data rows. Call get_tool_guide('vegalite') for examples.
Inputs: spec_json (required), scale, format.
render_d2A
Render a D2 architecture diagram to SVG or PNG. Best for: architecture diagrams with containers, nested groups, icons, and complex layouts. IMPORTANT: D2 syntax is NOT Mermaid. Use '->' for arrows (not '-->'), containers with 'name: { ... }' (not 'subgraph'). Anti-patterns: Mermaid syntax, unbalanced braces, >3 nesting levels. Call get_tool_guide('d2') for examples.
Inputs: code (required), theme, format, layout.
render_graphvizA
Render a Graphviz DOT diagram to SVG or PNG. Best for: dependency graphs, network diagrams, tree structures, large auto-layout graphs (100+ nodes). IMPORTANT: Source must be wrapped in 'digraph G { ... }' or 'graph G { ... }'. Use '->' with digraph, '--' with graph. Engine guide: dot=hierarchical, neato=spring, fdp=force-directed, sfdp=large graphs, circo=circular, twopi=radial. Call get_tool_guide('graphviz') for examples.
Inputs: dot_source (required), engine, format.
render_html_pageA
Render a self-contained themed HTML page from body content. No Docker required. Wraps your HTML in a design system with typography, depth tiers, cards, grids, KPIs, badges, and section navigation. IMPORTANT: body_html is the INNER content only — do NOT include , , or tags. Use mf- prefixed CSS classes: mf-hero, mf-elevated, mf-card, mf-grid, mf-kpi, mf-badge-success, etc. Themes: swiss (clean docs), midnight (presentations), warm (reports), terminal (dev content). Call get_tool_guide('html_page') for design system reference and examples.
Inputs: title (required), body_html (required), theme, description, +1 more.
render_mermaidA
Render a Mermaid diagram to SVG or PNG. Supports: flowchart, sequenceDiagram, erDiagram, stateDiagram-v2, gantt, pie, gitGraph, classDiagram, journey, mindmap. IMPORTANT: Code must start with diagram type (e.g., 'flowchart TD'). Do NOT use semicolons. Do NOT use HTML tags in labels. Anti-patterns: 'graph' (use 'flowchart'), unquoted special chars in labels, >25 nodes without subgraphs. Call get_tool_guide('mermaid') for examples and full anti-pattern list.
Inputs: code (required), theme, format.
render_slidesA
Render a self-contained HTML slide deck with keyboard/touch navigation, progress bar, and transitions. No Docker required. Supports 8 slide types: title, content, split, code, quote, kpi, image, section. IMPORTANT: slides is a JSON array string of objects with title, content (HTML), and optional type. Content density limits: max 6 bullets per slide, max 10 code lines, max 25 words for quotes, max 30 slides total. Call get_tool_guide('slides') for slide type reference and examples.
Inputs: title (required), slides (required), theme, author.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each rendering tool targets a distinct output format (Mermaid, D2, Graphviz, Vega-Lite, HTML, slides), with no overlapping purposes. get_tool_guide and list_assets have clearly separate roles.
All rendering tools follow the 'render_<format>' pattern, with 'get_tool_guide' and 'list_assets' using a consistent verb_noun structure. Naming is uniform and predictable.
8 tools cover a broad range of media types and supporting functions (guide, listing). This is well-scoped for a media rendering server without being excessive or minimal.
The tool surface covers key generation tasks for multiple formats and includes guidance and asset listing. Minor gap: no tool to delete or update assets, but this aligns with a generate-focused server.
Maintenance
Related MCP Connectors
Generate images, GIFs, videos, and PDFs from HTML, URLs, or templates — from your AI agent.
Draw architecture diagrams, UML, planning boards and clickable wireframes from your AI assistant.
Software diagrams for developers, teams and agents — give your AI agents diagramming superpowers.
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to generate stylized images from text and code, with syntax highlighting and markdown formatting support.MIT
- FlicenseNot gradedqualityDmaintenanceProvides AI agents with tools to generate, validate, and inspect diagrams from natural-language prompts, using the Kroki rendering engine to produce SVG files.-
- FlicenseNot gradedqualityCmaintenanceEnables agents to create display-quality visual content across HTML, Mermaid, pseudocode, text trees, and diffs, with automatic layout repair and rendering verification to prevent overlaps, overflow, and connection conflicts.1-
- AlicenseAqualityCmaintenanceLets agents construct Mermaid diagrams from structured JSON IR and render them as PNG or SVG.3MIT