B0

buck-0x/eraser-io-mcp-server

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

23 stars 5 forks 品質 73 トレンド 10MIT

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

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:

  1. Environment variable:

    export ERASER_API_TOKEN=your_token_here
    python render_eraser_diagram.py --diagram-type sequence-diagram --code "A -> B"
    
  2. .env file in the project directory:

    echo "ERASER_API_TOKEN=your_token_here" > .env
    

For MCP server usage with Claude Desktop, see the MCP Usage Guide.

GitHub で README 全文を見る

インストール

docker run -p 8000:8000 \
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "eraser": { "type": "streamable-http", "url": "http://localhost:8000/mcp", "headers": { "Authorization": "Bearer your_auth_token" } } } }