AI-Powered Diagram Generation - From Natural Language to Professional Visuals
π Powered by Sargoth.xyz - The First & Only Free, No-Account Required Instant Mermaid Renderer on the Web
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:
- π¬ Describe your diagram needs in natural language to Claude/ChatGPT
- π€ LLM generates optimized Mermaid code automatically
- β‘ Our MCP server renders beautiful, production-ready visuals instantly
- π₯ Export as SVG or PNG with custom themes and scaling
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:
- π¨ Generate diagrams in real-time during conversations
- β Validate Mermaid syntax and suggest improvements
- π Create visual documentation and explanations
- π Help users build complex diagrams step by step
The MCP server exposes 4 powerful tools:
Generate SVG diagrams from Mermaid code with theme support.
Parameters:
code
(required): Mermaid diagram codetheme
(optional): Theme (modern
,classic
,dark
,minimal
)
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 syntax and analyze diagram complexity.
Parameters:
code
(required): Mermaid diagram code to validate
Analyze Mermaid code and suggest improvements or fixes.
Parameters:
code
(required): Mermaid diagram code to analyzediagram_type
(optional): Expected diagram type for targeted suggestions
- Python 3.8+ installed
- MCP-compatible AI assistant (Claude Desktop, etc.)
- Optional: Local Sargoth Mermaid Renderer API for development (see main project)
# 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:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
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:
- Open a new conversation
- Ask: "Can you create a flowchart showing a simple user login process?"
- Claude should use the Mermaid tools to generate the diagram!
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):
- No configuration needed
- Uses https://sargoth.xyz automatically
- Recommended for most users
Local Development:
- Run local API:
python ../app.py
- Use flag:
--api-url http://localhost:5000
- Useful for testing changes
Custom Deployment:
- Use your own hosted instance
- Specify with:
--api-url https://sargoth.xyz
- Check internet connection (production API requires online access)
- Ensure all dependencies are installed:
pip install -r requirements.txt
- Verify Python version:
python --version
(needs 3.8+) - For local development, ensure the local Mermaid API is running
- Check the MCP configuration file path
- Ensure the server path in config is absolute
- Restart your AI assistant after config changes
- Check logs for connection errors
- Production API: Check internet connection and try again
- Local API: Verify the API is accessible:
curl http://localhost:5000/health
- Test with simple Mermaid code first
- Check API logs for detailed error messages
- Firewall: Ensure outbound HTTPS connections are allowed
- Proxy: Configure proxy settings if behind corporate firewall
- Local Development: Verify local API is running on correct port
- Production API: Connects to https://sargoth.xyz over secure HTTPS
- Network: Requires outbound HTTPS access to sargoth.xyz for production use
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:
- Technical documentation
- Architecture diagrams
- Process flows
- Educational materials
This MCP server is part of the Sargoth Mermaid Renderer project. To contribute:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Submit a pull request
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! π
π Star this repo β’ π Main Project β’ π Report Bug