The MCP SVG Converter server offers tools for transforming SVG code into high-quality PNG and JPG images with extensive customization options. It supports transparency, scaling, and background color options while ensuring secure file operations.
npx mcp-svg-converter /path/to/allowed/directory
npm install -g mcp-svg-converter
mcp-svg-converter /path/to/allowed/directory
First ensure you have Node.js 16+ and npm installed, then:
git clone https://github.com/surferdot/mcp-svg-converter.git
cd mcp-svg-converter
npm install
npm run build
Specify one or more allowed directories where converted images can be saved:
node build/index.js /path/to/allowed/directory1 /path/to/allowed/directory2
Download and install Claude Desktop
Create an output directory:
# macOS/Linux
mkdir -p ~/Desktop/svg-output
# Windows
mkdir "%USERPROFILE%\Desktop\svg-output"
Configure Claude Desktop:
Add this server configuration to the opened file:
{
"mcpServers": {
"svg-converter": {
"command": "npx",
"args": [
"mcp-svg-converter",
"/absolute/path/to/output/directory"
]
}
}
}
Converts SVG code to high-quality PNG with transparency support.
Parameters:
svgCode
(string, required): The SVG code to convertoutputPath
(string, required): Where to save the PNG filebackgroundColor
(string, optional): Background color (default: transparent)scale
(number, optional): Resolution scale factor (default: 1)Converts SVG code to high-quality JPG.
Parameters:
svgCode
(string, required): The SVG code to convertoutputPath
(string, required): Where to save the JPG filebackgroundColor
(string, optional): Background color (default: white)quality
(number, optional): JPEG quality from 1-100 (default: 90)scale
(number, optional): Resolution scale factor (default: 1)Please convert this SVG to PNG and save it to my output directory:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100" width="200" height="100">
<rect x="10" y="10" width="80" height="80" fill="#4285f4" />
<circle cx="140" cy="50" r="40" fill="#ea4335" />
<path d="M10 50 L90 50 L50 90 Z" fill="#fbbc05" />
<text x="100" y="20" font-family="Arial" font-size="12" text-anchor="middle" fill="#34a853">SVG Example</text>
</svg>
Please convert this SVG to a JPG with 95% quality and 2x scaling:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
<rect width="200" height="200" fill="#f0f0f0" />
<circle cx="100" cy="100" r="80" fill="#ff6b6b" />
<path d="M100 50 L130 150 L70 150 Z" fill="white" />
</svg>
You can configure multiple allowed directories for more flexibility:
{
"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.
<svg>...</svg>
mcp-svg-converter
is correctly installedUse the MCP Inspector to test the server directly:
npx @modelcontextprotocol/inspector npx mcp-svg-converter /path/to/allowed/directory
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "svg-converter" '{"command":"npx","args":["mcp-svg-converter","/absolute/path/to/output/directory"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"svg-converter": {
"command": "npx",
"args": [
"mcp-svg-converter",
"/absolute/path/to/output/directory"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"svg-converter": {
"command": "npx",
"args": [
"mcp-svg-converter",
"/absolute/path/to/output/directory"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect