PlantUML MCP Server
Enables AI assistants to generate UML diagrams from text descriptions using PlantUML, supporting multiple output formats (PNG, SVG, PDF), syntax validation, and diagram source extraction.
README
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:
git clone <repository-url>
cd planuml
- Install dependencies:
npm install
- Build the project:
npm run build
- Set the PlantUML JAR path (optional):
export PLANTUML_JAR=/path/to/plantuml.jar
Default path: /Users/userxxx/bin/plantuml.jar
Usage
As an MCP Server
Add to your MCP client configuration (e.g., Claude Desktop):
{
"mcpServers": {
"plantuml": {
"command": "node",
"args": ["xxx/dist/index.js"],
"env": {
"PLANTUML_JAR": "xxx/plantuml.jar"
}
}
}
}
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:
{
"source": "@startuml\nAlice -> Bob: Hello\n@enduml",
"format": "svg",
"darkMode": false
}
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:
{
"source": "@startuml\nAlice -> Bob: Hello\n@enduml"
}
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:
{
"filePath": "/path/to/diagram.png"
}
4. get_plantuml_version
Get PlantUML and Java version information.
Parameters: None
Returns: Version information
PlantUML Syntax Examples
Sequence Diagram
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
Class Diagram
@startuml
class User {
+String name
+String email
+login()
+logout()
}
class Admin {
+manageUsers()
}
User <|-- Admin
@enduml
Activity Diagram
@startuml
start
:Initialize;
if (Check condition?) then (yes)
:Process A;
else (no)
:Process B;
endif
stop
@enduml
Use Case Diagram
@startuml
left to right direction
actor User
actor Admin
rectangle System {
User -- (Login)
User -- (View Profile)
Admin -- (Manage Users)
Admin -- (View Reports)
}
@enduml
Development
Build
npm run build
Watch mode
npm run watch
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
Resources
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.