Media Forge

io.github.PavelGuzenfeld由 GitHub 账号 PavelGuzenfeld 发布v0.2.0更新于 Nov 10, 2026

MCP server for generating diagrams, charts, presentations, and animations for Markdown documentation

概览

AI 生成的概览

根据文本输入生成图表、图形、HTML 页面和幻灯片,并返回可嵌入 Markdown 文档的文件路径。

可以做什么
Media Forge 提供渲染工具,接收文本 DSL 并返回生成资源的相对文件路径。图形工具在 Docker 容器内将 Mermaid、D2、Graphviz DOT 和 Vega-Lite 图表渲染为 SVG 或 PNG。HTML 工具无需 Docker 即可生成自包含的主题页面和 HTML 幻灯片。辅助工具提供各工具的使用指南并列出已生成的文件。
适用场景
适合需要将图形、图表、技术 HTML 页面或演示幻灯片生成为文件并用于文档的场景。适用于希望将生成资源提交到代码仓库并嵌入 Markdown,而不是以内联数据返回的工作流。
运行要求
作为本地 Node.js 进程运行,通常通过 npx mcp-media-forge 或构建后的 dist/index.js 启动。图形和图表工具需要从随附的 docker compose 文件启动 Docker 容器;HTML 页面和幻灯片工具无需 Docker。可选环境变量 PROJECT_ROOT、OUTPUT_DIR 和 MEDIA_FORGE_CONTAINER 用于控制输出路径和容器名称。未声明身份验证或 API 密钥。
安装前请注意
服务器会将生成的文件写入输出目录,默认是 PROJECT_ROOT 下的 docs/generated,因此可能在项目中创建或覆盖文件。图形渲染通过 network_mode none 的 Docker 容器进行,但容器需单独启动和管理。HTML 和幻灯片输出为自包含内容,发布前应检查生成结果。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Media Forge,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

MCP Media Forge

[npm] [MCP Registry] [License: MIT]

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 flowchart]

Mermaid Sequence Diagram

[Mermaid sequence diagram]

D2 Architecture Diagram

[D2 architecture diagram]

Graphviz Dependency Graph

[Graphviz dependency graph]

Vega-Lite Bar Chart

[Vega-Lite bar chart]

Tools

Diagram & Chart Renderers (Docker)

ToolInputFormatsUse Case
render_mermaidMermaid codeSVG, PNGFlowcharts, sequence, ER, state, Gantt, git graphs
render_d2D2 codeSVG, PNGArchitecture diagrams with containers and icons
render_graphvizDOT codeSVG, PNGDependency graphs, network diagrams
render_chartVega-Lite JSONSVG, PNGBar, line, scatter, area, heatmap charts

HTML Generators (No Docker)

ToolInputOutputUse Case
render_html_pageHTML body + themeSelf-contained HTMLTechnical docs, reports, dashboards
render_slidesJSON slide array + themeHTML slide deckPresentations, status updates, walkthroughs

Utilities

ToolDescription
get_tool_guideUsage examples, anti-patterns, complexity limits per tool
list_assetsList all generated files in the output directory

Quick Start

1. Start the rendering container (for diagram tools)

bash
cd dockerdocker compose up -d

HTML page and slide tools work without Docker.

2. Install the MCP server

Option A -- npx (no install)

bash
npx mcp-media-forge

Option B -- Clone and build

bash
git clone https://github.com/PavelGuzenfeld/mcp-media-forge.gitcd mcp-media-forgenpm installnpm run build

3. Register with your MCP client

Any MCP-compatible client (Claude Code, Cursor, VS Code + Copilot, Cline, etc.) can use this server. The standard config:

json
{  "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.json
  • Cursor: MCP settings panel
  • VS Code (Copilot): .vscode/mcp.json
  • Cline: 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)    vMCP 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)    |    vdocs/generated/  mermaid-a1b2c3.svg  d2-7f8e9a.svg  html_page-d4e5f6.html  slides-8b9c0d.html

Key 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: none
  • Self-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, and suggestion to 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.

json
{ "tool_name": "mermaid" }

Available guides: mermaid, d2, graphviz, vegalite, html_page, slides, or all for a summary.

render_mermaid

json
{  "code": "flowchart TD\n    A[Start] --> B{Decision}\n    B -->|Yes| C[Done]",  "format": "svg",  "theme": "default"}
ParameterTypeDefaultDescription
codestringrequiredMermaid diagram code (must start with diagram type)
formatsvg | pngsvgOutput format
themedefault | dark | forest | neutraldefaultMermaid theme

