MCP Server

MCP Server Reference

Pro & Max plan feature
MCP Server is available on Pro and Max plans only. Free plan users cannot connect the MCP server. Upgrade to Pro or Max to get access.

Complete reference for the diagrams.love MCP server. Connect any MCP-compatible AI tool and manage diagrams programmatically.

What is MCP?

MCP (Model Context Protocol) is an open protocol that lets AI tools — like Claude Desktop, Claude Code, Cursor, and Windsurf — connect to external services and use their capabilities as native tools. The diagrams.love MCP server exposes your diagram workspace as a set of commands that AI can call directly.

With the diagrams.love MCP server, your AI can: create and update diagrams from scratch, read existing diagrams and their content, organize diagrams into projects, manage tags and statuses, browse version history, and export diagrams as images — all without leaving the conversation.

Tip: When used in Claude Code, all commands are prefixed automatically: mcp__diagrams-love__list_schemas. In other clients the commands appear by their short names.

Requirements

  • Node.js 18 or newer — check with node --version
  • Pro or Max plan — MCP access is not available on the Free plan
  • API token — generated in your Profile under MCP Integration
  • MCP-compatible client — Claude Desktop, Claude Code, Cursor, Windsurf, or any other MCP host
Pro & Max only. Free plan does not include MCP access. Upgrade to Pro or Max to use this feature.
Quick Start

Quick Start

Requires Pro or Max plan. MCP access is not available on the Free plan. Upgrade your plan before generating an API token.
  1. 1

    Get your API token

    Open Profile & Settings and scroll to the MCP Integration section. Click "Generate token" and copy it. Tokens start with schog_.

  2. 2

    Add config to your MCP client

    See the client configs below. Replace your_token_here with your actual token.

  3. 3

    Restart your MCP client

    Fully restart the application (not just reload). The diagrams-love server appears in the tools list. Verify by asking the AI: "List my diagrams".

Client Configurations

The npm package diagrams-love-mcp works with any MCP host. Choose your client below.

Claude Code (~/.claude.json)

~/.claude.json
{
  "mcpServers": {
    "diagrams-love": {
      "command": "npx",
      "args": ["-y", "diagrams-love-mcp"],
      "env": {
        "DIAGRAMS_TOKEN": "your_token_here"
      }
    }
  }
}

Claude Desktop

Edit the config file: on macOS it is at ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows: %APPDATA%\Claude\claude_desktop_config.json.

claude_desktop_config.json
{
  "mcpServers": {
    "diagrams-love": {
      "command": "npx",
      "args": ["-y", "diagrams-love-mcp"],
      "env": {
        "DIAGRAMS_TOKEN": "your_token_here"
      }
    }
  }
}

Cursor

Go to Cursor Settings → MCP → Add server. Or edit ~/.cursor/mcp.json directly:

~/.cursor/mcp.json
{
  "mcpServers": {
    "diagrams-love": {
      "command": "npx",
      "args": ["-y", "diagrams-love-mcp"],
      "env": {
        "DIAGRAMS_TOKEN": "your_token_here"
      }
    }
  }
}

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json:

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "diagrams-love": {
      "command": "npx",
      "args": ["-y", "diagrams-love-mcp"],
      "env": {
        "DIAGRAMS_TOKEN": "your_token_here"
      }
    }
  }
}
npm package: The server is published at npmjs.com/package/diagrams-love-mcp. The npx -y command downloads and runs the latest version automatically.
Commands

Diagram Management

Commands for listing, reading, creating, and managing your diagrams (called "schemas" in the API).

list_schemas

Returns a list of all your diagrams with their IDs, names, descriptions, project assignments, and last-updated timestamps. Use this to discover existing diagrams before reading or editing them.

No parameters required.

get_schema

Fetches the complete data of a diagram by ID, including all elements, their connections, and the tags dictionary.

schema_id string required The diagram ID (found in the URL: diagrams.love/canvas?schema=ID)
password string optional Schema password, required if the diagram is password-protected
get_schema_by_url

Fetches a diagram by its URL. Automatically extracts the schema ID. Supports all URL formats including public shared links.

