MCP Excalidraw Server combines Excalidraw's drawing capabilities with Model Context Protocol (MCP) integration, allowing AI agents to create and manipulate diagrams in real-time on a live canvas. This server enables both human users and AI systems to collaborate on visual diagrams with real-time synchronization.
git clone https://github.com/yctimlin/mcp_excalidraw.git
cd mcp_excalidraw
npm install
npm run build
Option A: Production Mode (Recommended)
# Start canvas server (serves frontend + API)
npm run canvas
Option B: Development Mode
# Start both canvas server and Vite dev server
npm run dev
Open your browser and navigate to:
http://localhost:3000
# Currently debugging tool registration
npm install -g mcp-excalidraw-server
npx mcp-excalidraw-server
# Canvas sync improvements in progress
docker run -p 3000:3000 mcp-excalidraw-server
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.
{
"mcpServers": {
"excalidraw": {
"command": "npx",
"args": ["-y", "mcp-excalidraw-server"]
}
}
}
{
"mcpServers": {
"excalidraw": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp-excalidraw-server"]
}
}
}
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 |
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 datanpm run build
completed successfullydist/index.html
existsnpm start
)ENABLE_CANVAS_SYNC=true
in environmentEXPRESS_SERVER_URL
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp_excalidraw" '{"command":"npx","args":["-y","excalidraw-mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp_excalidraw": {
"command": "npx",
"args": [
"-y",
"excalidraw-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp_excalidraw": {
"command": "npx",
"args": [
"-y",
"excalidraw-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect