Diagram Bridge MCP Server
Bridges LLMs and diagram creation by providing intelligent format selection, format-specific instruction generation, and professional diagram rendering across 9+ formats including Mermaid, PlantUML, C4 Model, and GraphViz.
README
Diagram Bridge MCP Server
A comprehensive MCP server that bridges the gap between LLMs and diagram creation through three powerful, independent tools: intelligent format selection, format-specific instruction generation, and professional diagram rendering (using kroki server). Each tool can be used standalone or combined in sequence for complete diagram workflows - from choosing the right format to generating the final image.
Supported Formats: Mermaid, PlantUML, C4 Model, D2, GraphViz, BPMN, Structurizr, Excalidraw, Vega-Lite

Quick Start
-
Prerequisites:
- Node.js 18.0 or higher
- Docker and Docker Compose
-
Install and build:
git clone git@github.com:tohachan/diagram-bridge-mcp.git
cd diagram-bridge-mcp
npm install && npm run build
- Configure ports (optional):
# Copy and edit environment file to customize ports
cp .env.example .env
# Edit .env to set PORT and KROKI_PORT as needed
# Or set environment variables directly:
export PORT=4000 # MCP Server port (default: 3000)
export KROKI_PORT=9000 # Kroki service port (default: 8000)
- Start services:
# Option 1: Interactive port configuration
./scripts/start-with-ports.sh
# Option 2: Default ports (3000 for MCP, 8000 for Kroki)
docker-compose up --build
# Option 3: Custom ports via environment variables
PORT=4000 KROKI_PORT=9000 docker-compose up --build
- Add to Cursor (or any MCP client):
For direct local use (without Docker):
{
"mcpServers": {
"diagram-bridge-mcp": {
"command": "node",
"args": ["/path/to/diagram-bridge-mcp/dist/index.js"],
"enabled": true
}
}
}
For Docker-based setup (recommended):
{
"mcpServers": {
"diagram-bridge-mcp": {
"command": "docker",
"args": [
"exec",
"-i",
"diagram-bridge-mcp",
"node",
"dist/index.js"
],
"enabled": true
}
}
}
Note: The MCP protocol uses STDIO communication. The HTTP endpoints (:3000/health) are only for Docker monitoring, not for MCP client connections.
- Start using: The server provides three MCP tools ready for use!
💡 Usage Example
Here's a simple prompt to demonstrate the complete workflow:
"Choose the best diagram format for visualizing a current project architecture, then generate the diagram code and render it to an image file. Save the result as 'architecture-diagram'."
This single prompt will:
- Analyze your request and recommend the optimal format
- Get specific instructions for creating the diagram in that format
- Create and render the final diagram to a PNG/SVG file
🎨 Examples Gallery
Want to see what's possible? Check out Examples Gallery
🛠️ Tools Overview
help_choose_diagram
Purpose: Intelligent format selection based on your requirements
- Analyzes your request using AI-powered heuristics
- Provides confidence-scored recommendations
- Works with format constraints when needed
- Generates structured prompts for optimal LLM decision-making
Example: "I need to show database relationships" → Recommends Mermaid ER diagram format with detailed reasoning
get_diagram_instructions
Purpose: Generate format-specific coding instructions
- Creates tailored prompts for any supported diagram format
- Includes syntax guidelines, best practices, and common pitfalls
- Provides working examples and output specifications
- Ensures LLMs generate syntactically correct diagram code
Example: For Mermaid format → Detailed Mermaid syntax guide with examples
render_diagram
Purpose: Transform diagram code into professional images
- Renders diagrams via integrated Kroki service
- Supports PNG and SVG output formats
- Includes intelligent caching for performance
- Provides file storage with absolute paths for easy access
Example: Mermaid code → High-quality PNG/SVG image file
⚙️ Configuration
Basic Setup
- Default storage:
{project-root}/generated-diagrams/ - Default Kroki: Uses local Docker Kroki service
- Default ports: MCP Server (3000), Kroki (8000)
Port Configuration
The server automatically configures ports based on environment variables:
- External Port (
PORT): The port exposed by Docker container (default: 3000) - Kroki Port (
KROKI_PORT): The port for Kroki service (default: 8000) - Internal Communication: Services communicate internally using fixed container ports
# Interactive configuration (recommended)
./scripts/start-with-ports.sh
# Quick port change
PORT=4000 KROKI_PORT=9000 docker-compose up --build
# Check running services
curl http://localhost:4000/health # Using your custom PORT
Note: When running in Docker, the server provides HTTP endpoints for health monitoring at /health and service info at /info.
For advanced configuration, see our Configuration Guide.
📚 Documentation
- Quick Start: Port Configuration - Fast port setup guide
- Installation Guide - Detailed setup instructions
- Docker Deployment - Container deployment options
- API Reference - Complete tool and resource documentation
- Configuration Guide - Environment variables and MCP client setup
- Development Guide - Contributing and development setup
- Architecture - System architecture and design patterns
- Performance & Security - Performance metrics and security features
- Troubleshooting - Common issues and solutions
Perfect for: LLMs that need to create diagrams but don't know which format to use or how to render them professionally.
Powered by: Kroki - Universal diagram rendering service
Made with ❤️
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。