svgwriter-mcp
Provides tools to create, compose, and export SVG documents using the svgwrite library, including shapes, groups, gradients, patterns, and text.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@svgwriter-mcpCreate an SVG document with a blue circle and Hello text"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
svgwriter-mcp
An MCP server that wraps the svgwrite Python library, enabling LLM agents to create, compose, and export SVG documents through tool calls.
Features
21 tools covering the full SVG creation workflow
In-memory document state — create multiple documents in a session
Groups, gradients, shapes, text, paths, and pattern generators
Returns SVG as a string or saves directly to disk
Related MCP server: Excalidraw MCP Server
Installation
git clone <repo>
cd svgwriter-mcp
uv syncUsage
As an MCP server (stdio)
uv run python main.pyAs a library (direct function calls)
import json, server
result = json.loads(server.create_document(width="800px", height="600px"))
doc_id = result["doc_id"]
server.add_rect(doc_id=doc_id, x=0, y=0, width=800, height=600, fill="#eef")
server.add_text(doc_id=doc_id, text="Hello SVG", x=400, y=300, text_anchor="middle")
server.save_file(doc_id=doc_id, filepath="hello.svg")Run the demo
uv run python example.py
# produces example_output.svgMCP Client Configuration
Add to your Claude Desktop claude_desktop_config.json
(%APPDATA%\Claude\claude_desktop_config.json on Windows,
~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"svgwriter": {
"command": "uv",
"args": [
"run",
"python",
"/path/to/svgwriter-mcp/main.py"
]
}
}
}Note: Use the absolute path to
main.pyon your machine (e.g.C:\\Users\\you\\svgwriter-mcp\\main.pyon Windows). Using the full path avoids working-directory issues with Claude Desktop.
Tool Reference
Document Lifecycle
Tool | Description |
| Create a new SVG document; returns |
| List all open documents with their sizes |
| Delete a document and free its state |
| Return the SVG XML as a raw string |
| Return the SVG as an inline |
| Write the SVG to a file on disk |
Shapes
All shape tools accept an optional group_id to target a group instead of the document root.
Tool | Key Parameters |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Groups
Tool | Description |
| Create a |
| List all group ids in a document |
Gradients
Use the returned url_ref (e.g. url(#grad1)) as a fill value for shapes.
Tool | Description |
| Add a |
| Add a |
| List all gradients in a document |
Pattern Generators
Tool | Description |
| Grid of lines at |
| Alternating |
| Small circles at |
| Circles from |
Development
# Install with dev deps
uv sync --group dev
# Run tests
uv run pytest -v
# Syntax check
uv run python -c "import server; print('OK')"Response Format
All tools return a JSON string:
{"status": "ok", "doc_id": "doc_abc123"}
{"status": "error", "message": "Document 'x' not found."}This server cannot be deployed
Maintenance
Related MCP Connectors
Generate and vectorize clean, editable SVG graphics from text, images, or both.
Generate vector art, vectorize images, and return SVG, PNG, and logo kits to AI agents.
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
Visual AI for strategic thinking — SWOT, flowcharts, mindmaps, Gantt diagrams as polished SVG.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables LLMs to programmatically generate, edit, and convert SVG images using the SVGMaker API and save them to the local filesystem.104 npm87MIT
- AlicenseAqualityDmaintenanceEnables creation, management, and export of Excalidraw drawings through natural language. Supports CRUD operations on drawings and export to SVG, PNG, and JSON formats with file-based storage.82,102 npm-
- AlicenseAqualityCmaintenanceEnables AI agents to create data visualizations like bar charts, line charts, pie charts, scatter plots, and histograms, returning inline SVG or PNG files.5MIT
- AlicenseNot gradedqualityAmaintenanceA FastMCP server providing structured SVG authoring tools for LLMs, enabling create, edit, and render SVG graphics through hierarchical primitives, gradients, paths, and reusable resources.5GPL 2.0