svg-whiteboard-mcp
# svg-whiteboard-mcp
MCP server that keeps **SVG path** canvases in memory, serves a **loopback HTML preview** (`127.0.0.1`), and returns [**proj-airi Surface**](https://github.com/moeru-ai/airi/tree/main/packages/mcp-surface-contract) **`embedUrl`** payloads so AIRI can render chat tool results in a **sandbox iframe**.
## Tools
| Tool | Purpose |
|------|---------|
| `create_canvas` | New canvas → `id` |
| `delete_canvas` | Remove canvas |
| `list_canvases` | List ids / sizes / path counts |
| `add_path` | Append SVG `<path>` (`d`, stroke, fill, …) |
| `delete_path` | Remove path by id |
| `list_paths` | Inspect paths on a canvas |
| `present_preview` | Return `structuredContent.projAiriSurface` with preview URL |
| `proj_airi_present_surface` | Same envelope for arbitrary `http(s)` URLs |
## Run (stdio)
```bash
pnpm install
pnpm build
node dist/index.js
```
MCP client config example:
```json
{
"mcpServers": {
"svg-whiteboard": {
"command": "node",
"args": ["/absolute/path/to/svg-whiteboard-mcp/dist/index.js"]
}
}
}
```
## Requirements
- Node 20+
- Host (e.g. Electron) must allow the renderer to load `http://127.0.0.1:*` preview URLs.
## Contract
`structuredContent` includes:
```json
{
"projAiriSurface": {
"version": 1,
"kind": "embedUrl",
"title": "...",
"data": { "url": "http://127.0.0.1:PORT/preview/CANVAS_ID", "mimeType": "text/html" }
}
}
```
Aligns with `@proj-airi/mcp-surface-contract` in the AIRI monorepo.
TDQS
Scored across 8 tools
Most tools have distinct purposes: canvas CRUD, path CRUD, and presentation. However, present_preview and proj_airi_present_surface both involve pushing content to AIRI, which could cause ambiguity despite differing descriptions.
All tool names follow a consistent verb_noun pattern with lowercase and underscores, e.g., create_canvas, add_path, present_preview. The proj_airi prefix maintains consistency.
Eight tools are well-scoped for an SVG whiteboard: three for canvas CRUD, three for path CRUD, and two for presentation. No tools feel extraneous or missing.
Core CRUD is present but missing update operations for both canvases (e.g., rename) and paths (e.g., modify d attribute). This is a notable gap that may frustrate agents.