JSON Canvas MCP Server
JSON Canvas MCP 服务器
模型上下文协议 (MCP) 服务器实现,提供根据官方规范处理 JSON Canvas 文件的工具。此服务器支持创建、修改和验证无限的画布数据结构。
概述
JSON Canvas MCP 服务器提供了 JSON Canvas 1.0 规范的完整实现,支持:
创建和操作无限画布数据
支持所有节点类型(文本、文件、链接、组)
带有样式和标签的边缘连接
根据规范进行验证
可配置的输出路径
Related MCP server: MCP REST API Server
成分
资源
服务器公开以下资源:
canvas://schema:用于验证画布文件的 JSON Schemacanvas://examples:演示不同功能的示例画布文件canvas://templates:用于创建新画布的模板
工具
节点操作
创建节点
创建任何受支持类型的新节点
输入:
type(字符串):节点类型(“文本”,“文件”,“链接”,“组”)properties(对象):节点特定的属性常见:
id、x、y、width、height、color特定类型:
text、file、url等。
返回:创建的节点对象
更新节点
更新现有节点的属性
输入:
id(字符串):要更新的节点 IDproperties(对象):要更新的属性
返回:更新后的节点对象
删除节点
删除节点及其连接的边
输入:
id(字符串):要删除的节点 ID
返回:成功确认
边缘操作
创建边
在节点之间创建新边
输入:
id(字符串):唯一边缘标识符fromNode(字符串):源节点 IDtoNode(字符串):目标节点 IDfromSide(可选字符串):起始侧(“顶部”、“右侧”、“底部”、“左侧”)toSide(可选字符串):结束侧color(可选字符串):边缘颜色label(可选字符串):边缘标签
返回:创建的边缘对象
更新边
更新现有边的属性
输入:
id(字符串):要更新的边缘 IDproperties(对象):要更新的属性
返回:更新的边缘对象
删除边
移除边
输入:
id(字符串):要删除的边 ID
返回:成功确认
画布操作
验证画布
根据规范验证画布
输入:
canvas(对象):需要验证的画布数据
返回:带有任何错误的验证结果
导出画布
将画布导出为不同的格式
输入:
format(字符串):目标格式(“json”,“svg”,“png”)canvas(对象):要导出的画布数据
返回:以请求的格式导出的画布
与 Claude Desktop 一起使用
Docker
将其添加到您的claude_desktop_config.json中:
{
"mcpServers": {
"jsoncanvas": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"canvas-data:/data",
"mcp/jsoncanvas"
],
"env": {
"OUTPUT_PATH": "/data/output"
}
}
}
}紫外线
{
"mcpServers": {
"jsoncanvas": {
"command": "uv",
"args": [
"--directory",
"/path/to/jsoncanvas",
"run",
"mcp-server-jsoncanvas"
],
"env": {
"OUTPUT_PATH": "./output"
}
}
}
}配置
可以使用环境变量来配置服务器:
OUTPUT_PATH:画布文件的保存目录(默认值:“./output”)FORMAT:画布文件的默认输出格式(默认值:“json”)
建筑
Docker 构建
docker build -t mcp/jsoncanvas .本地构建
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
# Run tests
pytest示例用法
创建画布
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")执照
此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。
Available Tools
7 toolscreate_canvasCreate CanvasC
Create a JSON Canvas from nodes (and optional edges) and write it as a date-prefixed .canvas file under OUTPUT_PATH.
Inputs: nodes (required), filename (required), edges. Returns: Result of writing a canvas to disk.
edit_canvasEdit CanvasA
Edit a stored .canvas file: add, update, and/or remove nodes and edges in one atomic write. Operations apply in order — add_nodes, update_nodes, add_edges, update_edges, remove_edge_ids, remove_node_ids — and removing a node also removes its connected edges. If any operation fails the file is left unchanged. Returns the updated canvas.
Inputs: filename (required), add_nodes, update_nodes, remove_node_ids, +3 more. Returns: Result of writing a canvas to disk.
export_canvasExport CanvasA
Export a stored canvas to another format: 'markdown' (an outline that follows the edges) or 'svg' (a standalone vector image). SVG renders each node's title line only.
Inputs: filename (required), format (required). Returns: Result of exporting a canvas to another format.
list_canvasesList CanvasesA
List the .canvas files available in OUTPUT_PATH.
Inputs: no named parameters. Returns: result
read_canvasRead CanvasB
Read a .canvas file from OUTPUT_PATH and return its nodes and edges.
Inputs: filename (required). Returns: A JSON Canvas document — the nodes and edges the UI viewer renders.
search_canvasesSearch CanvasesA
Case-insensitive substring search across stored canvases. Matches node text, labels, file paths, URLs, and IDs, plus edge labels. Searches every canvas in OUTPUT_PATH unless a filename is given.
Inputs: query (required), filename. Returns: Result of searching across stored canvases.
validate_canvasValidate CanvasB
Validate canvas data against the JSON Canvas 1.0 specification.
Inputs: canvas (required). Returns: Result of validating canvas data against the JSON Canvas 1.0 spec.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: create, edit, export, list, read, search, validate. There is no overlap or ambiguity between them.
All tool names follow a consistent verb_noun pattern (e.g., create_canvas, list_canvases) using snake_case, making the set predictable and easy to navigate.
With 7 tools, the server is well-scoped for managing JSON Canvas files. Each tool earns its place, covering essential operations without excess.
The tool set covers create, read, update, list, search, export, and validate. However, a dedicated delete canvas tool is missing, which is a minor gap for full lifecycle management.
Maintenance
Related MCP Connectors
MCP Spec Compliance MCP — audits any MCP server.json against the official Model Context Protocol
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for Studex tools, notifications, and profile integrations
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables interaction with the Canvas Learning Management System API, allowing users to manage courses, assignments, enrollments, and grades within Canvas.543,565 npm104JavaScriptMIT
- FlicenseNot gradedqualityDmaintenanceA server implementation of the Model Context Protocol (MCP) that provides REST API endpoints for managing and interacting with MCP resources.-
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables real-time communication using Server-Sent Events (SSE), providing standardized model management and resource templating capabilities.-
- AlicenseCqualityDmaintenanceA Model Context Protocol server implementation that enables real-time data communication between web pages and client applications through WebSocket connections.2ISC