MCP Server for the Sargoth Mermaid Editor API
AI-Powered Diagram Generation - From Natural Language to Professional Visuals
Seamlessly convert your ideas into stunning diagrams using AI. Simply describe your workflow, process, or system in plain English to your LLM assistant, and instantly get professional SVG/PNG diagrams rendered through our high-performance Mermaid engine.
The Perfect AI Workflow:
Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. By creating an MCP server for our Mermaid renderer, we allow AI assistants to:
The MCP server exposes 4 powerful tools:
render_mermaid_svg
Generate SVG diagrams from Mermaid code with theme support.
Parameters:
code
(required): Mermaid diagram codetheme
(optional): Theme (modern
, classic
, dark
, minimal
)render_mermaid_png
Generate PNG images from Mermaid code with scaling.
Parameters:
code
(required): Mermaid diagram codetheme
(optional): Theme (modern
, classic
, dark
, minimal
)scale
(optional): PNG scale factor (1-4, default: 2)validate_mermaid
Validate Mermaid syntax and analyze diagram complexity.
Parameters:
code
(required): Mermaid diagram code to validatesuggest_mermaid_improvements
Analyze Mermaid code and suggest improvements or fixes.
Parameters:
code
(required): Mermaid diagram code to analyzediagram_type
(optional): Expected diagram type for targeted suggestions## Install MCP server dependencies
pip install -r requirements.txt
chmod +x mcp_server.py
Using Production API (Recommended):
## Test with the live production API
python mcp_server.py
Using Local Development API:
## Start your local Mermaid API first
python ../app.py
## In another terminal, test the MCP server with local API
python mcp_server.py --api-url http://localhost:5000
Locate your Claude Desktop config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Add the MCP server configuration:
For Production Use (Recommended):
{
"mcpServers": {
"mermaid-renderer": {
"command": "python",
"args": ["/absolute/path/to/mcp_server.py"]
}
}
}
For Local Development:
{
"mcpServers": {
"mermaid-renderer": {
"command": "python",
"args": ["/absolute/path/to/mcp_server.py", "--api-url", "http://localhost:5000"]
}
}
}
Restart Claude Desktop
Test the integration:
Production Configuration:
{
"command": "python",
"args": ["mcp_server.py"]
}
Local Development Configuration:
{
"command": "python",
"args": ["mcp_server.py", "--api-url", "http://localhost:5000"]
}
Once integrated, you can ask your AI assistant things like:
“Create a sequence diagram showing how a user logs into a web application”
“Check this Mermaid code for errors:
graph TD A -> B
”
“Generate a flowchart for a CI/CD pipeline, then convert it to PNG format”
“Create a class diagram for a simple e-commerce system and explain each component”
You: “Can you create a state diagram for a simple traffic light system?”
AI Assistant: Uses render_mermaid_svg
tool
stateDiagram-v2
[*] --> Red
Red --> Green : Timer
Green --> Yellow : Timer
Yellow --> Red : Timer
Red --> [*]
AI: “I’ve created an SVG diagram of a traffic light state machine! The diagram shows the three states (Red, Green, Yellow) and the timer-based transitions between them. Would you like me to convert this to PNG format or modify the design?”
The MCP server uses the production API at https://sargoth.xyz by default. No additional configuration is needed for most users.
MERMAID_API_URL
: Override the API base URL (optional)python mcp_server.py --help
## Use production API (default)
python mcp_server.py
## Use local development API
python mcp_server.py --api-url http://localhost:5000
## Use custom API endpoint
python mcp_server.py --api-url https://sargoth.xyz
Production (Default):
Local Development:
python ../app.py
--api-url http://localhost:5000
Custom Deployment:
--api-url https://sargoth.xyz
pip install -r requirements.txt
python --version
(needs 3.8+)curl http://localhost:5000/health
The server supports all themes available in your Mermaid renderer:
modern
(default)classic
dark
minimal
While the MCP protocol processes tools individually, you can ask the AI to generate multiple diagrams in sequence.
Use the MCP server to automatically generate diagrams for:
This MCP server is part of the Sargoth Mermaid Renderer project. To contribute:
Same as the main Sargoth Mermaid Renderer project.
Ready to supercharge your AI assistant with diagram generation?
Install the MCP server and start creating beautiful visuals in your conversations! 🚀
Mcp Codex Keeper
An intelligent MCP server that serves as a guardian of development knowledge, providing Cline assistants with curated access to latest documentation and best practices across the software development landscape
Mcp Selenium
An MCP implementation for Selenium WebDriver
Higress Ai Search Mcp Server
An MCP server enhances AI responses with real-time search results via Higress ai-search.
A MCP server for Resend API. Let LLMs compose and send emails for you.
Obsidian Knowledge-Management MCP (Model Context Protocol) server that enables AI agents and development tools to interact with an Obsidian vault. It provides a comprehensive suite of tools for reading, writing, searching, and managing notes, tags, and frontmatter, acting as a bridge to the Obsidian Local REST API plugin.
MCP server for generating human face images with various shapes and sizes