excalidraw-export-mcp
Provides tools to export Excalidraw diagrams to PNG or SVG format, including batch export and metadata retrieval.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@excalidraw-export-mcpExport ~/diagrams/architecture.excalidraw to PNG at scale 2"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Excalidraw Export MCP Server
An MCP (Model Context Protocol) server for exporting Excalidraw diagrams to PNG or SVG format.
Features
Export
.excalidrawfiles to PNG or SVGBatch export multiple files at once
Get diagram metadata (element count, types, bounds, etc.)
Pixel-perfect rendering using headless Chromium browser
Configurable export options (scale, dark mode, background)
Related MCP server: Excalidraw MCP App
Prerequisites
Node.js 18 or later
Playwright (Chromium is downloaded automatically on install)
Installation
npm install
npm run buildOn first install, Playwright will download Chromium automatically.
Usage
As an MCP Server
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"excalidraw-export": {
"command": "node",
"args": ["/path/to/excalidraw-export-mcp/dist/index.js"]
}
}
}Tools
export_excalidraw
Export a single Excalidraw diagram.
Parameters:
inputPath(required): Absolute path to the.excalidrawfileoutputPath: Output file path (defaults to input path with new extension)format:"png"or"svg"(default:"png")background: Include background color (default:true)darkMode: Export in dark mode (default:false)scale: Scale factor 1, 2, or 3 (default:2for high DPI)
export_excalidraw_batch
Export multiple diagrams at once.
Parameters:
inputPaths(required): Array of absolute paths to.excalidrawfilesoutputDir: Output directory (defaults to same directory as each input)format:"png"or"svg"(default:"png")background,darkMode,scale: Same as above
get_excalidraw_info
Get metadata about an Excalidraw file without exporting.
Parameters:
inputPath(required): Absolute path to the.excalidrawfile
Returns:
elementCount: Number of elements in the diagramelementTypes: Count of each element type (rectangle, arrow, text, etc.)hasBackground: Whether background is exportedbackgroundColor: Background colorversion: Excalidraw schema versionfileSize: File size in bytesbounds: Diagram dimensions (width, height)
Examples
Example 1: Export a Single Diagram to PNG
{
"tool": "export_excalidraw",
"arguments": {
"inputPath": "/Users/me/diagrams/architecture.excalidraw",
"format": "png",
"scale": 2
}
}Result:
{
"success": true,
"outputPath": "/Users/me/diagrams/architecture.png",
"format": "png",
"message": "Successfully exported to /Users/me/diagrams/architecture.png"
}Example 2: Export with Custom Output Path
{
"tool": "export_excalidraw",
"arguments": {
"inputPath": "/Users/me/docs/flowchart.excalidraw",
"outputPath": "/Users/me/images/flowchart-hires.png",
"scale": 3
}
}Example 3: Export in Dark Mode
{
"tool": "export_excalidraw",
"arguments": {
"inputPath": "/Users/me/diagrams/network.excalidraw",
"darkMode": true,
"background": true
}
}Example 4: Export to SVG
{
"tool": "export_excalidraw",
"arguments": {
"inputPath": "/Users/me/diagrams/logo.excalidraw",
"format": "svg"
}
}Example 5: Batch Export Multiple Diagrams
{
"tool": "export_excalidraw_batch",
"arguments": {
"inputPaths": [
"/Users/me/docs/diagram1.excalidraw",
"/Users/me/docs/diagram2.excalidraw",
"/Users/me/docs/diagram3.excalidraw"
],
"outputDir": "/Users/me/exports",
"format": "png",
"scale": 2
}
}Result:
{
"success": true,
"results": [
{
"inputPath": "/Users/me/docs/diagram1.excalidraw",
"outputPath": "/Users/me/exports/diagram1.png",
"success": true
},
{
"inputPath": "/Users/me/docs/diagram2.excalidraw",
"outputPath": "/Users/me/exports/diagram2.png",
"success": true
},
{
"inputPath": "/Users/me/docs/diagram3.excalidraw",
"outputPath": "/Users/me/exports/diagram3.png",
"success": true
}
],
"totalProcessed": 3,
"successful": 3,
"failed": 0
}Example 6: Get Diagram Information
{
"tool": "get_excalidraw_info",
"arguments": {
"inputPath": "/Users/me/diagrams/architecture.excalidraw"
}
}Result:
{
"elementCount": 15,
"elementTypes": {
"rectangle": 5,
"arrow": 6,
"text": 4
},
"hasBackground": true,
"backgroundColor": "#ffffff",
"version": 2,
"source": "https://excalidraw.com",
"fileSize": 12453,
"bounds": {
"width": 800,
"height": 600
}
}Example 7: Export Without Background (Transparent)
{
"tool": "export_excalidraw",
"arguments": {
"inputPath": "/Users/me/diagrams/icon.excalidraw",
"format": "png",
"background": false
}
}Claude Code Usage Examples
When using with Claude Code, you can ask:
Export a diagram:
"Export the architecture diagram at /path/to/architecture.excalidraw to PNG"
Export all diagrams in a folder:
"Export all .excalidraw files in the docs folder to PNG format"
Get diagram info before exporting:
"What's in the diagram at /path/to/diagram.excalidraw? How many elements does it have?"
Create high-resolution exports:
"Export diagram.excalidraw at 3x scale for printing"
Dark mode exports:
"Export the network diagram in dark mode"
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Run all tests
npm test
# Run unit tests only (faster, no browser)
npm run test:unit
# Run integration tests (requires Playwright/Chromium)
npm run test:integrationTest Suite
The project includes a comprehensive test suite:
Unit Tests (tests/get-info.test.ts)
Element counting and categorization
Bounds calculation
AppState property extraction
Edge cases (empty elements, missing properties)
Schema Validation Tests (tests/mcp-server.test.ts)
Zod schema validation for all tool inputs
Default value handling
Required field validation
Boundary conditions (scale min/max)
Tool definition structure validation
Integration Tests (tests/export.test.ts)
Full export pipeline with Playwright
PNG file validation (magic bytes check)
Page reload handling
Canvas capture
Batch processing
Error recovery
To skip integration tests (if Chromium is not installed):
SKIP_INTEGRATION=true npm testHow It Works
This server uses Playwright to run a headless Chromium browser that:
Navigates to excalidraw.com
Loads your diagram data via localStorage
Captures a screenshot of the rendered canvas
This approach ensures pixel-perfect rendering identical to the Excalidraw web app.
Troubleshooting
Chromium not installed
If you see "Executable doesn't exist" errors, run:
npx playwright install chromiumTimeout errors
For large diagrams, the export may take longer. The server includes automatic retries and page reload handling.
Memory issues with batch exports
For very large batches, consider breaking them into smaller chunks or increasing Node.js memory:
NODE_OPTIONS="--max-old-space-size=4096" node dist/index.jsPublishing to npm
Prerequisites
Create an npm account at https://www.npmjs.com/
Generate an access token with publish permissions
Add the token as
NPM_TOKENsecret in GitHub repository settings
Automated Publishing (Recommended)
Publishing is automated via GitHub Actions. To publish a new version:
Update the version in
package.json:npm version patch # or minor, majorPush the changes and create a GitHub release:
git push && git push --tagsCreate a release on GitHub from the tag - this triggers the publish workflow
Manual Publishing
To publish manually:
# Login to npm
npm login
# Build and test
npm run build
npm run test:unit
# Publish
npm publish --access publicVersion Guidelines
Patch (0.1.x): Bug fixes, documentation updates
Minor (0.x.0): New features, non-breaking changes
Major (x.0.0): Breaking changes
Using from npm
Once published, users can install directly:
npm install -g excalidraw-export-mcpOr use with npx:
npx excalidraw-export-mcpLicense
MIT
Available Tools
3 toolsexport_excalidrawA
Export an Excalidraw diagram to PNG or SVG format. Uses a headless browser for pixel-perfect rendering identical to excalidraw.com.
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Export scale factor (1, 2, or 3) | |
| format | No | Output format: png or svg | png |
| darkMode | No | Export in dark mode | |
| inputPath | Yes | Absolute path to the .excalidraw file | |
| background | No | Include background color in export | |
| outputPath | No | Output file path. If not provided, uses input path with .png/.svg extension |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description adds one behavioral detail: it uses a headless browser for rendering identical to excalidraw.com. However, with no annotations provided, the description carries the full burden. It does not disclose side effects (e.g., file creation, overwriting behavior), performance implications, or required permissions. The rendered output fidelity is a positive but incomplete disclosure.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is highly concise, consisting of two sentences that are front-loaded with the core purpose. Every sentence adds value—the first states the action and formats, the second clarifies the rendering method. There is no redundant or filler content.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of 6 parameters (1 required) and no output schema, the description covers the primary action but lacks details on output file behavior (e.g., where files are saved, naming conventions, return values). It mentions rendering quality but not the process of file creation or error handling. The description is adequate for a simple tool but incomplete for a tool with multiple parameters and no output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% (all parameters have descriptions in the schema), so the baseline is 3. The description does not add any additional meaning beyond the schema—it does not explain parameter usage, constraints, or relationships. The schema itself provides adequate documentation, but the description contributes nothing extra.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool exports an Excalidraw diagram to PNG or SVG format, with the added detail of using a headless browser for pixel-perfect rendering. The verb 'Export' and resource 'Excalidraw diagram' are specific, and the mention of formats distinguishes it from sibling tools like export_excalidraw_batch (batch export) and get_excalidraw_info (info retrieval).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus its siblings (export_excalidraw_batch for batch, get_excalidraw_info for information). There is no mention of prerequisites, context for use, or alternatives. The tool's purpose is implied but not contrasted with similar tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
export_excalidraw_batchB
Export multiple Excalidraw diagrams to PNG or SVG format in batch.
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Export scale factor (1, 2, or 3) | |
| format | No | Output format: png or svg | png |
| darkMode | No | Export in dark mode | |
| outputDir | No | Output directory. If not provided, exports next to each input file | |
| background | No | Include background color in export | |
| inputPaths | Yes | Array of absolute paths to .excalidraw files |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, and description fails to disclose behavioral traits such as file creation behavior, overwrite policy, side effects, or performance considerations. Minimal for a batch operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence with no wasted words. Front-loaded with essential information (batch export, formats).
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 6 parameters, no output schema, and no annotations, description lacks details on output behavior, error handling, and naming conventions. Inadequate for an agent to use confidently.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so description adds no extra meaning beyond parameter descriptions in schema. Baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states verb 'Export', resource 'multiple Excalidraw diagrams', and formats 'PNG or SVG in batch'. It effectively distinguishes from sibling 'export_excalidraw' which likely handles single files.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Description implies batch usage but does not explicitly state when to use this tool over alternatives like 'export_excalidraw'. No guidance on prerequisites or context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_excalidraw_infoA
Get metadata about an Excalidraw diagram (element count, types, dimensions, etc.)
| Name | Required | Description | Default |
|---|---|---|---|
| inputPath | Yes | Absolute path to the .excalidraw file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It correctly indicates a read operation (get metadata) with no side effects, but it does not disclose additional behavioral details like error handling, performance, or file existence requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Single sentence, no waste, front-loaded with action and resource. Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with one parameter and no output schema. The description lists example metadata but ends with 'etc.', leaving the full response structure undefined. Adequate but incomplete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% (parameter described). The description adds no extra meaning beyond the schema, which already states 'Absolute path to the .excalidraw file'. Baseline score is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses the specific verb 'Get' and clearly states the resource 'metadata about an Excalidraw diagram', specifying the types of metadata (element count, types, dimensions). It effectively distinguishes from sibling export tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when metadata is needed rather than export, but it does not explicitly state when to use this tool over siblings or provide any when-not guidance. Usage is implicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.0.1- First observed
export_excalidraw - First observed
export_excalidraw_batch - First observed
get_excalidraw_info
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose: single export, batch export, and metadata retrieval. There is no overlap or ambiguity.
Two tools use the 'export_excalidraw' prefix consistently, but 'get_excalidraw_info' deviates by using 'get_' instead of 'export_'. Minor inconsistency.
Three tools is a reasonable, focused set for the server's purpose of exporting and inspecting Excalidraw diagrams. Not overly thin.
The tool surface covers the core functionality (single/batch export and metadata). Missing features like format conversion or diagram editing are outside the stated scope.
Maintenance
Related MCP Connectors
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
MCP server for RiverScript, an AI transcription platform - fetches transcripts shared via a link.
MCP server for Flux AI image generation
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides API functionality for creating, managing, and exporting Excalidraw drawings in various formats like SVG, PNG, and JSON.82,102 npm45MIT
- FlicenseNot gradedqualityCmaintenanceMCP server that streams hand-drawn Excalidraw diagrams with smooth viewport camera control and interactive fullscreen editing.-
- AlicenseAqualityBmaintenanceAn MCP server for Excalidraw diagram creation and headless rendering, enabling interactive canvas editing and automated SVG/PNG export via Playwright.41MIT
- AlicenseAqualityDmaintenanceMCP server that converts Mermaid diagrams to styled Excalidraw files, saving them directly to disk without token overhead.2MIT