home / mcp / eraser diagram mcp server

Eraser Diagram MCP Server

Provides an HTTP MCP endpoint to render Eraser diagrams via the Eraser API, returning image URLs or base64 data with optional authentication.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "buck-0x-eraser-io-mcp-server": {
      "url": "http://localhost:8000/mcp",
      "headers": {
        "MCP_HOST": "0.0.0.0",
        "MCP_PORT": "8000",
        "MCP_TRANSPORT": "http",
        "MCP_AUTH_TOKEN": "optional_token",
        "ERASER_API_TOKEN": "your_token_here"
      }
    }
  }
}

You can run a Python MCP server that serves the Eraser Diagram Renderer over an MCP endpoint. This lets you render diagrams via the Eraser API from compatible MCP clients and receive either image URLs or base64 image data, with optional authentication and HTTP transport for remote access.

How to use

To use the server from an MCP client, connect to the HTTP MCP endpoint and issue render requests through the standard MCP transport. Start the server with HTTP transport, then configure your MCP client to point at the running endpoint. You will be able to render diagrams by sending a request that includes the diagram code and parameters, and you will receive a response containing either an image URL or base64-encoded image data, along with the link to edit the diagram in Eraser if desired.

Typical workflow you can perform from your MCP client includes: creating a diagram, specifying the diagram type (for example sequence-diagram, cloud-architecture-diagram, or flowchart-diagram), providing the Eraser syntax code, and selecting options such as theme and scale. The server also returns a link to edit the diagram in Eraser and warns about any undefined icons found in your diagram so you can adjust accordingly.

How to install

Prerequisites you need before installation: Python 3.10 or higher.

Install Python dependencies and the MCP server package using a package manager of your choice.

Install with pip (editable mode):

pip install -e .

Alternatively, use a fast Python package manager for editable installs:

uv pip install -e .

Run the HTTP transport server on a local port (example uses port 8000).

python main.py --transport http --port 8000

Access the MCP endpoint at the following URL when the server starts:

http://localhost:8000/mcp

Configuration and security

Environment variables required for the HTTP transport server: ERASER_API_TOKEN, MCP_TRANSPORT, MCP_HOST, MCP_PORT, and optionally MCP_AUTH_TOKEN for Bearer authentication.

export ERASER_API_TOKEN=your_token_here
export MCP_TRANSPORT=http
export MCP_HOST=0.0.0.0
export MCP_PORT=8000
export MCP_AUTH_TOKEN=optional_token

Examples

Start the server with HTTP transport on port 8000 and then connect a client to http://localhost:8000/mcp to send render requests.

Troubleshooting and notes

If you encounter issues, enable debugging output to see how your requests are being processed. Ensure your ERASER_API_TOKEN is valid and that the port is not in use by another process. If you enable MCP_AUTH_TOKEN, include the Authorization header with each request: Authorization: Bearer your_token.

Notes on tools and capabilities

The server exposes tools for rendering diagrams via the Eraser API and validating icon usage within diagrams. You can render diagrams and receive either image URLs or base64-encoded image data, and you will be warned if any icons are not defined in the standard Eraser icons list.

Available tools

render_diagram

Renders diagrams through the Eraser API and returns an image URL or base64 data, with optional editing link in Eraser.

validate_icons

Checks diagram icon references against the standard Eraser icons list and emits warnings for undefined icons.