A comprehensive system that combines Excalidraw's powerful drawing capabilities with Model Context Protocol (MCP) integration, enabling AI agents to create and manipulate diagrams in real-time on a live canvas.
๐ Choose Your Installation Method
| Version | Status | Recommended For |
|---|---|---|
| Local Development | โ FULLY TESTED | ๐ฏ RECOMMENDED |
| NPM Published | ๐ง DEBUGGING IN PROGRESS | Development testing |
| Docker Version | ๐ง UNDER DEVELOPMENT | Future deployment |
For the most stable experience, we recommend using the local development setup. We're actively working on improving the NPM package and Docker deployment options.
- NPM Package: Currently debugging MCP tool registration issues
- Docker Version: Improving canvas synchronization reliability
- Local Version: โ All features fully functional
- ๐จ Live Canvas: Real-time Excalidraw canvas accessible via web browser
- ๐ค AI Integration: MCP server allows AI agents (like Claude) to create visual diagrams
- โก Real-time Sync: Elements created via MCP API appear instantly on the canvas
- ๐ WebSocket Updates: Live synchronization across multiple connected clients
- ๐๏ธ Production Ready: Clean, minimal UI suitable for end users
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) โ โ (src/index.js) โ โ (src/server.js) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ Frontend โ
โ (React + WS) โ
โโโโโโโโโโโโโโโโโโโ
- Elements created via MCP appear instantly on the live canvas
- WebSocket-based real-time synchronization
- Multi-client support with live updates
- Clean, minimal UI with connection status
- Simple "Clear Canvas" functionality
- No development clutter or debug information
- Element Creation: rectangles, ellipses, diamonds, arrows, text, lines
- Element Management: update, delete, query with filters
- Batch Operations: create multiple elements in one call
- Advanced Features: grouping, alignment, distribution, locking
- Express.js backend with REST API + WebSocket
- React frontend with official Excalidraw package
- Dual-path element loading for reliability
- Auto-reconnection and error handling
Most stable and feature-complete option
git clone https://github.com/yctimlin/mcp_excalidraw.git
cd mcp_excalidraw
npm installnpm run build# Start canvas server (serves frontend + API)
npm run canvas# Start both canvas server and Vite dev server
npm run devOpen your browser and navigate to:
http://localhost:3000
# Currently debugging tool registration - feedback welcome!
npm install -g mcp-excalidraw-server
npx mcp-excalidraw-server# Canvas sync improvements in progress
docker run -p 3000:3000 mcp-excalidraw-server| Script | Description |
|---|---|
npm start |
Start MCP server (src/index.js) |
npm run canvas |
Start canvas server (src/server.js) |
npm run build |
Build frontend for production |
npm run dev |
Start canvas + Vite dev server |
npm run production |
Build + start in production mode |
- Open the canvas at
http://localhost:3000 - Check connection status (should show "Connected")
- AI agents can now create diagrams that appear in real-time
- Use "Clear Canvas" to remove all elements
The 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
}
]
}For the local development version (most stable), add this configuration to your claude_desktop_config.json:
{
"mcpServers": {
"excalidraw": {
"command": "node",
"args": ["/absolute/path/to/mcp_excalidraw/src/index.js"]
}
}
}Important: Replace /absolute/path/to/mcp_excalidraw with the actual absolute path to your cloned repository.
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["-y", "mcp-excalidraw-server"]
}
}
}Currently debugging tool registration - let us know if you encounter issues!
{
"mcpServers": {
"excalidraw": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp-excalidraw-server"]
}
}
}Canvas sync improvements in progress.
Add to your .cursor/mcp.json:
{
"mcpServers": {
"excalidraw": {
"command": "node",
"args": ["/absolute/path/to/mcp_excalidraw/src/index.js"]
}
}
}For VS Code MCP extension, add to your settings:
{
"mcp": {
"servers": {
"excalidraw": {
"command": "node",
"args": ["/absolute/path/to/mcp_excalidraw/src/index.js"]
}
}
}
}| Variable | Default | Description |
|---|---|---|
EXPRESS_SERVER_URL |
http://localhost:3000 |
Canvas server URL for MCP sync |
ENABLE_CANVAS_SYNC |
true |
Enable/disable canvas synchronization |
DEBUG |
false |
Enable debug logging |
PORT |
3000 |
Canvas server port |
HOST |
localhost |
Canvas server host |
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 filters
batch_create_elements- Create complex diagrams in one call
group_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 elements
get_resource- Access scene, library, theme, or elements data
- React + Vite: Modern build system
- Official Excalidraw:
@excalidraw/excalidrawpackage - WebSocket Client: Real-time element sync
- Clean UI: Production-ready interface
- Express.js: REST API + static file serving
- WebSocket: Real-time client communication
- Element Storage: In-memory with persistence options
- CORS: Cross-origin support
- MCP Protocol: Standard Model Context Protocol
- Canvas Sync: HTTP requests to canvas server
- Element Management: Full CRUD operations
- Batch Support: Complex diagram creation
- Symptoms: MCP tools not registering properly
- Temporary Solution: Use local development setup
- Status: Actively debugging - updates coming soon
- Symptoms: Elements may not sync to canvas immediately
- Temporary Solution: Use local development setup
- Status: Improving synchronization reliability
- Ensure
npm run buildcompleted successfully - Check that
dist/index.htmlexists - Verify canvas server is running on port 3000
- Confirm MCP server is running (
npm start) - Check
ENABLE_CANVAS_SYNC=truein environment - Verify canvas server is accessible at
EXPRESS_SERVER_URL
- Check browser console for WebSocket errors
- Ensure no firewall blocking WebSocket connections
- Try refreshing the browser page
- Delete
node_modulesand runnpm install - Check Node.js version (requires 16+)
- Ensure all dependencies are installed
mcp_excalidraw/
โโโ frontend/
โ โโโ src/
โ โ โโโ App.jsx # Main React component
โ โ โโโ main.jsx # React entry point
โ โโโ index.html # HTML template
โโโ src/
โ โโโ index.js # MCP server
โ โโโ server.js # Canvas server (Express + WebSocket)
โ โโโ types.js # Shared types and utilities
โ โโโ utils/
โ โโโ logger.js # Logging utility
โโโ dist/ # Built frontend (generated)
โโโ vite.config.js # Vite build configuration
โโโ package.json # Dependencies and scripts
โโโ README.md # This file
- NPM Package: Resolving MCP tool registration issues
- Docker Deployment: Improving canvas synchronization
- Enhanced Features: Additional MCP tools and capabilities
- Performance Optimization: Real-time sync improvements
We welcome contributions! If you're experiencing issues with the NPM package or Docker version, please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Excalidraw Team - For the amazing drawing library
- MCP Community - For the Model Context Protocol specification
