AI-powered whiteboard in VSCode with an MCP (Model Context Protocol) server so AI agents can see what you draw.
- tldraw canvas in VSCode: Fast diagramming/drawing with autosave
- Save for AI button (Cmd+S): One-click snapshot for assistants
- MCP server (stdio): Exposes the canvas to MCP-compatible clients
- Image + text extraction: Assistants get a PNG snapshot and extracted text
get_canvas– Return current page analysis plus PNG image (if available)list_pages– List all pages and basic statsget_canvas_text– Extract text content (all pages or a specific page)test_connection– Quick connectivity check
- Install dependencies:
npm install
- Build extension and webview:
npm run build
- Open this folder in VSCode
- Press F5 to launch the Extension Development Host
- In the dev host:
- Use the status bar button “AIDraw” or
- Run the command: “AIDraw: Open Canvas”
- Draw something and click “Save for AI” (or press Cmd+S) once to generate the first snapshot
The server runs over stdio. You can get a ready-to-copy config via the command “AIDraw: Show MCP Connection Info”.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"aidraw": {
"command": "node",
"args": ["/absolute/path/to/vscode-aidraw/dist/mcp-server.js"]
}
}
}import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(
new StdioClientTransport({
command: "node",
args: ["/absolute/path/to/vscode-aidraw/dist/mcp-server.js"],
})
);
const res = await client.callTool("get_canvas", {});
console.log(res);aidraw.autoSaveInterval(ms, default 5000)aidraw.imageCaptureDelay(ms, default 2000)aidraw.imageQuality(scale 0.5–2, default 1)
npm run build– Clean, compile extension, bundle webviewnpm run compile– Bundle extension + MCP servernpm run build-webview– Bundle webviewnpm run watch/npm run watch-webview– Dev watch modesnpm run lint– Lint TypeScript
vscode-aidraw/
├─ src/
│ ├─ extension/
│ │ ├─ index.ts # Activation, commands, status bar
│ │ └─ CanvasPanel.ts # Webview panel and messaging
│ ├─ mcp/
│ │ └─ server.ts # MCP server (stdio)
│ ├─ services/
│ │ └─ StateManager.ts # Disk state, images, snapshot extraction
│ ├─ types/
│ │ └─ index.d.ts # Shared types
│ └─ webview/
│ ├─ index.tsx # Entrypoint
│ └─ CanvasApp.tsx # tldraw UI, capture + save
├─ dist/
│ ├─ extension.js
│ ├─ mcp-server.js
│ └─ webview/canvas.js
└─ media/ # Icons, styles
- You draw on the tldraw canvas in a VSCode webview
- The webview periodically captures a PNG of the current page and extracts text
StateManagerpersists a JSON state to.tldraw/canvas-state.jsonand PNGs to.tldraw/images- The MCP server serves that state and images to tools like Claude
- No pages returned by
list_pages: Open the canvas and click “Save for AI” once - Image missing in
get_canvas: Ensure you drew on the page and saved; image is generated per-page - Path issues: Use absolute path to
dist/mcp-server.jsin your client config
- Runs locally via stdio; no data is sent externally by default
- tldraw’s production use without watermark requires a commercial license
PRs and issues are welcome.
blog-website/contains a simple Node/Express + SQLite demo app used for examples. To run:cd blog-website npm install npm run dev # http://localhost:5173
Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE file for the specific language governing permissions and limitations under the License.