
Excalidraw
STDIOAPI server for creating and manipulating Excalidraw diagrams through LLM integration
API server for creating and manipulating Excalidraw diagrams through LLM integration
A comprehensive TypeScript-based 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.
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) │
└─────────────────┘
Most stable and feature-complete option
git clone https://github.com/yctimlin/mcp_excalidraw.git cd mcp_excalidraw npm install
npm run build
# Start canvas server (serves frontend + API) npm run canvas
# Start both canvas server and Vite dev server npm run dev
Open 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 | Build and start MCP server (dist/index.js ) |
npm run canvas | Build and start canvas server (dist/server.js ) |
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 dev | Start TypeScript watch mode + Vite dev server |
npm run type-check | Run TypeScript type checking without compilation |
npm run production | Build + start in production mode |
http://localhost:3000
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/dist/index.js"] } } }
Important: Replace /absolute/path/to/mcp_excalidraw
with the actual absolute path to your cloned repository. Note that the path now points to dist/index.js
(the compiled TypeScript output).
{ "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/dist/index.js"] } } }
For VS Code MCP extension, add to your settings:
{ "mcp": { "servers": { "excalidraw": { "command": "node", "args": ["/absolute/path/to/mcp_excalidraw/dist/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 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
)src/index.ts
→ dist/index.js
)src/types.ts
)npm run build
completed successfullydist/index.html
existsnpm start
)ENABLE_CANVAS_SYNC=true
in environmentEXPRESS_SERVER_URL
node_modules
and run npm install
npm run type-check
to identify TypeScript issuesdist/
directory is created after npm run build:server
mcp_excalidraw/
├── frontend/
│ ├── src/
│ │ ├── App.tsx # Main React component (TypeScript)
│ │ └── main.tsx # React entry point (TypeScript)
│ └── index.html # HTML template
├── src/ (TypeScript Source)
│ ├── index.ts # MCP server (TypeScript)
│ ├── server.ts # Canvas server (Express + WebSocket, TypeScript)
│ ├── types.ts # Comprehensive type definitions
│ └── utils/
│ └── logger.ts # Logging utility (TypeScript)
├── dist/ (Compiled Output)
│ ├── index.js # Compiled MCP server
│ ├── server.js # Compiled Canvas server
│ ├── types.js # Compiled type definitions
│ ├── utils/
│ │ └── logger.js # Compiled logging utility
│ └── frontend/ # Built React frontend
├── tsconfig.json # TypeScript configuration
├── vite.config.js # Vite build configuration
├── package.json # Dependencies and scripts
└── README.md # This file
We welcome contributions! If you're experiencing issues with the NPM package or Docker version, 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.