Labsco
MCP SERVER

SVG Converter

by RusianHu

Converts SVG to PNG, ICO or JPG with Cairo, and falls back to a hybrid mode that renders CJK text with PIL.

Image Analysis, OCR & Vision
Summary
The engine fallback chain is the reason it works anywhere.

SVG rasterisation usually fails at install time rather than run time, because Cairo needs a C library that is awkward on Windows. This ships three engines and degrades through them, and `get_converter_engine_info` tells you where you landed instead of leaving you to guess from a bad-looking PNG. The CJK overlay path is a real fix for a real problem: text that silently disappears in the standard renderers.

What it is

A conversion service built on FastMCP that turns SVG into raster formats. It prefers Cairo for quality and falls back to SVGLib then PIL when Cairo is not installed. The part worth knowing about is the hybrid path: when it detects Chinese characters in the source, it renders the graphics with Cairo or SVGLib and overlays the text with PIL, which is what keeps CJK glyphs from dropping out.

What you get
  • `convert_svg_file` converts a local SVG, with width, height, scale, quality, background, transparency and engine preference as parameters
  • `convert_svg_string` does the same from SVG markup held in memory, with no file to save first
  • `batch_convert_svg_files` converts a list of files into one output directory and reports success and failure counts
  • `get_svg_file_info` and `get_svg_string_info` analyse a source before conversion — dimensions, complexity, whether it contains Chinese characters
  • `get_converter_engine_info` reports which engines are actually available on this machine and what to install
  • PNG and ICO keep transparency; JPG does not
Requirements

Python 3.8+ and the package installed from source or from GitHub with pip; extras select the engines — `[cairo]` for the best rendering, `[svglib]` for compatibility, `[full]` for everything. Cairo needs the C library present first, which on Windows means installing the GTK runtime before `cairosvg`. `python -m svg_converter_mcp --check-deps` tells you what you actually have. Run it as `python -m svg_converter_mcp`; stdio, HTTP and SSE transports are all supported. No account, no key — it works on local files.

Setup effort

One command — pip install git+https://github.com/RusianHu/svg-converter-tools-mcp.git -i https://pypi.tuna.tsinghua.edu.cn/simple/