url string required Full URL to the diagram (e.g. https://diagrams.love/canvas?schema=xxx)
password string optional Schema password if protected
create_schema

Creates a new diagram. Provide a name and an array of elements. Connections are specified inline within each element. Do not set x/y coordinates — auto-layout handles positioning automatically.

name string required Diagram name
description string optional Diagram description
project_id string optional ID of the project folder to place the diagram in
elements array optional Array of diagram elements — see Element Structure below
tagsDictionary array optional Array of tag definitions: {"id": "t1", "name": "system", "color": "#2196F3"}
import_schema_from_json

Creates a new diagram or updates an existing one from JSON data. Accepts the JSON directly or reads it from a file path. For large diagrams (>50KB), use file_path to avoid truncation.

json_content string/object optional JSON string or object with diagram data
file_path string optional Path to a JSON file on disk (recommended for large diagrams)
schema_id string optional ID of an existing diagram to update. If omitted, a new diagram is created
name string optional Name for the new diagram (required when creating, ignored if name is in the JSON)
project_id string optional Project folder to place the diagram in
export_schema_to_json

Exports a diagram to JSON format. Can return the JSON inline or save it to a file. For large diagrams, use file_path to avoid filling the context window.

schema_id string required ID of the diagram to export
format string optional full (default, with metadata), compact (data only), or elements_only (just elements array)
file_path string optional File path to save the JSON. If set, only the path and stats are returned (saves tokens)
relayout_schema

Clears all stored element positions and triggers auto-layout recalculation. Use this when cards overlap or when you want to clean up the diagram layout. All elements and connections are preserved.

schema_id string required ID of the diagram to relayout
Password protection: The set_schema_password and remove_schema_password commands, along with full documentation on the password parameter, are covered in the Password Protection section.

Project Management

Projects are folders for organizing diagrams. Use them to group related diagrams by topic, team, or product area.

list_projects

Returns all your projects with their IDs, names, descriptions, colors, icons, and diagram counts.

No parameters required.

create_project

Creates a new project folder.

name string required Project name
description string optional Project description
color string optional Project color in HEX format (e.g. #FF5733)
icon string optional Emoji icon for the project (e.g. 🚀)
update_project

Updates an existing project's name, description, color, or icon. Only the fields you specify are changed.

project_id string required Project ID to update
name string optional New project name
description string optional New description
color string optional New HEX color
icon string optional New emoji icon
move_schema_to_project

Moves a diagram into a project folder. To move it out of any project (into "All Diagrams"), omit project_id or pass null.

schema_id string required Diagram ID to move
project_id string optional Target project ID, or null/omit to remove from any project

Tags

Tags categorize elements within a diagram. Each diagram has its own tag dictionary. Tags are referenced by their ID, not their name.

list_tags

Returns all tags defined in a diagram's tag dictionary, including their IDs, names, and colors.

schema_id string required Diagram ID
add_tag

Adds a new tag to the diagram's tag dictionary. After creating it, assign it to elements using tag_element.

schema_id string required Diagram ID
name string required Tag name (e.g. "user", "system", "critical")
color string optional Tag color in HEX format (e.g. #4CAF50)
remove_tag

Removes a tag from the diagram's tag dictionary and unassigns it from all elements that used it.

schema_id string required Diagram ID
tag_id string required Tag ID to remove (get from list_tags)
tag_element

Assigns or removes a tag on a specific element.

schema_id string required Diagram ID
element_id string required Element ID to tag
tag_id string required Tag ID to assign
action string optional add (default) or remove

Statuses

Statuses track the state of individual cards (e.g. New, In Progress, Done). Each diagram has its own status dictionary.

Command Description
list_statuses Returns all statuses in the diagram's status dictionary
create_status Creates a new status (name + HEX color, schema_id required)
update_status Updates an existing status name or color (schema_id + status_id required)
delete_status Deletes a status and removes it from all elements (schema_id + status_id required)
set_element_status Sets a status on an element (schema_id + element_id + status_id required)
clear_element_status Removes the status from an element (schema_id + element_id required)

Version History

Every save to a diagram creates a version snapshot. Use these commands to browse history and restore previous states.

list_schema_versions

Returns the version history of a diagram. Each entry includes: version ID, sequential number, timestamp, whether it was manually saved, element count, and optional comment.

schema_id string required Diagram ID
get_schema_version

Returns the complete data of a specific historical version, as it was at the time of saving.

schema_id string required Diagram ID
version_id string required Version ID (from list_schema_versions)
restore_schema_version

Restores a diagram to a previous version. Before restoring, a backup of the current state is automatically saved, so the restore can itself be undone.

schema_id string required Diagram ID
version_id string required Version ID to restore to

Batch Operations

Apply changes to multiple elements in a single API call. Much more efficient than calling individual element updates one by one.

batch_update_elements

Updates specified properties on multiple elements at once. Only fields present in updates are changed — all other element data is preserved.

schema_id string required Diagram ID
element_ids array required Array of element IDs to update
updates object required Object with fields to change. Supports: color, borderColor, tags (replace), add_tags, remove_tags, statusId, completed, description
Example
// Change color of 3 elements to green
batch_update_elements(
  schema_id="abc123",
  element_ids=["el1", "el2", "el3"],
  updates={"color": "light_green"}
)

// Add a tag to multiple elements
batch_update_elements(
  schema_id="abc123",
  element_ids=["el4", "el5"],
  updates={"add_tags": ["tag-id-xyz"]}
)
batch_delete_elements

Deletes multiple elements at once. Also removes all connections referencing the deleted elements.

schema_id string required Diagram ID
element_ids array required Array of element IDs to delete
batch_move_elements

Moves multiple elements by a relative offset (dx, dy). Only affects elements that already have stored positions. Elements using auto-layout are skipped.

schema_id string required Diagram ID
element_ids array required Array of element IDs to move
dx number required Horizontal offset in pixels (positive = right, negative = left)
dy number required Vertical offset in pixels (positive = down, negative = up)

Visual Export

Generate visual representations of diagrams as image files. Useful for embedding diagrams in documents, reports, or presentations.

export_schema

Exports a diagram as a PNG, SVG, or PDF file. Generates the visual representation server-side and saves it to the specified file path.

schema_id string required Diagram ID to export
file_path string required Output file path (e.g. /tmp/my-schema.svg)
format string optional svg (default), png, or pdf
width number optional Canvas width in pixels (default: 1200)
height number optional Canvas height in pixels (default: auto-sized to content)
Security

Password Protection

Diagrams can be protected with a password. When a password is set, all MCP tool calls that access the diagram must include the password parameter. Password protection only affects MCP access — the web UI and public shared links are not affected.

How it works: Set a password via the web UI (diagram settings) or via the set_schema_password tool. After that, every MCP tool that reads or modifies the diagram requires the password parameter. Omitting it returns an authentication error.

Example: accessing a password-protected diagram

// Without password — returns error if schema is protected
get_schema(schema_id="abc123")

// With password — works correctly
get_schema(schema_id="abc123", password="mypassword")

// Same for all other tools that accept a schema_id
update_schema(schema_id="abc123", password="mypassword", elements=[...])
set_schema_password

Sets or changes the password on a diagram. After this call, all MCP access to the diagram requires the password parameter. To change an existing password, provide current_password as well.

schema_id string required ID of the diagram to protect
password string required New password to set
current_password string optional Current password — required only when changing an existing password
remove_schema_password

Removes password protection from a diagram. The current password is required to confirm removal. After this call, the diagram is accessible without a password.

schema_id string required ID of the diagram
current_password string required Current password to confirm removal
Note: Password protection affects only MCP tool access. Opening the diagram in the web browser at diagrams.love uses your login session and does not require the MCP password.
JSON Format

Element Structure

Every diagram is plain JSON. Each element in the elements array has the following structure:

Element Object
{
  "id": "unique-element-id",       // required: unique string ID
  "type": "card",                  // required: card | condition | ascii | html | iframe
  "title": "Card Title",           // card title text
  "description": "Detail text",    // optional: description shown below title
  "color": "light_blue",           // background fill color (see Colors section)
  "borderColor": "blue",           // optional: border color (see Colors section)
  "tags": ["tag-id-1"],            // optional: array of tag IDs (not names!)
  "completed": false,              // optional: mark card as completed
  "eventDate": "2025-12-31",       // optional: ISO 8601 date for deadline/event
  "content": "...",                // REQUIRED for ascii/html/iframe types
  "viewportType": "desktop",       // optional: for iframe — desktop|tablet|mobile
  "connections": [                 // optional: outgoing connections
    {
      "to": "target-element-id",   // required: target element ID
      "label": "optional label",   // optional: text on the connection arrow
      "style": "dashed"            // optional: arrow style
    }
  ]
  // DO NOT specify x, y, width, height — layout is automatic!
}

Element Types

Type Shape content field Use for
card Rectangle not used Standard diagram node — steps, components, actors
condition Diamond not used Decision points in flowcharts
ascii Rectangle with monospace font ASCII art text Inline ASCII diagrams, tables, tree views
html Rectangle with rendered HTML HTML markup string Rich content cards with custom formatting
iframe Browser viewport frame URL string Embed live websites or web pages
Important: For ascii, html, and iframe types, the content field is mandatory. If omitted, the element is automatically downgraded to a regular card.

Colors

Always use named color values — never HEX. The color field sets the background fill. The optional borderColor field sets the border accent.

Border Colors (borderColor)

NamePreview
default
blue
green
orange
purple
red
teal
yellow
gray
black

Background Colors (color)

NamePreview
white
light_blue
light_green
light_yellow
light_orange
light_red
light_purple
light_gray
light_pink
light_teal
Note: The color field also accepts the 10 border color names (default, blue, green, etc.) — these produce styled cards with colored backgrounds. HEX values are automatically converted to the nearest named color.

Connections

Connections are defined inline inside each element's connections array. Each connection points to the target element's ID.

Connection Format
{
  "id": "step-1",
  "type": "card",
  "title": "Step 1",
  "connections": [
    { "to": "step-2" },                           // simple connection
    { "to": "error-path", "label": "on error" },  // with label
    { "to": "step-3", "label": "OK", "style": "dashed" } // dashed line
  ]
}
Inline format: Connections are always stored inside the source element, not as a separate global array. If you provide a top-level connections array (with from and to), it is automatically merged into the elements on import.

Full Example

A complete diagram showing a user registration flow with tags, colors, conditions, and connections:

User Registration Flow
{
  "name": "User Registration",
  "description": "New user signup flow",
  "elements": [
    {
      "id": "start",
      "type": "card",
      "title": "Registration Form",
      "color": "light_green",
      "tags": ["user"],
      "connections": [{"to": "validate"}]
    },
    {
      "id": "validate",
      "type": "condition",
      "title": "Validation",
      "color": "light_yellow",
      "tags": ["system"],
      "connections": [
        {"to": "save", "label": "valid"},
        {"to": "error", "label": "invalid"}
      ]
    },
    {
      "id": "save",
      "type": "card",
      "title": "Save to DB",
      "color": "light_blue",
      "tags": ["system"],
      "connections": [{"to": "success"}]
    },
    {
      "id": "error",
      "type": "card",
      "title": "Show Error",
      "color": "light_red",
      "tags": ["user"]
    },
    {
      "id": "success",
      "type": "card",
      "title": "Welcome Email",
      "color": "light_green",
      "tags": ["system"]
    }
  ],
  "tagsDictionary": [
    {"id": "user", "name": "user", "color": "#4CAF50"},
    {"id": "system", "name": "system", "color": "#2196F3"}
  ]
}
Best Practices

Best Practices

Let auto-layout do the work

Never specify x, y, width, or height for new elements. The layout engine positions cards automatically. If you copy coordinates from existing elements, cards will overlap. After creating a diagram, call relayout_schema if the layout looks off.

Use meaningful element IDs

Choose descriptive IDs like step-login, check-auth, db-save instead of el1, el2. IDs are used in connections — descriptive names make the JSON self-documenting and easier to update later.

Typical create-then-edit workflow

  1. Call create_schema with the full element list and connections
  2. Call get_schema to read back what was created (with server-assigned IDs if any)
  3. Use batch_update_elements to adjust colors or tags in bulk
  4. Call relayout_schema if the layout needs a refresh
  5. Use export_schema_to_json with file_path to save a backup

Managing large diagrams

For diagrams with 20+ elements, always use file_path with export_schema_to_json and import_schema_from_json. This avoids filling the AI context window with JSON. The file is read and written directly by the MCP server.

Asking AI to create diagrams

The most effective prompt pattern is: describe the structure you want, specify the element types and relationships, mention any color coding or tagging scheme. Example: "Create a deployment pipeline diagram: local dev → CI build → staging → production approval → production deploy. Color stages as teal, approvals as yellow. Tag CI/CD steps with a 'automation' tag."

Troubleshooting

Token issues

  • Tokens start with schog_ — if yours does not, generate a new one in Profile
  • Make sure you copied the complete token without trailing spaces or line breaks
  • Tokens do not expire automatically — they only become invalid if you revoke them
  • MCP access requires Pro or Max plan — verify your subscription in Profile

Connection not working

  • Validate your JSON config — a single trailing comma breaks JSON parsing silently
  • The environment variable must be named exactly DIAGRAMS_TOKEN (legacy: SCHEMEOG_TOKEN is also accepted)
  • Check Node.js version: node --version — must be 18 or newer
  • Fully restart your MCP client after any config change — reload is not enough
  • Try running npx diagrams-love-mcp directly in a terminal to see error output

Cards overlapping after create

  • Do not set x or y on new elements — remove those fields entirely
  • Call relayout_schema on the diagram to reset all positions

Element downgraded to card

  • The ascii, html, and iframe types require a content field — without it, the element becomes a regular card automatically
  • There is no asciiContent or htmlContent field — the unified field name is always content
Need more help? Visit the main documentation, contact us, or check the npm package at npmjs.com/package/diagrams-love-mcp.