iflow-mcp_Cam10001110101-mcp-server-jsoncanvas 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/.context/.gitignore +7 -0
  2. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/.context/index.md +93 -0
  3. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/.gitattributes +2 -0
  4. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/.gitignore +45 -0
  5. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/3280_process.log +6 -0
  6. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/Dockerfile +37 -0
  7. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/EXAMPLE OUTPUT/2025-03-03-austin_langchain_aimug.canvas +26 -0
  8. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/EXAMPLE OUTPUT/2025-03-03-bears_of_the_world.canvas +23 -0
  9. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/EXAMPLE OUTPUT/2025-03-03-cavapoos_guide.canvas +28 -0
  10. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/EXAMPLE OUTPUT/2025-03-03_17-17-22.png +0 -0
  11. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/EXAMPLE OUTPUT/2025-03-03_17-17-46.png +0 -0
  12. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/EXAMPLE OUTPUT/2025-03-03_17-18-02.png +0 -0
  13. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/LICENSE +21 -0
  14. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/Makefile +41 -0
  15. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/PKG-INFO +241 -0
  16. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/README.md +221 -0
  17. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/examples/create_canvas.py +174 -0
  18. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/jsoncanvas/__init__.py +31 -0
  19. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/jsoncanvas/canvas.py +266 -0
  20. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/jsoncanvas/edges.py +136 -0
  21. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/jsoncanvas/errors.py +122 -0
  22. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/jsoncanvas/nodes.py +258 -0
  23. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/language.json +1 -0
  24. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/mcp_server.py +359 -0
  25. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/package_name +1 -0
  26. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/push_info.json +5 -0
  27. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/pyproject.toml +55 -0
  28. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/simple_mcp_server.py +146 -0
  29. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/simple_test.py +62 -0
  30. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/test_imports.py +24 -0
  31. iflow_mcp_cam10001110101_mcp_server_jsoncanvas-0.1.0/test_server_api.py +33 -0
