eraser-io
A Python MCP (Model Context Protocol) server and CLI tool to render diagrams using the Eraser API.
claude mcp add --transport stdio buck-0x-eraser-io-mcp-server python main.py --transport http --port 8000 \ --env MCP_HOST="0.0.0.0" \ --env MCP_PORT="8000" \ --env MCP_TRANSPORT="http" \ --env MCP_AUTH_TOKEN="Optional bearer token for HTTP authentication" \ --env ERASER_API_TOKEN="Your Eraser.io API token"
How to use
This MCP server exposes an HTTP transport endpoint that renders diagrams using the Eraser API. It runs as a Python service and communicates via the Model Context Protocol over a streamable HTTP interface. To use it, configure an MCP client to connect to http://<host>:8000/mcp using the streamable-http type. Provide your Eraser API token via the ERASER_API_TOKEN environment variable when starting the server, and, if you want to restrict access, set MCP_AUTH_TOKEN with a Bearer token and include it in the Authorization header on requests. The server supports the same Eraser diagram-as-code commands you’d use in the CLI, and returns either an image URL or a base64-encoded file depending on how you request the output. If the diagram uses undefined icons, you’ll receive a warning in the response but the diagram can still be generated. You can also customize themes, backgrounds, and scaling through the CLI or API parameters, mirroring the capabilities available in the Eraser CLI tools.
How to install
Prerequisites:
- Python 3.10 or higher
- Access to install Python packages (pip)
Install steps:
-
Clone the repository or download the server package.
-
Install the package in editable mode (as shown by the project):
pip install -e .
-
Run the MCP server via the provided entry point (as configured in the mcp_config):
python main.py --transport http --port 8000
-
Ensure your environment variables are set prior to starting the server:
- ERASER_API_TOKEN: your Eraser.io API token
- MCP_TRANSPORT: http (default in this setup)
- MCP_HOST: 0.0.0.0 or your host
- MCP_PORT: 8000 (or your chosen port)
- MCP_AUTH_TOKEN: (optional) Bearer token for HTTP authentication
-
Verify the server is listening by visiting http://localhost:8000/mcp or by testing with an MCP client.
Optional for development with uv (Python package manager):
- uv pip install -e .
Note: The README indicates the server can be run with HTTP transport and supports standard Eraser diagram-as-code usage via the CLI as well as the MCP endpoint.
Additional notes
Tips and considerations:
- Use ERASER_API_TOKEN securely; don’t commit tokens to version control.
- When using HTTP transport, you can enable Bearer token authentication by setting MCP_AUTH_TOKEN and sending the token in the Authorization header.
- The server follows the same diagram types and options as the Eraser CLI: diagram types (e.g., sequence-diagram, cloud-architecture-diagram, flowchart-diagram, ER, etc.), code syntax, theme (light/dark), scale, and the option to return image URLs or base64-encoded data.
- If you encounter API errors, check the ERASER_API_TOKEN and ensure it’s valid for the configured environment.
- Debugging can be enhanced by setting DEBUG=1 when launching the Python process to inspect how the code is processed.
- For HTTP transport issues, verify that the chosen port is not in use and that firewall rules permit inbound connections if running on a server.
- Icon validation warnings will appear if custom icons are used; you can bypass this by setting SKIP_ICON_CHECK=true in the environment for the run.
- The MCP endpoints expect diagram parameters similar to the CLI: --diagram-type and --code, plus optional flags like --return-file, --no-background, --theme, and --scale.
Related MCP Servers
Wax
Sub-Millisecond RAG on Apple Silicon. No Server. No API. One File. Pure Swift
furi
CLI & API for MCP management
Pare
Dev tools, optimized for agents. Structured, token-efficient MCP servers for git, test runners, npm, Docker, and more.
workflowy
Powerful CLI and MCP server for WorkFlowy: reports, search/replace, backup support, and AI integration (Claude, LLMs)
drawio
A Model Context Protocol (MCP) server for programmatic diagram generation using Draw.io (Diagrams.net). This server generates Draw.io XML directly — no browser extension or Draw.io instance required.
azure-diagram
MCP server that turns natural-language prompts into Microsoft Azure architecture diagrams (PNG) using Python Diagrams + Graphviz.