JSON Canvas MCP server

Provides tools for creating, modifying, and validating infinite canvas data structures, supporting all node types and edge connections, with a RESTful API for canvas operations and export capabilities.
Back to servers
Setup instructions
Provider
Cameron Rohn
Release date
Mar 04, 2025
Language
Python
Stats
7 stars

This MCP server implements the JSON Canvas 1.0 specification, providing tools to create, modify, and validate infinite canvas data structures. It supports various node types, edge connections with styling, and validation against the official specification.

Installation

Docker Setup

Add this to your claude_desktop_config.json file:

{
  "mcpServers": {
    "jsoncanvas": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "canvas-data:/data",
        "mcp/jsoncanvas"
      ],
      "env": {
        "OUTPUT_PATH": "/data/output"
      }
    }
  }
}

UV Setup

Alternatively, configure it with UV by adding:

{
  "mcpServers": {
    "jsoncanvas": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/jsoncanvas",
        "run",
        "mcp-server-jsoncanvas"
      ],
      "env": {
        "OUTPUT_PATH": "./output"
      }
    }
  }
}

Configuration

Configure the server using these environment variables:

  • OUTPUT_PATH: Directory where canvas files will be saved (default: "./output")
  • FORMAT: Default output format for canvas files (default: "json")

Available Resources

The server provides access to:

  • canvas://schema: JSON Schema for validating canvas files
  • canvas://examples: Example canvas files demonstrating different features
  • canvas://templates: Templates for creating new canvases

Working with Nodes

Creating Nodes

Use the create_node tool to create a new node:

// Input parameters
{
  "type": "text",  // Supported types: "text", "file", "link", "group"
  "properties": {
    "id": "node1",
    "x": 100,
    "y": 100,
    "width": 400,
    "height": 200,
    "color": "#4285F4",
    // Type-specific properties
    "text": "Hello World"  // For text nodes
  }
}

Updating Nodes

Use update_node to modify an existing node:

{
  "id": "node1",
  "properties": {
    "text": "Updated content",
    "color": "#FF5733"
  }
}

Deleting Nodes

Use delete_node to remove a node and its connections:

{
  "id": "node1"
}

Working with Edges

Creating Edges

Use create_edge to connect nodes:

{
  "id": "edge1",
  "fromNode": "node1",
  "toNode": "node2",
  "fromSide": "right",  // Optional: "top", "right", "bottom", "left"
  "toSide": "left",     // Optional: "top", "right", "bottom", "left"
  "color": "#333333",   // Optional
  "label": "Connection" // Optional
}

Updating Edges

Use update_edge to modify connection properties:

{
  "id": "edge1",
  "properties": {
    "color": "#0000FF",
    "label": "Updated connection"
  }
}

Deleting Edges

Use delete_edge to remove a connection:

{
  "id": "edge1"
}

Canvas Operations

Validating a Canvas

Ensure your canvas conforms to the specification:

{
  "canvas": {
    // Your canvas data object
  }
}

Exporting a Canvas

Export your canvas to different formats:

{
  "format": "json", // Supported: "json", "svg", "png"
  "canvas": {
    // Your canvas data object
  }
}

Example Usage (Python)

Here's a complete example of creating a canvas programmatically:

from jsoncanvas import Canvas, TextNode, Edge

# Create nodes
title = TextNode(
    id="title",
    x=100,
    y=100,
    width=400,
    height=100,
    text="# Hello Canvas\n\nThis is a demonstration.",
    color="#4285F4"
)

info = TextNode(
    id="info",
    x=600,
    y=100,
    width=300,
    height=100,
    text="More information here",
    color="2"  # Using preset color
)

# Create canvas
canvas = Canvas()
canvas.add_node(title)
canvas.add_node(info)

# Connect nodes
edge = Edge(
    id="edge1",
    from_node="title",
    to_node="info",
    from_side="right",
    to_side="left",
    label="Connection"
)
canvas.add_edge(edge)

# Save canvas
canvas.save("example.canvas")

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "jsoncanvas" '{"command":"uv","args":["--directory","/path/to/jsoncanvas","run","mcp-server-jsoncanvas"],"env":{"OUTPUT_PATH":"./output"}}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "jsoncanvas": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/jsoncanvas",
                "run",
                "mcp-server-jsoncanvas"
            ],
            "env": {
                "OUTPUT_PATH": "./output"
            }
        }
    }
}

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "jsoncanvas": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/jsoncanvas",
                "run",
                "mcp-server-jsoncanvas"
            ],
            "env": {
                "OUTPUT_PATH": "./output"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

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