npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

svg2png-mcp-server

v1.0.1

Published

A simple MCP server for converting SVG to transparent PNG using ImageMagick. Compatible with Win/Mac/Linux, supports custom output file name and Cursor/Claude integration.

Readme

svg2png-mcp-server

MIT License Node.js ImageMagick

🚀 一款基于 Node.js + ImageMagick 的高兼容性 SVG 转透明 PNG 工具,支持 MCP 协议,适配 Win/Mac/Linux,适合 AI IDE、自动化、批量图标处理等场景。


功能亮点

  • 🖼️ 支持 SVG 文件/字符串一键转透明 PNG
  • 🧩 完全兼容 MCP 协议,适配 Cursor、Claude 等 AI IDE
  • 💻 跨平台:支持 Linux、macOS、Windows
  • 🔍 自动检测 rsvg-convert、magick、convert,多版本 ImageMagick 兼容
  • 📝 支持自定义输出文件名,自动防止并发覆盖
  • 📦 零依赖(仅需 Node.js + ImageMagick)
  • 📄 丰富日志,异常友好,开箱即用

效果截图


快速开始

1. 安装依赖

Ubuntu / Debian

sudo apt-get update
sudo apt-get install -y imagemagick

CentOS / RHEL

sudo yum install -y epel-release
sudo yum install -y ImageMagick

macOS (Homebrew)

brew install imagemagick

Windows

  • 推荐使用 ImageMagick 官方安装包
  • 安装后请将 magick.exe 所在目录加入系统 PATH 环境变量
  • 可在命令行输入 magick -version 验证安装

注意:

  • 建议安装 ImageMagick 7 及以上版本,优先使用 magick 命令。
  • 某些 Linux 发行版的 convert 可能被其他包占用,建议优先用 magick convert
  • 若需更高 SVG 兼容性,可选装 rsvg-convert(如 sudo apt-get install librsvg2-bin)。

2. 启动服务

npx svg2png-mcp-server

参数说明

  • svg:SVG内容字符串(可选)
  • svg_path:SVG文件路径(可选,优先)
  • base_dir在 Cursor 等 IDE 场景下为必填参数,svg_path 为相对路径时,必须传递 base_dir(即你的项目根目录),否则可能找不到文件。
  • output_name:可选,PNG输出文件名(如 avatar.png),不传则默认 temp.png 或同名.png,若已存在自动加时间戳。

安全提示: output_name 只能为文件名,不能包含路径(如 ../ 或 /xxx/yyy.png),否则可能被拒绝或导致安全风险。

注意: 由于 Cursor 目前不支持自动注入项目根目录,调用 svg2png 工具时请务必手动传入 base_dir 参数。


推荐调用示例

1. 直接传绝对路径

{
  "svg_path": "/your/project/icons/home.svg",
  "base_dir": "/your/project/icons",
  "output_name": "avatar.png"
}

2. 传 base_dir + 相对路径(Cursor 推荐写法)

{
  "svg_path": "icons/home.svg",
  "base_dir": "/your/project",  // 这里必须手动填写你的项目根目录
  "output_name": "avatar.png"    // 可选,输出文件名,不能包含路径
}

MCP 配置与调用示例

MCP 配置片段(.json)

{
  "mcpServers": {
    "svg2png": {
      "command": "npx",
      "args": ["-y", "svg2png-mcp-server"]
    }
  }
}

贡献指南

  • 欢迎 issue、PR、建议与反馈!
  • 如有兼容性、功能扩展、文档等需求,欢迎参与共建。

社区与反馈


开源协议

本项目基于 MIT License 开源,欢迎自由使用、修改和分发。