@@ -0,0 +1,7 @@
1
+ # Ignore everything in this directory
2
+ *
3
+
4
+ # Except this file
5
+ !.gitignore
6
+ # And the index.md file
7
+ !index.md
@@ -0,0 +1,93 @@
1
+ # JSON Canvas Project
2
+
3
+ This project provides a Python library for working with JSON Canvas data structures according to the [official specification](https://jsoncanvas.org/spec/1.0/). It uses `uv` for Python package management and will be extended with a Model Context Protocol (MCP) server.
4
+
5
+ ## What is JSON Canvas?
6
+
7
+ JSON Canvas is an open file format for infinite canvas data. It was originally created for [Obsidian](https://obsidian.md/blog/json-canvas/) and is designed to provide longevity, readability, interoperability, and extensibility to data created with infinite canvas apps.
8
+
9
+ Infinite canvas tools are a way to view and organize information spatially, like a digital whiteboard. JSON Canvas files use the `.canvas` extension and follow a specific JSON structure.
10
+
11
+ ## Project Components
12
+
13
+ This project consists of several components:
14
+
15
+ 1. **Python Library** - A library for working with JSON Canvas files
16
+ 2. **MCP Server** - A Model Context Protocol server for JSON Canvas operations
17
+ 3. **Examples** - Sample code demonstrating usage
18
+ 4. **Tests** - Unit tests for the library
19
+
20
+ ## Architecture
21
+
22
+ The project follows a modular architecture:
23
+
24
+ - `jsoncanvas/` - Main package directory
25
+ - `__init__.py` - Package initialization
26
+ - `canvas.py` - Core Canvas class implementation (to be updated to match spec)
27
+ - `nodes.py` - Node implementations (to be added)
28
+ - `edges.py` - Edge implementations (to be added)
29
+ - `validation.py` - Schema validation (to be added)
30
+ - `tests/` - Test directory
31
+ - `test_canvas.py` - Tests for the Canvas class
32
+ - `test_nodes.py` - Tests for nodes (to be added)
33
+ - `test_edges.py` - Tests for edges (to be added)
34
+ - `examples/` - Example scripts
35
+ - `create_canvas.py` - Example of creating a canvas
36
+ - `mcp/` - MCP server implementation (to be added)
37
+
38
+ ## Development Workflow
39
+
40
+ This project uses `uv` for Python package management. The workflow is:
41
+
42
+ 1. Create a virtual environment: `uv venv`
43
+ 2. Install dependencies: `uv pip install -r requirements.txt`
44
+ 3. Install development dependencies: `uv pip install -e ".[dev]"`
45
+ 4. Run tests: `pytest`
46
+
47
+ ## Key Components
48
+
49
+ ### Canvas Class
50
+
51
+ The Canvas class will be updated to match the official JSON Canvas specification with:
52
+
53
+ - Support for nodes (text, file, link, group)
54
+ - Support for edges between nodes
55
+ - Color handling
56
+ - Validation against the specification
57
+
58
+ ### MCP Server
59
+
60
+ The MCP server will provide tools for:
61
+
62
+ - Validating JSON Canvas files
63
+ - Creating and manipulating canvas elements
64
+ - Converting between formats
65
+ - Analyzing canvas structure
66
+ - Generating visualizations
67
+
68
+ See [mcp-server.md](mcp-server.md) for more details.
69
+
70
+ ### JSON Canvas Specification
71
+
72
+ The project follows the JSON Canvas 1.0 specification. See [specification.md](specification.md) for details.
73
+
74
+ ### Project Documentation
75
+
76
+ This project uses dotcontext for managing project documentation and context. The `.context` directory contains structured documentation about the project's architecture, components, and implementation details. See [dotcontext.md](dotcontext.md) for more information about how dotcontext is used in this project.
77
+
78
+ ## Implementation Plan
79
+
80
+ 1. Update the Python library to match the specification
81
+ 2. Implement validation using JSON Schema
82
+ 3. Create the MCP server
83
+ 4. Add examples and documentation
84
+ 5. Implement advanced features
85
+
86
+ ## Future Development
87
+
88
+ Planned features include:
89
+ - JSON schema validation for canvas elements
90
+ - Export to different formats (SVG, PNG)
91
+ - Canvas manipulation operations (resize, transform)
92
+ - Real-time collaboration features
93
+ - Integration with existing canvas tools
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
@@ -0,0 +1,45 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual Environment
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # UV specific
29
+ .uv/
30
+
31
+ # IDE
32
+ .idea/
33
+ .vscode/
34
+ *.swp
35
+ *.swo
36
+
37
+ # OS specific
38
+ .DS_Store
39
+ Thumbs.db
40
+
41
+ # Testing
42
+ .coverage
43
+ htmlcov/
44
+ .pytest_cache/
45
+ .tox/
@@ -0,0 +1,6 @@
1
+ 2026-02-06 09:53:26 [INFO] 开始处理项目: mcp-server-obsidian-jsoncanvas
2
+ 2026-02-06 09:53:36 [INFO] 项目语言类型: python
3
+ 2026-02-06 09:55:59 [INFO] 包名: iflow-mcp_Cam10001110101-mcp-server-jsoncanvas
4
+ 2026-02-06 09:56:26 [INFO] 项目构建成功
5
+ 2026-02-06 10:07:47 [INFO] 本地测试成功,检测到2个工具
6
+ 2026-02-06 10:07:59 [INFO] Git推送成功
@@ -0,0 +1,37 @@
1
+ FROM python:3.10-slim as builder
2
+
3
+ WORKDIR /app
4
+
5
+ # Install build dependencies
6
+ RUN apt-get update && \
7
+ apt-get install -y --no-install-recommends \
8
+ build-essential \
9
+ curl && \
10
+ rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install uv
13
+ RUN curl -LsSf https://astral.sh/uv/install.sh | sh
14
+
15
+ # Copy project files
16
+ COPY . .
17
+
18
+ # Install dependencies and build project using uv
19
+ RUN /root/.cargo/bin/uv pip install --system .
20
+
21
+ # Create final image
22
+ FROM python:3.10-slim
23
+
24
+ WORKDIR /app
25
+
26
+ # Copy built files from builder
27
+ COPY --from=builder /app /app
28
+
29
+ # Create data directory
30
+ RUN mkdir -p /data/output
31
+
32
+ # Set environment variables
33
+ ENV OUTPUT_PATH=/data/output
34
+ ENV FORMAT=json
35
+
36
+ # Run the server
37
+ ENTRYPOINT ["python", "-m", "jsoncanvas"]
@@ -0,0 +1,26 @@
1
+ {
2
+ "nodes":[
3
+ {"id":"events_group","type":"group","x":150,"y":450,"width":1000,"height":250,"color":"#EA4335","label":"Events & Activities"},
4
+ {"id":"resources_group","type":"group","x":150,"y":750,"width":1000,"height":200,"color":"#673AB7","label":"Resources"},
5
+ {"id":"title","type":"text","text":"# Austin LangChain AI Meetup Group\n\nA community for AI enthusiasts and developers in Austin, TX","x":400,"y":-80,"width":500,"height":160,"color":"#4285F4"},
6
+ {"id":"about","type":"text","text":"## About the Group\n\nThe Austin LangChain AI Meetup Group brings together developers, researchers, and enthusiasts interested in LangChain, LLMs, and AI application development. We focus on knowledge sharing, networking, and collaborative learning.","x":150,"y":120,"width":350,"height":280,"color":"#34A853"},
7
+ {"id":"langchain","type":"text","text":"## What is LangChain?\n\nLangChain is a framework for developing applications powered by language models. It enables:\n\n- Connecting LLMs to other sources of data\n- Creating interactive agents\n- Building context-aware applications","x":800,"y":200,"width":350,"height":200,"color":"#FBBC05"},
8
+ {"id":"workshops","type":"text","text":"## Workshops\n\n- Hands-on LangChain tutorials\n- Building AI applications\n- Integration with vector databases\n- RAG implementation techniques","x":200,"y":500,"width":250,"height":150,"color":"#4285F4"},
9
+ {"id":"talks","type":"text","text":"## Speaker Series\n\n- Industry experts\n- Academic researchers\n- Open source contributors\n- Local AI startups\n- Use case demonstrations","x":500,"y":500,"width":250,"height":150,"color":"#34A853"},
10
+ {"id":"hackathons","type":"text","text":"## Hackathons\n\n- Weekend coding events\n- Team-based challenges\n- Mentorship opportunities\n- Prizes and recognition\n- Networking with peers","x":800,"y":500,"width":250,"height":150,"color":"#FBBC05"},
11
+ {"id":"website","type":"text","text":"## [AIMUG Website](https://aimug.org)\n\nOfficial website for the Austin AI Meetup Group","x":200,"y":800,"width":250,"height":100,"color":"#4285F4"},
12
+ {"id":"github","type":"text","text":"## [LangChain GitHub](https://github.com/langchain-ai/langchain)\n\nSource code and documentation","x":500,"y":800,"width":250,"height":100,"color":"#333333"},
13
+ {"id":"discord","type":"text","text":"## [LangChain Discord](https://discord.gg/langchain)\n\nCommunity discussions and support","x":800,"y":800,"width":250,"height":100,"color":"#7289DA"},
14
+ {"id":"join","type":"text","text":"## Join the Community\n\nConnect with AI enthusiasts and LangChain developers in Austin! Our meetups are open to all skill levels, from beginners to experts. We welcome developers, researchers, students, and anyone interested in AI and LLM applications.","x":400,"y":1000,"width":500,"height":220,"color":"#FF5722"}
15
+ ],
16
+ "edges":[
17
+ {"id":"edge1","fromNode":"title","fromSide":"bottom","toNode":"about","toSide":"top"},
18
+ {"id":"edge2","fromNode":"title","fromSide":"bottom","toNode":"langchain","toSide":"top"},
19
+ {"id":"edge3","fromNode":"about","fromSide":"bottom","toNode":"events_group","toSide":"top"},
20
+ {"id":"edge4","fromNode":"langchain","fromSide":"bottom","toNode":"events_group","toSide":"top"},
21
+ {"id":"edge5","fromNode":"events_group","fromSide":"bottom","toNode":"resources_group","toSide":"top"},
22
+ {"id":"edge6","fromNode":"resources_group","fromSide":"bottom","toNode":"join","toSide":"top"},
23
+ {"id":"edge7","fromNode":"langchain","fromSide":"bottom","toNode":"github","toSide":"top","label":"Source Code"},
24
+ {"id":"edge8","fromNode":"langchain","fromSide":"bottom","toNode":"discord","toSide":"top","label":"Community"}
25
+ ]
26
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "nodes":[
3
+ {"id":"polar","type":"text","text":"## Polar Bear\n\n- Scientific name: *Ursus maritimus*\n- Habitat: Arctic sea ice\n- Diet: Primarily seals\n- Status: Vulnerable\n\nThe largest bear species and the largest land carnivore.","x":100,"y":200,"width":300,"height":200,"color":"#FFFFFF"},
4
+ {"id":"grizzly","type":"text","text":"## Grizzly Bear\n\n- Scientific name: *Ursus arctos horribilis*\n- Habitat: Forests, mountains, tundra\n- Diet: Omnivorous\n- Status: Least Concern\n\nKnown for their distinctive shoulder hump and long claws.","x":450,"y":200,"width":300,"height":200,"color":"#8B4513"},
5
+ {"id":"panda","type":"text","text":"## Giant Panda\n\n- Scientific name: *Ailuropoda melanoleuca*\n- Habitat: Bamboo forests in China\n- Diet: 99% bamboo\n- Status: Vulnerable\n\nIconic black and white bear, symbol of conservation.","x":800,"y":200,"width":300,"height":200,"color":"#000000"},
6
+ {"id":"conservation","type":"text","text":"## Conservation\n\nMany bear species face threats from habitat loss, poaching, and climate change. Conservation efforts include habitat protection, anti-poaching measures, and breeding programs.","x":400,"y":700,"width":500,"height":200,"color":"#4CAF50"},
7
+ {"id":"resources","type":"link","url":"https://www.worldwildlife.org/species/bear","x":400,"y":1000,"width":500,"height":480,"color":"#2196F3"},
8
+ {"id":"title","type":"text","text":"# Bears of the World\n\nAn overview of different bear species","x":350,"y":-200,"width":500,"height":100,"color":"#4285F4"},
9
+ {"id":"black","type":"text","text":"## American Black Bear\n\n- Scientific name: *Ursus americanus*\n- Habitat: Forests across North America\n- Diet: Omnivorous\n- Status: Least Concern\n\nMost common bear in North America.","x":-50,"y":550,"width":300,"height":350,"color":"#333333"},
10
+ {"id":"sloth","type":"text","text":"## Sloth Bear\n\n- Scientific name: *Melursus ursinus*\n- Habitat: Forests in South Asia\n- Diet: Insects, fruits, honey\n- Status: Vulnerable\n\nKnown for their shaggy coat and long snout.","x":1100,"y":580,"width":300,"height":200,"color":"#654321"},
11
+ {"id":"sun","type":"text","text":"## Sun Bear\n\n- Scientific name: *Helarctos malayanus*\n- Habitat: Tropical forests in Southeast Asia\n- Diet: Omnivorous, loves honey\n- Status: Vulnerable\n\nThe smallest bear species with a distinctive chest patch.","x":1140,"y":200,"width":300,"height":200,"color":"#FFA500"}
12
+ ],
13
+ "edges":[
14
+ {"id":"edge1","fromNode":"title","fromSide":"bottom","toNode":"polar","toSide":"top"},
15
+ {"id":"edge2","fromNode":"title","fromSide":"bottom","toNode":"grizzly","toSide":"top"},
16
+ {"id":"edge3","fromNode":"title","fromSide":"bottom","toNode":"panda","toSide":"top"},
17
+ {"id":"edge4","fromNode":"conservation","fromSide":"top","toNode":"polar","toSide":"bottom"},
18
+ {"id":"edge5","fromNode":"conservation","fromSide":"top","toNode":"panda","toSide":"bottom"},
19
+ {"id":"edge6","fromNode":"conservation","fromSide":"top","toNode":"sun","toSide":"bottom"},
20
+ {"id":"edge7","fromNode":"conservation","fromSide":"top","toNode":"sloth","toSide":"bottom"},
21
+ {"id":"edge8","fromNode":"conservation","fromSide":"bottom","toNode":"resources","toSide":"top"}
22
+ ]
23
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "nodes":[
3
+ {"id":"appearance","type":"text","text":"## Appearance\n\n- Size: Small to medium (9-14 inches tall)\n- Weight: 12-25 pounds\n- Coat: Soft, wavy to curly\n- Colors: Various (cream, gold, chestnut, tricolor)\n- Ears: Floppy\n- Lifespan: 10-15 years","x":100,"y":400,"width":300,"height":200,"color":"#FFD166"},
4
+ {"id":"temperament","type":"text","text":"## Temperament\n\n- Friendly and affectionate\n- Intelligent and trainable\n- Good with children and other pets\n- Sociable and outgoing\n- Low to moderate energy level\n- Eager to please","x":450,"y":400,"width":300,"height":200,"color":"#06D6A0"},
5
+ {"id":"health","type":"text","text":"## Health Considerations\n\n- Inherited conditions from parent breeds\n- Potential issues: heart problems, eye disorders, hip dysplasia\n- Regular vet check-ups recommended\n- Dental care important\n- Typically healthy when from reputable breeders","x":100,"y":650,"width":300,"height":200,"color":"#EF476F"},
6
+ {"id":"history","type":"text","text":"## History & Origin\n\n- Developed in the 1990s\n- Designer breed created for companionship\n- Combines best traits of both parent breeds\n- Gained popularity for hypoallergenic qualities\n- Not recognized by major kennel clubs as a purebred","x":1180,"y":850,"width":300,"height":200,"color":"#540D6E"},
7
+ {"id":"care","type":"text","text":"## Care Requirements\n\n- Grooming: Regular brushing, professional grooming every 6-8 weeks\n- Exercise: Daily walks, playtime\n- Training: Responds well to positive reinforcement\n- Diet: High-quality dog food appropriate for size and age","x":1030,"y":400,"width":300,"height":350,"color":"#118AB2"},
8
+ {"id":"adoption","type":"text","text":"## Adoption & Cost\n\nCavapoos typically cost $1,500-$4,000 from reputable breeders. Consider rescue organizations that may have Cavapoo mixes. Always research breeders thoroughly and avoid puppy mills.","x":120,"y":1030,"width":500,"height":150,"color":"#F77F00"},
9
+ {"id":"training","type":"text","text":"## Training & Exercise\n\n- Highly trainable due to intelligence\n- Eager to please and responsive\n- Early socialization important\n- Moderate exercise needs (30-60 minutes daily)\n- Enjoys interactive toys and games\n- Can excel at agility and obedience","x":700,"y":663,"width":300,"height":375,"color":"#073B4C"},
10
+ {"id":"resources","type":"link","url":"https://www.akc.org/expert-advice/dog-breeds/cavapoo-breed-facts-temperament-traits/","x":120,"y":1340,"width":500,"height":320,"color":"#2196F3"},
11
+ {"id":"title","type":"text","text":"# Cavapoos\n\nA comprehensive guide to the Cavalier King Charles Spaniel and Poodle mix","x":300,"y":-140,"width":500,"height":180,"color":"#FF6B6B"},
12
+ {"id":"overview","type":"text","text":"## Overview\n\nCavapoos are a crossbreed between a Cavalier King Charles Spaniel and a Poodle. They are known for their friendly temperament, intelligence, and hypoallergenic coat. They're popular family pets due to their gentle nature and adaptability.","x":350,"y":100,"width":500,"height":180,"color":"#4ECDC4"}
13
+ ],
14
+ "edges":[
15
+ {"id":"edge1","fromNode":"title","fromSide":"bottom","toNode":"overview","toSide":"top"},
16
+ {"id":"edge2","fromNode":"overview","fromSide":"bottom","toNode":"appearance","toSide":"top"},
17
+ {"id":"edge3","fromNode":"overview","fromSide":"bottom","toNode":"temperament","toSide":"top"},
18
+ {"id":"edge4","fromNode":"overview","fromSide":"bottom","toNode":"care","toSide":"top"},
19
+ {"id":"edge5","fromNode":"appearance","fromSide":"bottom","toNode":"health","toSide":"top"},
20
+ {"id":"edge6","fromNode":"temperament","fromSide":"bottom","toNode":"training","toSide":"top"},
21
+ {"id":"edge7","fromNode":"care","fromSide":"bottom","toNode":"health","toSide":"top"},
22
+ {"id":"edge8","fromNode":"overview","fromSide":"right","toNode":"history","toSide":"top"},
23
+ {"id":"edge9","fromNode":"health","fromSide":"bottom","toNode":"adoption","toSide":"left"},
24
+ {"id":"edge10","fromNode":"training","fromSide":"bottom","toNode":"adoption","toSide":"top"},
25
+ {"id":"edge11","fromNode":"history","fromSide":"bottom","toNode":"adoption","toSide":"right"},
26
+ {"id":"edge12","fromNode":"adoption","fromSide":"bottom","toNode":"resources","toSide":"top"}
27
+ ]
28
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 JSON Canvas MCP Server Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,41 @@
1
+ .PHONY: setup test lint format clean
2
+
3
+ # Create virtual environment and install dependencies
4
+ setup:
5
+ uv venv
6
+ uv pip install -r requirements.txt
7
+ uv pip install -e ".[dev]"
8
+
9
+ # Run tests
10
+ test:
11
+ pytest
12
+
13
+ # Run linting
14
+ lint:
15
+ black --check jsoncanvas tests examples
16
+ isort --check jsoncanvas tests examples
17
+ mypy jsoncanvas tests examples
18
+
19
+ # Format code
20
+ format:
21
+ black jsoncanvas tests examples
22
+ isort jsoncanvas tests examples
23
+
24
+ # Run example
25
+ example:
26
+ python examples/create_canvas.py
27
+
28
+ # Clean up generated files
29
+ clean:
30
+ rm -rf .pytest_cache
31
+ rm -rf .coverage
32
+ rm -rf htmlcov
33
+ rm -rf dist
34
+ rm -rf build
35
+ rm -rf *.egg-info
36
+ rm -rf output
37
+ find . -type d -name __pycache__ -exec rm -rf {} +
38
+ find . -type d -name "*.egg-info" -exec rm -rf {} +
39
+ find . -type f -name "*.pyc" -delete
40
+ find . -type f -name "*.pyo" -delete
41
+ find . -type f -name "*.pyd" -delete
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: iflow-mcp_Cam10001110101-mcp-server-jsoncanvas
3
+ Version: 0.1.0
4
+ Summary: MCP server for working with JSON Canvas files
5
+ Project-URL: Homepage, https://github.com/yourusername/mcp-server-jsoncanvas
6
+ Project-URL: Repository, https://github.com/yourusername/mcp-server-jsoncanvas.git
7
+ Author-email: Your Name <your.email@example.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: jsonschema>=4.20.0
12
+ Requires-Dist: mcp>=1.2.0
13
+ Requires-Dist: pillow>=10.1.0
14
+ Requires-Dist: svgwrite>=1.4.3
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
17
+ Requires-Dist: pytest>=7.4.0; extra == 'dev'
18
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
19
+ Description-Content-Type: text/markdown
20
+
21
+ # JSON Canvas MCP Server
22
+
23
+ A Model Context Protocol (MCP) server implementation that provides tools for working with JSON Canvas files according to the [official specification](https://jsoncanvas.org/spec/1.0/). This server enables creating, modifying, and validating infinite canvas data structures.
24
+
25
+ ## Overview
26
+
27
+ The JSON Canvas MCP server provides a complete implementation of the JSON Canvas 1.0 specification, enabling:
28
+
29
+ - Creation and manipulation of infinite canvas data
30
+ - Support for all node types (text, file, link, group)
31
+ - Edge connections with styling and labels
32
+ - Validation against the specification
33
+ - Configurable output paths
34
+
35
+ ## Components
36
+
37
+ ### Resources
38
+
39
+ The server exposes the following resources:
40
+
41
+ - `canvas://schema`: JSON Schema for validating canvas files
42
+ - `canvas://examples`: Example canvas files demonstrating different features
43
+ - `canvas://templates`: Templates for creating new canvases
44
+
45
+ ### Tools
46
+
47
+ #### Node Operations
48
+
49
+ - **create_node**
50
+ - Create a new node of any supported type
51
+ - Input:
52
+ - `type` (string): Node type ("text", "file", "link", "group")
53
+ - `properties` (object): Node-specific properties
54
+ - Common: `id`, `x`, `y`, `width`, `height`, `color`
55
+ - Type-specific: `text`, `file`, `url`, etc.
56
+ - Returns: Created node object
57
+
58
+ - **update_node**
59
+ - Update an existing node's properties
60
+ - Input:
61
+ - `id` (string): Node ID to update
62
+ - `properties` (object): Properties to update
63
+ - Returns: Updated node object
64
+
65
+ - **delete_node**
66
+ - Remove a node and its connected edges
67
+ - Input:
68
+ - `id` (string): Node ID to delete
69
+ - Returns: Success confirmation
70
+
71
+ #### Edge Operations
72
+
73
+ - **create_edge**
74
+ - Create a new edge between nodes
75
+ - Input:
76
+ - `id` (string): Unique edge identifier
77
+ - `fromNode` (string): Source node ID
78
+ - `toNode` (string): Target node ID
79
+ - `fromSide` (optional string): Start side ("top", "right", "bottom", "left")
80
+ - `toSide` (optional string): End side
81
+ - `color` (optional string): Edge color
82
+ - `label` (optional string): Edge label
83
+ - Returns: Created edge object
84
+
85
+ - **update_edge**
86
+ - Update an existing edge's properties
87
+ - Input:
88
+ - `id` (string): Edge ID to update
89
+ - `properties` (object): Properties to update
90
+ - Returns: Updated edge object
91
+
92
+ - **delete_edge**
93
+ - Remove an edge
94
+ - Input:
95
+ - `id` (string): Edge ID to delete
96
+ - Returns: Success confirmation
97
+
98
+ #### Canvas Operations
99
+
100
+ - **validate_canvas**
101
+ - Validate a canvas against the specification
102
+ - Input:
103
+ - `canvas` (object): Canvas data to validate
104
+ - Returns: Validation results with any errors
105
+
106
+ - **export_canvas**
107
+ - Export canvas to different formats
108
+ - Input:
109
+ - `format` (string): Target format ("json", "svg", "png")
110
+ - `canvas` (object): Canvas data to export
111
+ - Returns: Exported canvas in requested format
112
+
113
+ ## Usage with Claude Desktop
114
+
115
+ ### Docker
116
+
117
+ Add this to your `claude_desktop_config.json`:
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "jsoncanvas": {
123
+ "command": "docker",
124
+ "args": [
125
+ "run",
126
+ "-i",
127
+ "--rm",
128
+ "-v",
129
+ "canvas-data:/data",
130
+ "mcp/jsoncanvas"
131
+ ],
132
+ "env": {
133
+ "OUTPUT_PATH": "/data/output"
134
+ }
135
+ }
136
+ }
137
+ }
138
+ ```
139
+
140
+ ### UV
141
+
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "jsoncanvas": {
146
+ "command": "uv",
147
+ "args": [
148
+ "--directory",
149
+ "/path/to/jsoncanvas",
150
+ "run",
151
+ "mcp-server-jsoncanvas"
152
+ ],
153
+ "env": {
154
+ "OUTPUT_PATH": "./output"
155
+ }
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ ## Configuration
162
+
163
+ The server can be configured using environment variables:
164
+
165
+ - `OUTPUT_PATH`: Directory where canvas files will be saved (default: "./output")
166
+ - `FORMAT`: Default output format for canvas files (default: "json")
167
+
168
+ ## Building
169
+
170
+ ### Docker Build
171
+
172
+ ```bash
173
+ docker build -t mcp/jsoncanvas .
174
+ ```
175
+
176
+ ### Local Build
177
+
178
+ ```bash
179
+ # Install uv if not already installed
180
+ curl -LsSf https://astral.sh/uv/install.sh | sh
181
+
182
+ # Create virtual environment and install dependencies
183
+ uv venv
184
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
185
+ uv pip install -e .
186
+
187
+ # Run tests
188
+ pytest
189
+ ```
190
+
191
+ ## Example Usage
192
+
193
+ ### Creating a Canvas
194
+
195
+ ```python
196
+ from jsoncanvas import Canvas, TextNode, Edge
197
+
198
+ # Create nodes
199
+ title = TextNode(
200
+ id="title",
201
+ x=100,
202
+ y=100,
203
+ width=400,
204
+ height=100,
205
+ text="# Hello Canvas\n\nThis is a demonstration.",
206
+ color="#4285F4"
207
+ )
208
+
209
+ info = TextNode(
210
+ id="info",
211
+ x=600,
212
+ y=100,
213
+ width=300,
214
+ height=100,
215
+ text="More information here",
216
+ color="2" # Using preset color
217
+ )
218
+
219
+ # Create canvas
220
+ canvas = Canvas()
221
+ canvas.add_node(title)
222
+ canvas.add_node(info)
223
+
224
+ # Connect nodes
225
+ edge = Edge(
226
+ id="edge1",
227
+ from_node="title",
228
+ to_node="info",
229
+ from_side="right",
230
+ to_side="left",
231
+ label="Connection"
232
+ )
233
+ canvas.add_edge(edge)
234
+
235
+ # Save canvas
236
+ canvas.save("example.canvas")
237
+ ```
238
+
239
+ ## License
240
+
241
+ This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.