Skip to main content
Glama

image2svg-mcp

PyPI Docker License Tests

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)

Related MCP server: WebP Batch Converter

Usage

To see it in action check converting image to svg online.

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

Docker

Run as an HTTP server:

docker run -p 8000:8000 ghcr.io/botmonster/image2svg-mcp

With local file access:

docker run -p 8000:8000 -v /home/user/images:/images ghcr.io/botmonster/image2svg-mcp --allow-local-files-path /images
claude mcp add image2svg --transport http --scope user http://localhost:8000/mcp

This enables prompts like:

Convert this local file to SVG: file://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

Available Tools

1 tool
convert_image_to_svgA
Read-onlyIdempotent

Convert a raster image (PNG, JPG, or WEBP) to SVG vector format.

Accepts either base64-encoded image data or a URL. Returns the SVG content as a string. Adjust tracing parameters to control the fidelity and complexity of the output.

ParametersJSON Schema
NameRequiredDescriptionDefault
image_base64NoBase64-encoded image data (PNG, JPG, or WEBP). Provide this OR image_url, not both.
image_urlNoURL to fetch the image from (PNG, JPG, or WEBP). Provide this OR image_base64, not both.
colormodeNoColor mode: 'color' for full color, 'binary' for black/white line artcolor
modeNoTracing mode: 'spline' (smooth curves), 'polygon' (straight edges), or 'none' (pixel-perfect)spline
filter_speckleNoRemove speckles of this many pixels or fewer. Higher = cleaner but loses small details. Default 4.
color_precisionNoNumber of significant bits for color quantization. Lower = fewer colors, simpler SVG. Default 6.
layer_differenceNoColor difference threshold for merging layers. Higher = fewer layers, simpler SVG. Default 16.
corner_thresholdNoAngle threshold in degrees for detecting corners. Default 60.
length_thresholdNoMinimum path segment length. Default 4.0.
splice_thresholdNoAngle threshold for splicing splines. Default 45.
path_precisionNoDecimal precision for SVG path coordinates. Lower = smaller file size. Default 8.
hierarchicalNoLayer arrangement: 'stacked' (overlapping) or 'cutout' (non-overlapping)stacked
max_iterationsNoMaximum curve fitting iterations. Higher = more accurate but slower. Default 10.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds context on what the tool does (converts images, returns SVG string) and mentions adjustable parameters. Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true. The description does not contradict annotations and provides additional but not extensive behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (two paragraphs) and front-loaded with the essential purpose. Each sentence is purposeful, with no wasted words. The structure effectively communicates key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Considering the tool's complexity (13 parameters, all well-documented in schema, and an output schema exists), the description covers the core conversion process and parameter adjustability. It doesn't detail output format specifics, but the output schema addresses that. The description is sufficiently complete for agent usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with each parameter described in the schema. The description mentions 'adjust tracing parameters to control fidelity and complexity' but does not elaborate on individual parameters. Given high coverage, the description adds minimal extra meaning, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool converts raster images (PNG, JPG, WEBP) to SVG vector format, specifies input methods (base64 or URL), and notes adjustable tracing parameters. It is specific and distinguishes the tool's purpose from any siblings (none listed).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use: for converting raster images to SVG, with inputs via base64 or URL. While it doesn't explicitly exclude alternatives, no sibling tools exist, so the guidance is sufficient.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev1.0.0
    • First observedconvert_image_to_svg

TDQS

A4.3/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no risk of confusion or overlap. The tool's purpose is clearly defined and distinct.

Naming Consistency5/5

The single tool name follows a consistent verb_noun pattern (convert_image_to_svg). No inconsistency is possible with only one tool.

Tool Count4/5

The server is scoped to a single conversion task, so one tool is reasonable. However, it feels slightly minimal; additional tools for parameter adjustment or batch processing could be beneficial.

Completeness4/5

The tool covers the core conversion operation but lacks auxiliary tools for e.g., managing tracing parameters or validating outputs. This is a minor gap given the focused domain.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers