Eraser Diagram Renderer logo

Eraser Diagram Renderer

Community
buck-0x

A Python MCP (Model Context Protocol) server and CLI tool to render diagrams using the Eraser API.

Publisherbuck-0x
Repositoryeraser-io-mcp-server
LanguagePython
Forks
5
Stars
22
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Eraser Diagram Renderer exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    22 stars and 5 forks from the linked repository.

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

bash
python render_eraser_diagram.py --diagram-type sequence-diagram --code "Alice -> Bob: Hello"

This will output JSON with the image URL:

json
{
  "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:

json
{
  "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:

    bash
    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:

    bash
    echo "ERASER_API_TOKEN=your_token_here" > .env

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

Icon Validation

This tool validates icon references against the standard Eraser icons list (provided in eraser-standard-icons.csv). If you use custom icons that aren't in the standard list:

  • You'll receive a warning in the response

  • The diagram will still be generated

  • To disable icon validation, set SKIP_ICON_CHECK=true:

    bash
    SKIP_ICON_CHECK=true python render_eraser_diagram.py --diagram-type flowchart --code "custom-icon: My Service"

Handling Special Characters

For multi-line diagrams and special characters:

  • Use \n for line breaks
  • Use \" for quotes within the code
  • Use \\ for literal backslashes

Examples

Multi-line sequence diagram (returns URL):

bash
python render_eraser_diagram.py --diagram-type sequence-diagram \
  --code "Alice -> Bob: Hello\nBob -> Alice: Hi there\nAlice -> Bob: How are you?"

Output:

json
{
  "success": true,
  "message": "Diagram rendered successfully",
  "image_url": "https://app.eraser.io/workspace/...",
  "create_eraser_file_url": "https://app.eraser.io/workspace/..."
}

With JSON data and return file:

bash
python render_eraser_diagram.py --diagram-type sequence-diagram \
  --code "User -> API: POST /data {\"key\": \"value\"}\nAPI -> User: 200 OK" \
  --return-file

Output:

json
{
  "success": true,
  "message": "Diagram rendered successfully",
  "image_blob": "iVBORw0KGgoAAAANSUhEUgA..."
}

Cloud architecture with light theme:

bash
python render_eraser_diagram.py --diagram-type cloud-architecture-diagram \
  --code "AWS S3 Bucket\n|\nAWS Lambda" --theme light

Debug mode to see processed code:

bash
DEBUG=1 python render_eraser_diagram.py --diagram-type sequence-diagram \
  --code "A -> B: Test\nB -> C: Response"

Supported Diagram Types

Requirements

  • Python 3.10 or higher
  • Eraser API token

Installation

Using pip:

bash
pip install -e .

Using uv (fast Python package manager):

bash
uv pip install -e .

HTTP Transport (Streamable HTTP)

The server supports both stdio (default) and Streamable HTTP transport for remote access.

Running with HTTP Transport

bash
# Local HTTP server
python main.py --transport http --port 8000

# Server will be available at http://localhost:8000/mcp

Environment Variables

VariableDefaultDescription
ERASER_API_TOKEN(required)Your Eraser.io API token
MCP_TRANSPORTstdioTransport protocol: stdio or http
MCP_HOST0.0.0.0Host to bind for HTTP transport
MCP_PORT8000Port to bind for HTTP transport
MCP_AUTH_TOKEN(empty)Bearer token for HTTP authentication (optional)

Bearer Token Authentication

To enable authentication for the HTTP endpoint, set MCP_AUTH_TOKEN:

bash
export MCP_AUTH_TOKEN=your_secret_token
python main.py --transport http

Clients must include the token in the Authorization header:

Authorization: Bearer your_secret_token

Docker Deployment

Using Docker Compose (Recommended)

  1. Copy .env.example to .env and configure:

    bash
    cp .env.example .env
    # Edit .env with your ERASER_API_TOKEN
  2. Start the server:

    bash
    docker-compose up -d
  3. The server will be available at http://localhost:8000/mcp

Using Docker Directly

bash
# Build
docker build -t eraser-mcp .

# Run
docker run -p 8000:8000 \
  -e ERASER_API_TOKEN=your_token \
  -e MCP_AUTH_TOKEN=optional_auth_token \
  eraser-mcp

Client Configuration for HTTP

Configure your MCP client to connect via Streamable HTTP:

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

Troubleshooting

  • If you get an API error, check that your token in .env is valid
  • Use DEBUG=1 to see how your code is being processed
  • Ensure proper escaping of special characters in your shell
  • If you see icon warnings, check if your icons are custom or set SKIP_ICON_CHECK=true
  • For HTTP transport issues, check that the port is not in use and firewall allows connections

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "buck-0x-eraser-io-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "eraser-io-mcp-server"
      ]
    }
  }
}

Use Eraser Diagram Renderer MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Eraser Diagram Renderer is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Eraser Diagram Renderer as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Eraser Diagram Renderer MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "buck-0x-eraser-io-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "eraser-io-mcp-server"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Eraser Diagram Renderer MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Eraser Diagram Renderer MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Eraser Diagram Renderer to help me with this task?
Eraser Diagram Renderer
Sure. I read it.
Here is what I found using Eraser Diagram Renderer.

Option 2: Add an MCP server URL

Use this when Eraser Diagram Renderer is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for Eraser Diagram Renderer.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Eraser Diagram Renderer connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Eraser Diagram Renderer tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Eraser Diagram Renderer tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Eraser Diagram Renderer to help me with this task?
Eraser Diagram Renderer
Sure. I read it.
Here is what I found using Eraser Diagram Renderer.

Frequently asked questions

What is the Eraser Diagram Renderer MCP server used for?

Eraser Diagram Renderer is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Eraser Diagram Renderer MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Eraser Diagram Renderer with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Eraser Diagram Renderer MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Eraser Diagram Renderer connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Eraser Diagram Renderer MCP to TypingMind?

Eraser Diagram Renderer can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Eraser Diagram Renderer MCP provide in TypingMind?

Eraser Diagram Renderer exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Eraser Diagram Renderer MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Eraser Diagram Renderer requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