Excalidraw MCP server

Enables LLMs to create and manipulate Excalidraw diagrams through a Node.js API that provides tools for element creation, modification, querying, and organization for AI-assisted diagramming and visual collaboration.
Back to servers
Provider
yctimlin
Release date
Mar 16, 2025
Language
TypeScript
Stats
36 stars

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.

Installation

NPM Installation

# Install dependencies
npm install

# Start the server
npm start

Docker Installation

# Build the Docker image
docker build -t mcp/excalidraw .

# Run the container
docker run -i --rm mcp/excalidraw

Configuration

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")

Integration Options

With Claude Desktop

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"
      }
    }
  }
}

With Cursor

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:

  1. Replace /path/to/your/directory with the actual absolute path
  2. Create the .cursor directory if needed
  3. Verify the path to index.js is correct

Docker Integration

{
  "mcpServers": {
    "excalidraw": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "mcp/excalidraw"],
      "env": {
        "LOG_LEVEL": "info",
        "DEBUG": "false"
      }
    }
  }
}

API Usage

Creating Elements

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
}

Querying Elements

Use query_elements to find specific elements:

{
  "type": "rectangle",
  "filter": {
    "strokeColor": "#000000"
  }
}

Modifying Elements

Update existing elements with update_element:

{
  "id": "element-id-here",
  "strokeColor": "#ff0000",
  "backgroundColor": "#f5f5f5"
}

Organizing Elements

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"
}

Managing Element States

Lock elements to prevent modification:

{
  "elementIds": ["elem1", "elem2"]
}

Unlock elements when needed:

{
  "elementIds": ["elem1", "elem2"]
}

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later