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
55 stars

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.

Installation

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

Docker Installation

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

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

Configuration Options

Command-line Options

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)

Environment Variables

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

Integration with LLM Applications

Claude Desktop Integration

Add this configuration to the "mcpServers" section of your claude_desktop_config.json:

{
  "mcpServers": {
    "mcp_excalidraw": {
      "command": "npx",
      "args": ["-y", "excalidraw-mcp"]
    }
  }
}

Cursor Integration

Create a .cursor/mcp.json file in your workspace with:

{
  "mcpServers": {
    "mcp_excalidraw": {
      "command": "npx",
      "args": ["-y", "excalidraw-mcp"]
    }
  }
}

Docker Integration Example

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

API Reference

Element Creation and Modification

create_element

Create new Excalidraw elements:

{
  "type": "rectangle",
  "x": 100,
  "y": 100,
  "width": 200,
  "height": 100,
  "backgroundColor": "#ffffff",
  "strokeColor": "#000000",
  "strokeWidth": 2,
  "roughness": 1
}

update_element

Update existing elements by ID, providing only the properties you want to change.

delete_element

Delete an element by providing its ID.

query_elements

Find elements with optional filtering:

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

Element Organization

group_elements

Group multiple elements together:

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

ungroup_elements

Ungroup elements by providing the group ID.

align_elements

Align multiple elements based on specified alignment (left, center, right, top, middle, bottom).

distribute_elements

Distribute elements evenly across space horizontally or vertically.

lock_elements and unlock_elements

Lock or unlock elements to prevent or allow modifications.

Resource Management

get_resource

Get specific resources like scene information or all elements.

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