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.
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"
}
}
}
}
Alternatively, configure it with UV by adding:
{
"mcpServers": {
"jsoncanvas": {
"command": "uv",
"args": [
"--directory",
"/path/to/jsoncanvas",
"run",
"mcp-server-jsoncanvas"
],
"env": {
"OUTPUT_PATH": "./output"
}
}
}
}
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")The server provides access to:
canvas://schema
: JSON Schema for validating canvas filescanvas://examples
: Example canvas files demonstrating different featurescanvas://templates
: Templates for creating new canvasesUse 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
}
}
Use update_node to modify an existing node:
{
"id": "node1",
"properties": {
"text": "Updated content",
"color": "#FF5733"
}
}
Use delete_node to remove a node and its connections:
{
"id": "node1"
}
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
}
Use update_edge to modify connection properties:
{
"id": "edge1",
"properties": {
"color": "#0000FF",
"label": "Updated connection"
}
}
Use delete_edge to remove a connection:
{
"id": "edge1"
}
Ensure your canvas conforms to the specification:
{
"canvas": {
// Your canvas data object
}
}
Export your canvas to different formats:
{
"format": "json", // Supported: "json", "svg", "png"
"canvas": {
// Your canvas data object
}
}
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")
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.
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 > 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"
}
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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