A Model Context Protocol server that provides tools for converting SVG code to high-quality PNG and JPG images with detailed customization options.
A Model Context Protocol (MCP) server that provides tools for converting SVG code to high-quality PNG and JPG images with detailed customization options.
npx mcp-svg-converter /path/to/allowed/directory
npm install -g mcp-svg-converter mcp-svg-converter /path/to/allowed/directory
Clone this repository
git clone https://github.com/surferdot/mcp-svg-converter.git cd mcp-svg-converter
Install dependencies
npm install
Build the project
npm run build
Run the server by specifying one or more allowed directories where the converted images can be saved:
node build/index.js /path/to/allowed/directory1 /path/to/allowed/directory2
Download and install Claude Desktop
Create or confirm you have access to an output directory:
# macOS/Linux mkdir -p ~/Desktop/svg-output # Windows mkdir "%USERPROFILE%\Desktop\svg-output"
Configure Claude Desktop by editing the configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Open the Claude app, click on the Claude menu in your system menu bar and select "Settings..."
Click on "Developer" in the left sidebar
Click "Edit Config" to open the configuration file
Add this server configuration:
{ "mcpServers": { "svg-converter": { "command": "npx", "args": [ "mcp-svg-converter", "/absolute/path/to/output/directory" ] } } }
If you've installed the package globally:
{ "mcpServers": { "svg-converter": { "command": "mcp-svg-converter", "args": [ "/absolute/path/to/output/directory" ] } } }
If you've built from source:
{ "mcpServers": { "svg-converter": { "command": "node", "args": [ "/absolute/path/to/mcp-svg-converter/build/index.js", "/absolute/path/to/output/directory" ] } } }
When Claude Desktop restarts, if configured correctly:
svg-to-png
and svg-to-jpg
tools.In Claude Desktop, send a message like:
Please convert this SVG to PNG and save it to my output directory:
SVG Example
Please convert this SVG to a JPG with 95% quality and 2x scaling:
Converts SVG code to a high-quality PNG image with transparency support.
Parameters:
svgCode
(string, required): The SVG code to convertoutputPath
(string, required): Path where the PNG file should be savedbackgroundColor
(string, optional): Background color (default: transparent)scale
(number, optional): Scale factor for higher resolution (default: 1)Converts SVG code to a high-quality JPG image.
Parameters:
svgCode
(string, required): The SVG code to convertoutputPath
(string, required): Path where the JPG file should be savedbackgroundColor
(string, optional): Background color (default: white)quality
(number, optional): JPEG quality from 1-100 (default: 90)scale
(number, optional): Scale factor for higher resolution (default: 1)You can specify multiple allowed output directories for more flexible file saving:
{ "mcpServers": { "svg-converter": { "command": "npx", "args": [ "mcp-svg-converter", "/Users/yourusername/Desktop/svg-output", "/Users/yourusername/Documents/svg-images", "/Users/yourusername/Downloads" ] } } }
Specify detailed file paths in your request:
Please convert this SVG to PNG, and save it as "colorful_shapes.png" in my output directory.
...
If you request saving to a non-allowed directory, the converter automatically redirects to an allowed directory and informs you of the actual save location.
~/Library/Logs/Claude/mcp*.log
%APPDATA%\Claude\logs\mcp*.log
mcp-svg-converter
is correctly installedmcp-svg-converter
is globally installed or correctly reference npx
You can use the MCP Inspector to debug and test the server directly:
npx @modelcontextprotocol/inspector npx mcp-svg-converter /path/to/allowed/directory
This opens an interactive interface where you can test all available tools without going through Claude Desktop.
MIT
MCP SVG 转换器是一个基于模型上下文协议 (MCP) 的服务器,提供将 SVG 代码转换为高质量 PNG 和 JPG 图像的工具,支持详细的自定义选项。
npx mcp-svg-converter /path/to/allowed/directory
npm install -g mcp-svg-converter mcp-svg-converter /path/to/allowed/directory
克隆此仓库
git clone https://github.com/surferdot/mcp-svg-converter.git cd mcp-svg-converter
安装依赖
npm install
构建项目
npm run build
通过指定一个或多个允许存储转换后图像的目录来运行服务器:
node build/index.js /path/to/allowed/directory1 /path/to/allowed/directory2
下载并安装 Claude Desktop
创建或确认你有权限访问的输出目录:
# macOS/Linux mkdir -p ~/Desktop/svg-output # Windows mkdir "%USERPROFILE%\Desktop\svg-output"
配置 Claude Desktop:
编辑配置文件:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
添加服务器配置:
{ "mcpServers": { "svg-converter": { "command": "npx", "args": [ "mcp-svg-converter", "/absolute/path/to/output/directory" ] } } }
如果你已全局安装了此包:
{ "mcpServers": { "svg-converter": { "command": "mcp-svg-converter", "args": [ "/absolute/path/to/output/directory" ] } } }
如果你从源代码构建:
{ "mcpServers": { "svg-converter": { "command": "node", "args": [ "/absolute/path/to/mcp-svg-converter/build/index.js", "/absolute/path/to/output/directory" ] } } }
当 Claude Desktop 重启后,如果配置正确:
svg-to-png
和 svg-to-jpg
工具。在 Claude Desktop 中发送以下消息:
请将这个 SVG 转换为 PNG 并保存到我的输出目录:
SVG 示例
请将这个 SVG 转换为 95% 质量和 2 倍缩放的 JPG 图像:
将 SVG 代码转换为支持透明度的高质量 PNG 图像。
参数:
svgCode
(字符串,必需):要转换的 SVG 代码outputPath
(字符串,必需):PNG 文件的保存路径backgroundColor
(字符串,可选):背景颜色 (默认:透明)scale
(数字,可选):更高分辨率的缩放因子 (默认:1)将 SVG 代码转换为高质量 JPG 图像。
参数:
svgCode
(字符串,必需):要转换的 SVG 代码outputPath
(字符串,必需):JPG 文件的保存路径backgroundColor
(字符串,可选):背景颜色 (默认:白色)quality
(数字,可选):JPEG 质量,范围从 1 到 100 (默认:90)scale
(数字,可选):更高分辨率的缩放因子 (默认:1)你可以指定多个允许的输出目录,以提供更灵活的文件保存选项:
{ "mcpServers": { "svg-converter": { "command": "npx", "args": [ "mcp-svg-converter", "/Users/yourusername/Desktop/svg-output", "/Users/yourusername/Documents/svg-images", "/Users/yourusername/Downloads" ] } } }
在请求中指定详细的文件路径:
请将这个 SVG 转换为 PNG,并以文件名 "colorful_shapes.png" 保存到输出目录。
...
如果你请求保存到一个不允许的目录,转换器会自动将文件重定向到允许的目录,并在响应中告知你实际的保存位置。
~/Library/Logs/Claude/mcp*.log
%APPDATA%\Claude\logs\mcp*.log
mcp-svg-converter
mcp-svg-converter
或正确引用 npx
您可以使用 MCP Inspector 直接调试和测试服务器:
npx @modelcontextprotocol/inspector npx mcp-svg-converter /path/to/allowed/directory
这将打开一个交互式界面,你可以在其中测试所有可用工具,而无需通过 Claude Desktop。
MIT
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!