MCP server that converts raster images (PNG/JPG/WEBP) to SVG vector format
Project description
image2svg-mcp
An MCP server that converts raster images (PNG, JPG, WEBP) to scalable SVG vector graphics.
Features
- Accepts images as base64-encoded data or URL
- Supports PNG, JPG, JPEG, WEBP, TIFF, and other common raster formats
- Full control over vectorization parameters (color precision, speckle filtering, tracing mode, etc.)
- Handles
data:image/...;base64,URI prefixes automatically - Streams URL downloads with a 5 MB size limit
- Optional
file://URL support for local images (opt-in via--allow-local-files-path)
Usage
Claude Code & Claude Desktop
Add to your settings.json:
{
"mcpServers": {
"image2svg": {
"command": "uvx",
"args": ["image2svg-mcp"]
}
}
}
for Claude Code add using command line:
claude mcp add image2svg --scope user -- uvx image2svg-mcp
with access to local files:
claude mcp add image2svg --scope user -- uvx image2svg-mcp --allow-local-files-path /home/user/images
This enables prompts like:
"Convert this local file to SVG: /home/user/images/logo.png"
Only files inside the specified directory (and its subdirectories) are accessible. Paths are normalized to prevent directory traversal. Without this flag, file:// URLs are rejected.
Example Prompts
Here are some examples of what you can tell an LLM to do with this tool:
1. Simple image-to-SVG conversion
"Generate an image of a sunset over mountains, then convert it to SVG."
The LLM will generate a raster image and then use the convert_image_to_svg tool with default settings to produce a clean vector version.
2. Fine-tuned conversion with specific parameters
"Create a logo with a blue circle and a white star inside it. Now convert it to SVG using binary colormode for crisp edges and set filter_speckle to 10 to remove noise."
This uses colormode: "binary" for black/white line art style output, which works great for logos and icons. The higher filter_speckle value removes small artifacts.
3. Convert from URL with minimalist style
"Convert this image to a simplified SVG with low color precision for a minimalist poster look: https://example.com/photo.png"
Using color_precision: 3 reduces the number of colors dramatically, producing an artistic posterized vector effect. Great for stylized illustrations.
4. Convert a base64 image directly
"Convert this base64 image to SVG: iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAO0lEQVR4nGP8z8Dwn4EIwESMIqwKGRn+MzBisYQJXRE2NopCbKYgi5Huxv8MjBiSyGJMuCTQNTJSPRwBCjYOD5JU5rIAAAAASUVORK5CYII="
This is a 10x10 red square with a blue circle in the middle. Useful for testing the tool with inline image data — no URL needed.
Tool Parameters
| Parameter | Type | Default | Range | Description |
|---|---|---|---|---|
image_base64 |
string | - | - | Base64-encoded image data. Provide this OR image_url. |
image_url |
string | - | - | URL to fetch the image from (http://, https://, or file:// when enabled). Provide this OR image_base64. |
colormode |
string | "color" |
color, binary |
Full color or black/white line art |
mode |
string | "spline" |
spline, polygon, none |
Tracing mode: smooth curves, straight edges, or pixel-perfect |
filter_speckle |
int | 4 |
0-128 | Remove speckles of N pixels or fewer |
color_precision |
int | 6 |
1-12 | Color quantization bits. Lower = fewer colors, simpler SVG |
layer_difference |
int | 16 |
0-128 | Color difference for merging layers |
corner_threshold |
int | 60 |
0-180 | Angle threshold for corner detection (degrees) |
length_threshold |
float | 4.0 |
3.5-10.0 | Minimum path segment length |
splice_threshold |
int | 45 |
0-180 | Angle threshold for splicing splines |
path_precision |
int | 8 |
1-12 | Decimal precision for SVG coordinates |
hierarchical |
string | "stacked" |
stacked, cutout |
Layer arrangement mode |
max_iterations |
int | 10 |
1-100 | Max curve fitting iterations |
Development
Installation
git clone https://github.com/botmonster/image2svg-mcp.git
cd image2svg-mcp
uv sync
Run tests
uv run pytest tests/ -v
Run the MCP Inspector
uv run fastmcp dev inspector src/image2svg_mcp/server.py:mcp
License
Apache 2.0 - see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image2svg_mcp-1.0.0.tar.gz.
File metadata
- Download URL: image2svg_mcp-1.0.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
741cce1f3d409f75cc379d3fea5ea77aab5b2bd92845093fbf933224703ffc20
|
|
| MD5 |
70544f6bdf64eccefee63dd6e97866ee
|
|
| BLAKE2b-256 |
c6ffcaba85880ddfeacca4936a804d2b3d4056ccd5e765fb284880acb68da657
|
Provenance
The following attestation bundles were made for image2svg_mcp-1.0.0.tar.gz:
Publisher:
publish.yml on botmonster/image2svg-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
image2svg_mcp-1.0.0.tar.gz -
Subject digest:
741cce1f3d409f75cc379d3fea5ea77aab5b2bd92845093fbf933224703ffc20 - Sigstore transparency entry: 1237475256
- Sigstore integration time:
-
Permalink:
botmonster/image2svg-mcp@898c2c92024733137e655ccb0922bda96fe5ab2c -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/botmonster
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@898c2c92024733137e655ccb0922bda96fe5ab2c -
Trigger Event:
push
-
Statement type:
File details
Details for the file image2svg_mcp-1.0.0-py3-none-any.whl.
File metadata
- Download URL: image2svg_mcp-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8047a1c2e256f09ec71e41dd8865e49654128a40dad78846aea74688b4a9ef0
|
|
| MD5 |
9c4625e75749493f4d71460de93bea1a
|
|
| BLAKE2b-256 |
7836520a52b66d8c11d4d66337062d6c0ec5ce20adf96b6502315cb5d37e0d15
|
Provenance
The following attestation bundles were made for image2svg_mcp-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on botmonster/image2svg-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
image2svg_mcp-1.0.0-py3-none-any.whl -
Subject digest:
e8047a1c2e256f09ec71e41dd8865e49654128a40dad78846aea74688b4a9ef0 - Sigstore transparency entry: 1237475336
- Sigstore integration time:
-
Permalink:
botmonster/image2svg-mcp@898c2c92024733137e655ccb0922bda96fe5ab2c -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/botmonster
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@898c2c92024733137e655ccb0922bda96fe5ab2c -
Trigger Event:
push
-
Statement type: