
buck-0x/eraser-io-mcp-server
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
A Python MCP (Model Context Protocol) server and CLI tool to render diagrams using the Eraser API.
개요
A Python MCP (Model Context Protocol) server and CLI tool to render diagrams using the Eraser API. - 📊 : Sequence, flowchart, ER, cloud architecture, and more - 🎨 : Themes, backgrounds, and scaling options - 📦 : Get image URLs or base64-encoded file content - 🔗 : Returns link to edit diagram in Eraser - ✅ : Checks for undefined icons and provides warnings - MCP Usage Guide - How to use with Claude Desktop, VS Code, Windsurf, or other environments. - Eraser Docs - General Eraser documentation - Eraser Diagram-as-code Documentation - Information about the syntax - Eraser DSL API Reference - Information about the endpoints and parameters used This will output JSON with the image URL: - --diagram-type (required): Type of diagram (e.g.
README
원문 README의 일부입니다. 원문 보기.
Eraser Diagram Renderer
A Python MCP (Model Context Protocol) server and CLI tool to render diagrams using the Eraser API.
Features
- 📊 Multiple Diagram Types: Sequence, flowchart, ER, cloud architecture, and more
- 🎨 Customizable: Themes, backgrounds, and scaling options
- 📦 Flexible Output: Get image URLs or base64-encoded file content
- 🔗 Eraser File URL: Returns link to edit diagram in Eraser
- ✅ Icon Validation: Checks for undefined icons and provides warnings
Documentation
- MCP Usage Guide - How to use with Claude Desktop, VS Code, Windsurf, or other environments.
- Eraser Docs - General Eraser documentation
- Eraser Diagram-as-code Documentation - Information about the syntax
- Eraser DSL API Reference - Information about the endpoints and parameters used
Basic Usage
python render_eraser_diagram.py --diagram-type sequence-diagram --code "Alice -> Bob: Hello"
This will output JSON with the image URL:
{
"success": true,
"message": "Diagram rendered successfully",
"image_url": "https://app.eraser.io/workspace/...",
"create_eraser_file_url": "https://app.eraser.io/workspace/..."
}
If undefined icons are detected:
{
"success": true,
"message": "Diagram rendered successfully",
"image_url": "https://app.eraser.io/workspace/...",
"create_eraser_file_url": "https://app.eraser.io/workspace/...",
"warning": "Warning: The following icons are not defined in the standard Eraser icons list: custom-icon. These icons may not render correctly. You can disable this warning by setting SKIP_ICON_CHECK=true."
}
Parameters
--diagram-type(required): Type of diagram (e.g., sequence-diagram, cloud-architecture-diagram)--code(required): Diagram code in Eraser syntax--return-file: Return base64-encoded image data instead of URL (defaults to False)--no-background: Disable background (defaults to background enabled)--theme: Choose “light” or “dark” theme (defaults to “light”)--scale: Scale factor - “1”, “2”, or “3” (defaults to “1”)
Note: Due to a bug in the Eraser API, the image cache is only invalidated when the diagram code changes. Changes to theme or background parameters alone will not generate a new image if the same code was previously rendered with different settings.
Authentication
For CLI usage, set your Eraser API token in one of these ways:
-
Environment variable:
export ERASER_API_TOKEN=your_token_here python render_eraser_diagram.py --diagram-type sequence-diagram --code "A -> B" -
.envfile in the project directory:echo "ERASER_API_TOKEN=your_token_here" > .env
For MCP server usage with Claude Desktop, see the MCP Usage Guide.
설치
docker run -p 8000:8000 \설정
{
"mcpServers": {
"eraser": {
"type": "streamable-http",
"url": "http://localhost:8000/mcp",
"headers": {
"Authorization": "Bearer your_auth_token"
}
}
}
}