AI-Native Diagramming for Claude Code
Claude generates JSON specs → Vizcraft renders interactive diagrams → User can edit → Changes sync back to Claude
- MCP Server - 6 tools for Claude Code integration (create, update, describe, list, delete, export)
- Interactive Canvas - tldraw-powered infinite canvas with pan/zoom/edit
- AI Agents - Rule-based (dagre layout), preset (themes), LLM-powered agents
- Export - PNG, SVG, PDF export
- Version History - Git-like versioning for diagrams
- Thumbnails - Visual previews in the sidebar
- Dark/Light Theme - System-preference aware
- Mobile Responsive - Works on tablet/mobile screens
The easiest way to run Vizcraft with Claude Code CLI.
Step 1: Build the Docker image
git clone https://github.com/TerminalGravity/vizcraft.git
cd vizcraft
docker build -t vizcraft .Step 2: Start the Web UI
# Run the Web UI (for viewing/editing diagrams)
docker compose up -d
# Or manually:
docker run -d --name vizcraft-web -p 3420:3420 -v vizcraft-data:/app/data vizcraft webThe Web UI will be available at http://localhost:3420
Step 3: Configure Claude Code CLI
Add to your ~/.claude.json (global) or project's .mcp.json:
{
"mcpServers": {
"vizcraft": {
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "vizcraft-data:/app/data", "vizcraft", "mcp"]
}
}
}Important: The
-iflag is required for MCP's stdio communication. The-v vizcraft-data:/app/dataensures diagrams persist and are shared between the MCP server and Web UI.
Step 4: Restart Claude Code
# If using Claude Code CLI, restart your session
# The vizcraft tools should now be availableRun directly with Bun for development or if you prefer not to use Docker.
Step 1: Install and run
git clone https://github.com/TerminalGravity/vizcraft.git
cd vizcraft
bun install
# Terminal 1: Web UI
bun run web:dev
# Terminal 2: (Optional) MCP server for testing
bun run devStep 2: Configure Claude Code CLI
Add to your ~/.claude.json or project's .mcp.json:
{
"mcpServers": {
"vizcraft": {
"command": "bun",
"args": ["run", "/absolute/path/to/vizcraft/src/server.ts"],
"env": {
"WEB_URL": "http://localhost:3420"
}
}
}
}Note: Use the absolute path to
server.ts. TheWEB_URLtells the MCP server where the Web UI is running.
# Future: Install globally via npm
npx vizcraftAfter configuring Claude Code, you can verify the installation:
You: List my vizcraft diagrams
Claude: I'll check your diagrams using the vizcraft MCP server.
[Uses mcp__vizcraft__list_diagrams tool]
If you see the tool being called, the installation is successful.
Once installed, Claude Code has access to these tools:
// Create new diagram
mcp__vizcraft__create_diagram({
name: "Architecture",
project: "my-project",
spec: {
type: "flowchart",
nodes: [
{ id: "a", label: "Start", type: "circle" },
{ id: "b", label: "Process", type: "box" },
{ id: "c", label: "End", type: "circle" }
],
edges: [
{ from: "a", to: "b" },
{ from: "b", to: "c" }
]
}
})
// Update diagram
mcp__vizcraft__update_diagram({ id: "abc123", spec: {...} })
// Get diagram description for Claude
mcp__vizcraft__describe_diagram({ id: "abc123" })
// Export diagram
mcp__vizcraft__export_diagram({ id: "abc123", format: "svg" })
// List diagrams
mcp__vizcraft__list_diagrams({ project: "my-project" })
// Delete diagram
mcp__vizcraft__delete_diagram({ id: "abc123" })Ask Claude to create diagrams naturally:
You: Create an architecture diagram showing a web app with React frontend,
Node.js API, and PostgreSQL database
Claude: I'll create that architecture diagram for you.
[Uses mcp__vizcraft__create_diagram]
Done! View your diagram at http://localhost:3420/diagram/abc123
interface DiagramSpec {
type: "flowchart" | "architecture" | "sequence" | "freeform";
theme?: "dark" | "light" | "professional";
nodes: Array<{
id: string;
label: string;
type?: "box" | "diamond" | "circle" | "database" | "cloud" | "cylinder";
color?: string;
position?: { x: number; y: number };
}>;
edges: Array<{
from: string;
to: string;
label?: string;
style?: "solid" | "dashed" | "dotted";
color?: string;
}>;
}Agents are YAML configs in data/agents/ that transform diagrams:
# Auto Layout (rule-based)
name: "Auto Layout"
type: "rule-based"
actions:
- dagre_layout
- snap_to_grid
# Theme Preset
name: "Professional Theme"
type: "preset"
styles:
node_fill: "#1e293b"
node_stroke: "#3b82f6"
edge_color: "#64748b"
# LLM Agent (requires API key)
name: "Annotate"
type: "llm"
provider: "anthropic"
prompt: "Add helpful annotations to this diagram"Run agents via the Web UI sidebar or API:
POST /api/diagrams/:id/run-agent/:agentId- Sidebar: Project browser with thumbnails + Agent panel
- Canvas: tldraw infinite canvas with pan/zoom/edit
- Panel: Diagram info + Export buttons
| Key | Action |
|---|---|
Cmd/Ctrl + N |
New diagram |
Cmd/Ctrl + S |
Copy spec |
Cmd/Ctrl + E |
Export PNG |
Cmd/Ctrl + / |
Show help |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/diagrams |
List diagrams |
| GET | /api/diagrams/:id |
Get diagram |
| POST | /api/diagrams |
Create diagram |
| PUT | /api/diagrams/:id |
Update diagram |
| PUT | /api/diagrams/:id/thumbnail |
Update thumbnail |
| DELETE | /api/diagrams/:id |
Delete diagram |
| GET | /api/diagrams/:id/versions |
Get version history |
| GET | /api/diagrams/:id/export/svg |
Export as SVG |
| GET | /api/agents |
List agents |
| GET | /api/agents/:id |
Get agent |
| POST | /api/diagrams/:id/run-agent/:agentId |
Run agent |
# Build the image
docker build -t vizcraft .
# Run Web UI (with docker-compose)
docker compose up -d
# Run Web UI (manual)
docker run -d --name vizcraft-web -p 3420:3420 -v vizcraft-data:/app/data vizcraft web
# Run MCP server (for Claude Code CLI - configured in .mcp.json)
docker run -i --rm -v vizcraft-data:/app/data vizcraft mcp
# View logs
docker logs vizcraft-web
# Stop
docker compose down
# Remove data volume (caution: deletes all diagrams)
docker volume rm vizcraft-data- Runtime: Bun
- MCP Server: @modelcontextprotocol/sdk (stdio transport)
- Database: bun:sqlite
- Web UI: React 19 + tldraw 4.3
- API: Hono
- Export: jsPDF for PDF
- Layout: @dagrejs/dagre for auto-layout
# Install
bun install
# Run tests
bun test
# Run Web UI (dev mode with hot reload)
bun run web:dev
# Run MCP server (dev mode)
bun run dev
# Build web UI
bun run web:build
# Build for production
bun run buildvizcraft/
├── src/
│ ├── server.ts # MCP server (stdio)
│ ├── web-server.ts # Hono REST API + static files
│ ├── storage/db.ts # SQLite layer
│ ├── agents/
│ │ ├── loader.ts # YAML agent loader
│ │ └── runner.ts # Agent executor
│ └── types/index.ts # TypeScript types
├── web/
│ ├── app.tsx # React app
│ ├── index.html # Entry
│ └── styles.css # Styling
├── data/
│ ├── diagrams/ # Diagram storage (SQLite)
│ ├── exports/ # Exported files
│ └── agents/ # Agent YAML configs
├── Dockerfile # Multi-service Docker image
├── docker-compose.yml # Web UI service
├── docker-entrypoint.sh # Entrypoint script
└── package.json
- Ensure Docker is running
- Verify the volume name matches:
vizcraft-data - Check Claude Code config path is correct
- Restart Claude Code CLI after config changes
- Ensure both MCP server and Web UI use the same volume
- Check the volume exists:
docker volume ls | grep vizcraft - Verify Web UI is running:
curl http://localhost:3420/api/health
- Ensure you have Docker 20.10+ installed
- Try:
docker build --no-cache -t vizcraft .
- MCP server with 6 tools
- SQLite persistence with versioning
- Web UI with tldraw canvas
- Export to PNG/SVG/PDF
- Agent system (rule-based, preset, LLM)
- Dagre auto-layout
- Theme presets
- Keyboard shortcuts
- Dark/light theme toggle
- Mobile responsive
- Toast notifications
- Diagram thumbnails
- Docker support
- Integration tests
MIT
Built with Claude Code