Excalidraw MCP Server is a powerful API that enables Large Language Models (LLMs) to interact with Excalidraw diagrams and drawings. It allows LLMs to create, modify, query, and manipulate Excalidraw elements through a structured API interface, making it easy to integrate drawing capabilities into AI applications.
The simplest way to use Excalidraw MCP is through npx without any installation:
npx excalidraw-mcp
If you prefer to install it globally:
npm install -g excalidraw-mcp
excalidraw-mcp
# Build the Docker image
docker build -t mcp/excalidraw .
# Run the container
docker run -i --rm mcp/excalidraw
The following command-line options are available:
-d, --debug Enable debug logging
-?, --help Show this help message
Note: These options are currently only fully functional in the Docker version:
-p, --port <port> Port to run the server on (default: 3000) -h, --host <host> Host to bind the server to (default: localhost) -m, --mode <mode> Transport mode: 'stdio' or 'http' (default: stdio)
The server can be configured using these environment variables:
LOG_LEVEL
- Set the logging level (default: "info")DEBUG
- Enable debug mode (default: "false")DEFAULT_THEME
- Set the default theme (default: "light")Add this configuration to the "mcpServers" section of your claude_desktop_config.json
:
{
"mcpServers": {
"mcp_excalidraw": {
"command": "npx",
"args": ["-y", "excalidraw-mcp"]
}
}
}
Create a .cursor/mcp.json
file in your workspace with:
{
"mcpServers": {
"mcp_excalidraw": {
"command": "npx",
"args": ["-y", "excalidraw-mcp"]
}
}
}
{
"mcpServers": {
"excalidraw": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/excalidraw"],
"env": {
"LOG_LEVEL": "info",
"DEBUG": "false"
}
}
}
}
Create new Excalidraw elements:
{
"type": "rectangle",
"x": 100,
"y": 100,
"width": 200,
"height": 100,
"backgroundColor": "#ffffff",
"strokeColor": "#000000",
"strokeWidth": 2,
"roughness": 1
}
Update existing elements by ID, providing only the properties you want to change.
Delete an element by providing its ID.
Find elements with optional filtering:
{
"type": "rectangle",
"filter": {
"strokeColor": "#000000"
}
}
Group multiple elements together:
{
"elementIds": ["elem1", "elem2", "elem3"]
}
Ungroup elements by providing the group ID.
Align multiple elements based on specified alignment (left, center, right, top, middle, bottom).
Distribute elements evenly across space horizontally or vertically.
Lock or unlock elements to prevent or allow modifications.
Get specific resources like scene information or all elements.
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.