
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
excalidraw-mcp
Advanced tools
๐ Acknowledgments This project is based on and extends the excellent work from yctimlin/mcp_excalidraw. Special thanks to the original contributors for creating the foundation that made this enhanced version possible.
A dual-language MCP (Model Context Protocol) server that combines Excalidraw's powerful drawing capabilities with AI integration, enabling AI agents like Claude to create and manipulate diagrams in real-time on a live canvas.
Features Python FastMCP server with TypeScript canvas server for optimal performance and maintainability.
See MCP Excalidraw in Action!
Watch how AI agents create and manipulate diagrams in real-time on the live canvas
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ AI Agent โโโโโถโ MCP Server โโโโโถโ Canvas Server โ
โ (Claude) โ โ (Python) โ โ (Express.js) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Frontend โ
โ (React + WS) โ
โโโโโโโโโโโโโโโโโโโ
Hybrid Architecture Benefits:
git clone https://github.com/lesleslie/excalidraw-mcp.git
cd excalidraw-mcp
# Install Python dependencies
uv sync
# Install Node.js dependencies and build
npm install
npm run build
# The Python MCP server auto-starts the canvas server
uv run python excalidraw_mcp/server.py
# Or manually start canvas server (optional)
npm run canvas
Open your browser and navigate to:
http://localhost:3031
# Development mode (TypeScript watch + Vite dev server)
npm run dev
# Or production mode
npm run production
| Script | Description |
|---|---|
npm start | Build and start MCP server (dist/index.js) |
npm run canvas | Build and start canvas server (dist/server.js) |
npm run canvas-bg | Build and start canvas server in background |
npm run start-canvas | Build and start canvas server |
npm run canvas-for-npx | Special script for npx usage |
npm run start-all | Start both servers together |
npm run build | Build both frontend and TypeScript backend |
npm run build:frontend | Build React frontend only |
npm run build:server | Compile TypeScript backend to JavaScript |
npm run build:types | Generate TypeScript declaration files only |
npm run dev | Start TypeScript watch mode + Vite dev server |
npm run dev:server | Start TypeScript in watch mode only |
npm run type-check | Run TypeScript type checking without compilation |
npm run production | Build + start in production mode |
npm test | Run all tests |
npm run test:watch | Run tests in watch mode |
npm run test:coverage | Run tests with coverage report |
npm run test:unit | Run unit tests only |
npm run test:integration | Run integration tests only |
http://localhost:3031The MCP server provides these tools for creating visual diagrams:
// Create a rectangle
{
"type": "rectangle",
"x": 100,
"y": 100,
"width": 200,
"height": 100,
"backgroundColor": "#e3f2fd",
"strokeColor": "#1976d2",
"strokeWidth": 2
}
{
"type": "text",
"x": 150,
"y": 125,
"text": "Process Step",
"fontSize": 16,
"strokeColor": "#333333"
}
{
"type": "arrow",
"x": 300,
"y": 130,
"width": 100,
"height": 0,
"strokeColor": "#666666",
"strokeWidth": 2
}
{
"elements": [
{
"type": "rectangle",
"x": 100,
"y": 100,
"width": 120,
"height": 60,
"backgroundColor": "#fff3e0",
"strokeColor": "#ff9800"
},
{
"type": "text",
"x": 130,
"y": 125,
"text": "Start",
"fontSize": 16
}
]
}
Add this configuration to your Claude Code .mcp.json:
{
"mcpServers": {
"excalidraw": {
"command": "uvx",
"args": ["excalidraw-mcp"],
"env": {
"EXPRESS_SERVER_URL": "http://localhost:3031",
"ENABLE_CANVAS_SYNC": "true"
}
}
}
}
For local development, use:
{
"mcpServers": {
"excalidraw": {
"command": "uv",
"args": ["run", "python", "excalidraw_mcp/server.py"],
"cwd": "/absolute/path/to/excalidraw-mcp"
}
}
}
Important: Replace /absolute/path/to/excalidraw-mcp with the actual absolute path to your cloned repository.
Add to your .cursor/mcp.json:
{
"mcpServers": {
"excalidraw": {
"command": "uvx",
"args": ["excalidraw-mcp"],
"env": {
"EXPRESS_SERVER_URL": "http://localhost:3031"
}
}
}
}
For VS Code MCP extension, add to your settings:
{
"mcp": {
"servers": {
"excalidraw": {
"command": "uvx",
"args": ["excalidraw-mcp"],
"env": {
"EXPRESS_SERVER_URL": "http://localhost:3031"
}
}
}
}
}
| Variable | Default | Description |
|---|---|---|
EXPRESS_SERVER_URL | http://localhost:3031 | Canvas server URL for MCP sync |
ENABLE_CANVAS_SYNC | true | Enable/disable canvas synchronization |
CANVAS_AUTO_START | true | Auto-start canvas server with MCP server |
SYNC_RETRY_ATTEMPTS | 3 | Number of retry attempts for failed operations |
SYNC_RETRY_DELAY_SECONDS | 1.0 | Base delay between retry attempts (seconds) |
SYNC_RETRY_MAX_DELAY_SECONDS | 30.0 | Maximum delay between retry attempts (seconds) |
SYNC_RETRY_EXPONENTIAL_BASE | 2.0 | Exponential base for backoff calculation |
SYNC_RETRY_JITTER | true | Enable/disable jitter for retry delays |
PORT | 3031 | Canvas server port |
HOST | localhost | Canvas server host |
DEBUG | false | Enable debug logging |
The canvas server provides these REST endpoints:
| Method | Endpoint | Description |
|---|---|---|
GET | /api/elements | Get all elements |
POST | /api/elements | Create new element |
PUT | /api/elements/:id | Update element |
DELETE | /api/elements/:id | Delete element |
POST | /api/elements/batch | Create multiple elements |
GET | /health | Server health check |
create_element - Create any type of Excalidraw elementupdate_element - Modify existing elementsdelete_element - Remove elementsquery_elements - Search elements with filtersbatch_create_elements - Create complex diagrams in one callgroup_elements - Group multiple elementsungroup_elements - Ungroup element groupsalign_elements - Align elements (left, center, right, top, middle, bottom)distribute_elements - Distribute elements evenlylock_elements / unlock_elements - Lock/unlock elementsget_resource - Access scene, library, theme, or elements datafrontend/src/)@excalidraw/excalidraw package with TypeScript typessrc/server.ts โ dist/server.js)excalidraw_mcp/server.py)src/types.ts)npm run build completed successfullyENABLE_CANVAS_SYNC=true in environmenthttp://localhost:3031/healthnode_modules and run npm installnpm run type-check to identify TypeScript issuesuv sync to update Python dependenciesuv sync to install/update Python dependenciesuv --version to verify uv installationexcalidraw-mcp/
โโโ examples/ # Usage examples
โโโ excalidraw_mcp/ # Python FastMCP server
โ โโโ monitoring/ # Monitoring and health check utilities
โ โโโ server.py # Main MCP server (Python)
โ โโโ config.py # Configuration management
โ โโโ element_factory.py # Element creation utilities
โ โโโ http_client.py # HTTP client for canvas server
โ โโโ process_manager.py # Canvas server lifecycle management
โ โโโ retry_utils.py # Retry mechanisms for failed operations
โ โโโ cli.py # Command-line interface
โ โโโ mcp_tools.py # MCP tool implementations
โ โโโ __init__.py # Package initialization
โ โโโ __main__.py # Main entry point
โโโ frontend/ # React frontend
โ โโโ src/
โ โ โโโ App.tsx # Main React component (TypeScript)
โ โ โโโ main.tsx # React entry point (TypeScript)
โ โโโ index.html # HTML template
โโโ src/ # TypeScript canvas server
โ โโโ middleware/ # Express middleware components
โ โโโ storage/ # Element storage implementations
โ โโโ utils/ # Utility functions
โ โโโ websocket/ # WebSocket server components
โ โโโ config.ts # Server configuration
โ โโโ server.ts # Express server + WebSocket (TypeScript)
โ โโโ types.ts # Type definitions
โโโ dist/ # Compiled TypeScript output
โ โโโ server.js # Compiled canvas server
โ โโโ server.d.ts # Server type definitions
โ โโโ server.js.map # Server source maps
โ โโโ types.js # Compiled type definitions
โ โโโ types.d.ts # Type definition files
โ โโโ types.js.map # Type definition source maps
โ โโโ utils/ # Compiled utilities
โ โโโ assets/ # Frontend assets
โ โโโ frontend/ # Built React frontend
โโโ tests/ # Python test suite
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โ โโโ security/ # Security tests
โ โโโ performance/ # Performance tests
โ โโโ e2e/ # End-to-end tests
โโโ .github/ # GitHub configurations
โโโ pyproject.toml # Python project configuration
โโโ package.json # Node.js dependencies and scripts
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This file
This project uses consistent naming across different contexts:
excalidraw_mcp (underscore) - used in imports and Python module referencesexcalidraw-mcp (hyphen) - used for uvx excalidraw-mcp and pip installationexcalidraw-mcp (hyphen) - used for Node.js dependenciesexcalidraw - used in .mcp.json configurationExample Usage:
# Python imports (underscore)
from excalidraw_mcp.server import main
# Shell commands (hyphen)
uvx excalidraw-mcp
pip install excalidraw-mcp
# Python tests with coverage
pytest --cov=excalidraw_mcp --cov-report=html
pytest --cov=excalidraw_mcp --cov-report=term-missing
# TypeScript tests with coverage
npm run test:coverage
# Run all tests
pytest && npm test
# Specific test categories
pytest tests/unit/ # Python unit tests
pytest tests/integration/ # Python integration tests
pytest -m security # Security tests
pytest -m performance # Performance benchmarks
npm run test:unit # TypeScript unit tests
npm run test:integration # TypeScript integration tests
This project enforces strict quality standards:
The Python package is published to PyPI as excalidraw-mcp:
# Install from PyPI
pip install excalidraw-mcp
# Use with uvx (recommended)
uvx excalidraw-mcp
For local development and testing:
# Install in editable mode
pip install -e .
# Or use UV for development
uv sync
uv run python excalidraw_mcp/server.py
pyproject.toml and package.jsonWe welcome contributions! Please:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Unofficial MCP server for Excalidraw diagram management with canvas sync
We found that excalidraw-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.