Enables generating diagrams in LaTeX/TikZ output format from PlantUML source code.
Supports generating diagrams in SVG vector graphics format and extracting PlantUML source code from SVG file metadata.
Wraps PlantUML functionality to generate UML diagrams from text descriptions, supporting syntax validation, diagram generation in multiple formats (PNG, SVG, PDF, etc.), and source extraction from diagram metadata.
PlantUML MCP Server
A Model Context Protocol (MCP) server that wraps PlantUML functionality, allowing AI assistants to generate UML diagrams from text descriptions.
Features
Generate Diagrams: Create diagrams in multiple formats (PNG, SVG, TXT, PDF, etc.)
Syntax Checking: Validate PlantUML syntax without generating images
Source Extraction: Extract PlantUML source from PNG/SVG metadata
Dark Mode Support: Generate diagrams with dark theme
Version Info: Get PlantUML and Java version information
Prerequisites
Node.js 18 or higher
Java Runtime Environment (JRE)
PlantUML JAR file
Installation
Clone this repository:
Install dependencies:
Build the project:
Set the PlantUML JAR path (optional):
Default path: /Users/userxxx/bin/plantuml.jar
Usage
As an MCP Server
Add to your MCP client configuration (e.g., Claude Desktop):
Available Tools
1. generate_diagram
Generate a diagram from PlantUML source code.
Parameters:
source(required): PlantUML source codeformat(optional): Output format -png,svg,txt,utxt,eps,latex,pdf(default:png)darkMode(optional): Render in dark mode (default:false)
Returns: Base64-encoded diagram data
Example:
2. check_syntax
Check PlantUML diagram syntax without generating images.
Parameters:
source(required): PlantUML source code to validate
Returns: Validation result or syntax errors
Example:
3. extract_source
Extract embedded PlantUML source from PNG or SVG metadata.
Parameters:
filePath(required): Path to the PNG or SVG file
Returns: Extracted PlantUML source code
Example:
4. get_plantuml_version
Get PlantUML and Java version information.
Parameters: None
Returns: Version information
PlantUML Syntax Examples
Sequence Diagram
Class Diagram
Activity Diagram
Use Case Diagram
Development
Build
Watch mode
Environment Variables
PLANTUML_JAR: Path to the PlantUML JAR file (default:/Users/userxxx/bin/plantuml.jar)
Supported Output Formats
png: PNG images (default)
svg: SVG vector graphics
txt: ASCII art diagrams
utxt: ASCII art with Unicode characters
eps: Encapsulated PostScript
latex: LaTeX/TikZ output
pdf: PDF documents
Error Handling
The server handles various error scenarios:
Invalid PlantUML syntax
Missing PlantUML JAR file
Java runtime errors
File I/O errors
Errors are returned with descriptive messages to help diagnose issues.
License
MIT