This MCP server enables Large Language Models (LLMs) to interact with Excalidraw diagrams and drawings through a structured API. You can create, modify, query, and manipulate Excalidraw elements programmatically, making it ideal for AI-assisted diagram creation and editing.
# Install dependencies
npm install
# Start the server
npm start
# Build the Docker image
docker build -t mcp/excalidraw .
# Run the container
docker run -i --rm mcp/excalidraw
You can configure the server 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": {
"excalidraw": {
"command": "node",
"args": ["src/index.js"],
"env": {
"LOG_LEVEL": "info",
"DEBUG": "false"
}
}
}
}
Create a .cursor/mcp.json
file in your workspace with:
{
"mcpServers": {
"excalidraw": {
"command": "node",
"args": [
"/path/to/your/directory/mcp_excalidraw/src/index.js"
],
"env": {
"LOG_LEVEL": "info",
"DEBUG": "false"
}
}
}
}
Make sure to:
/path/to/your/directory
with the actual absolute path.cursor
directory if neededindex.js
is correct{
"mcpServers": {
"excalidraw": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/excalidraw"],
"env": {
"LOG_LEVEL": "info",
"DEBUG": "false"
}
}
}
}
Use the create_element
function to create new Excalidraw elements:
{
"type": "rectangle",
"x": 100,
"y": 100,
"width": 200,
"height": 100,
"backgroundColor": "#ffffff",
"strokeColor": "#000000",
"strokeWidth": 2,
"roughness": 1
}
Use query_elements
to find specific elements:
{
"type": "rectangle",
"filter": {
"strokeColor": "#000000"
}
}
Update existing elements with update_element
:
{
"id": "element-id-here",
"strokeColor": "#ff0000",
"backgroundColor": "#f5f5f5"
}
Group multiple elements together:
{
"elementIds": ["elem1", "elem2", "elem3"]
}
Align elements:
{
"elementIds": ["elem1", "elem2", "elem3"],
"alignment": "center"
}
Distribute elements evenly:
{
"elementIds": ["elem1", "elem2", "elem3"],
"direction": "horizontal"
}
Lock elements to prevent modification:
{
"elementIds": ["elem1", "elem2"]
}
Unlock elements when needed:
{
"elementIds": ["elem1", "elem2"]
}
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.