Pre-validation catches: missing diagram type, semicolons, HTML in labels, >25 nodes.

render_d2

json
{  "code": "client -> server -> database",  "format": "svg",  "layout": "dagre"}
ParameterTypeDefaultDescription
codestringrequiredD2 diagram code
formatsvg | pngsvgOutput format
themenumber--Theme ID (0=default, 1=neutral-grey, 3=terminal)
layoutdagre | elk | taladagreLayout engine

Pre-validation catches: Mermaid/D2 syntax confusion, unbalanced braces, >3 nesting depth.

render_graphviz

json
{  "dot_source": "digraph G { A -> B -> C }",  "engine": "dot",  "format": "svg"}
ParameterTypeDefaultDescription
dot_sourcestringrequiredGraphviz DOT source code
enginedot | neato | fdp | sfdp | twopi | circodotLayout engine
formatsvg | pngsvgOutput format

Pre-validation catches: missing graph wrapper, -> in undirected graphs, unbalanced braces.

render_chart

json
{  "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"}
ParameterTypeDefaultDescription
spec_jsonstringrequiredVega-Lite JSON specification
formatsvg | pngsvgOutput format
scalenumber1Scale 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.

json
{  "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"]}
ParameterTypeDefaultDescription
titlestringrequiredPage title
body_htmlstringrequiredHTML body content (inner content only, no <html>/<head>/<body>)
themeswiss | midnight | warm | terminalswissVisual theme
descriptionstring--Page description (meta tag + header)
nav_sectionsstring[]--Section names for floating IntersectionObserver navigation

Design system CSS classes:

ClassPurpose
mf-heroPrimary highlight section (large shadow)
mf-elevatedSecondary highlight (medium shadow)
mf-cardBordered content card
mf-recessedDe-emphasized content
mf-grid mf-grid-2Responsive 2-column grid
mf-grid mf-grid-3Responsive 3-column grid
mf-splitTwo equal columns
mf-kpi + mf-kpi-value + mf-kpi-labelKey metric display
mf-badge-success/warning/error/infoStatus badges

Themes:

ThemeStyleBest for
swissWhite, geometric, blue accentTechnical docs
midnightDeep navy, serif, gold accentPresentations
warmCream paper, bold sans, terracottaReports
terminalDark, monospace, cyan accentDeveloper content

render_slides

Generates a self-contained HTML slide deck with keyboard/touch navigation. No Docker required.

json
{  "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"}
ParameterTypeDefaultDescription
titlestringrequiredPresentation title
slidesstringrequiredJSON array of slide objects
themeswiss | midnight | warm | terminalswissVisual theme
authorstring--Author (shown on title slide)

Slide types:

TypeLayoutBest for
titleCentered large text + subtitleOpening/closing slides
sectionCentered heading + descriptionTopic dividers
contentHeading + body (bullets, text)Most content
splitHeading + two columnsBefore/after, comparisons
codeHeading + code blockCode walkthroughs
quoteLarge blockquote + attributionTestimonials, key quotes
kpiHeading + auto-grid metricsDashboards, stats
imageHeading + centered imageScreenshots, diagrams

Navigation: Arrow keys, Space, PageUp/PageDown, Home/End. Touch: swipe left/right. Click dots to jump.

list_assets

json
{ "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:

json
{  "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 graph syntax
  • D2: Mermaid syntax confusion (-->, subgraph), unbalanced braces
  • Graphviz: missing digraph/graph wrapper, -> in undirected graphs
  • Vega-Lite: invalid JSON, missing required fields, oversized inline data

Environment Variables

VariableDefaultDescription
PROJECT_ROOTcwd()Project root for output path resolution
OUTPUT_DIRdocs/generatedOutput directory relative to PROJECT_ROOT
MEDIA_FORGE_CONTAINERmedia-forge-rendererDocker container name

Development

bash
npm installnpm run build          # Build with tsupnpm run dev            # Watch modenpm 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 tsc

Running integration tests

bash
cd docker && docker compose up -d   # Start renderer (diagram tools only)cd .. && npm run test:component     # All integration tests

HTML page and slide integration tests run without Docker.

Examples

See examples/ for sample input files:

FileToolDescription
mermaid/flowchart.mmdrender_mermaidDecision flowchart
mermaid/sequence.mmdrender_mermaidClient-server sequence
d2/architecture.d2render_d2Backend architecture with containers
graphviz/dependencies.dotrender_graphviznpm dependency graph
vegalite/bar-chart.jsonrender_chartTool performance comparison

See examples/README.md for MCP tool call examples and expected responses.

License

MIT

来源:README.md,提交 315951c

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.2.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分