SVG to PNG MCP Server

by longbowzz

Not rated
GitHub

About

A server that converts SVG code to PNG images using the cairosvg library.

Details

Author
longbowzz
Categories
Developer Tools, Other

Setup

Install SVG to PNG MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/longbowzz/svg2png_mcp

Follow the installation instructions in the repository README, then restart your MCP client.

这是一个基于Model Context Protocol (MCP)的SVG转PNG工具服务器。

- 将SVG代码转换为PNG图片
- 支持指定工作目录
- 基于MCP协议,可与其他MCP客户端集成

- 使用cairosvg库进行转换
- 优点:

- 转换速度快
- 依赖少,安装简单
- 适合简单的SVG图形转换

- 使用Inkscape命令行工具进行转换
- 优点:

- 完整支持SVG所有特性
- 更好的字体渲染支持
- 转换效果更准确

注意:当前版本默认使用CairoSVG方案,如果遇到字体渲染问题或复杂SVG转换问题,可以考虑切换到Inkscape方案。

svg2png_mcp/ ├── src/ │ ├── server.py # MCP服务器实现 │ ├── svg2png.py # SVG转PNG的业务逻辑 │ └── test_client.py # 测试客户端 ├── servers_config.example.json # MCP服务器配置示例 └── requirements.txt # 依赖文件

To install SVG to PNG MCP Server for Claude Desktop automatically viaSmithery:

npx -y @smithery/cli install @longbowzz/svg2png_mcp --client claude
# 创建虚拟环境 python -m venv venv # 激活虚拟环境 # 在 macOS/Linux 上: source venv/bin/activate # 在 Windows 上: .\venv\Scripts\activate
cp servers_config.example.json servers_config.json
{ "mcpServers": { "svg2png": { "command": "/absolute/path/to/venv/bin/python", "args": [ "/absolute/path/to/svg2png_mcp/src/server.py" ] } } }

- command必须是虚拟环境中 Python 解释器的绝对路径
- args中的server.py路径必须是绝对路径
- 这是为了确保其他 MCP 客户端能够正确找到并启动服务器

# 获取Python解释器的绝对路径(在虚拟环境中运行) which python # macOS/Linux where python # Windows # 获取项目根目录的绝对路径 pwd # macOS/Linux cd # Windows
{ "mcpServers": { "svg2png": { "command": "/Users/username/projects/svg2png_mcp/venv/bin/python", "args": [ "/Users/username/projects/svg2png_mcp/src/server.py" ] } } }
{ "mcpServers": { "svg2png": { "command": "C:\\Users\\username\\projects\\svg2png_mcp\\venv\\Scripts\\python.exe", "args": [ "C:\\Users\\username\\projects\\svg2png_mcp\\src\\server.py" ] } } }
# 确保虚拟环境已激活 source venv/bin/activate # macOS/Linux # 运行客户端 python src/test_client.py

如果运行正常,将在test_output目录生成一张名为output.png的图片。

将servers_config.json中的内容填入Cursor、Claude desktop等MCP客户端即可使用。

- MCP客户端会自动根据servers_config.json中的配置启动服务器
- 确保servers_config.json中使用了正确的绝对路径
- 确保在运行客户端时已激活虚拟环境

- 使用 FastMCP 框架实现 MCP 服务器
- 提供svg_to_png工具接口
- 支持异步操作和错误处理

- SVG 到 PNG 的转换使用 cairosvg 库
- 支持自定义工作目录
- 提供完整的错误处理和日志记录

- mcp:MCP 协议实现
- cairosvg:SVG 转换核心库
- Pillow:图像处理支持

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Convert raster images (PNG, JPG, WEBP, TIFF) to scalable SVG vector graphics locally, with no API key, via a single convert_image_to_svg tool.

AI-powered SVG animation generator that transforms static files into animated SVG components using the Allyson platform

Get access to MCP server SVG and MCP server PNG icons in your vibe-coding projects

Manipulate Adventure Game Studio (AGS) compiled room (.crm) files to enable AI-powered game development.

A growing collection of MCP tools for Android Development. Currently features a deterministic Figma-SVG-to-Android-XML converter, with plans for Gradle analysis, Resource management, and ADB integration tools.

745+ CSS3 animations and 9,000+ real SVG icons for AI coding agents. 10 MCP tools. Zero-clone setup via npx.

A simple and efficient MCP server for Base64 encoding and decoding of text and images.

AI-powered document extraction infrastructure. Convert PDFs, Excel files, and scanned documents into structured JSON.

Create, validate, and render diagrams from D2 (Declarative Diagramming) code into SVG and PNG formats.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.