Supports Preact JSX runtime for generating Preact-compatible components from SVG content.
Enables automatic formatting of generated React component code with configurable Prettier options.
Transforms SVG strings into React components with support for React Native, props forwarding, ref support, and React.memo wrapping.
Converts SVG content into React components with configurable options for TypeScript generation, optimization, and formatting.
Provides optional SVG optimization through SVGO integration before converting to React components.
Supports generation of TypeScript React components from SVG content.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SVGR MCP Serverconvert this SVG to a TypeScript React component named LogoIcon"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SVGR MCP Server
A Model Context Protocol (MCP) server that exposes SVGR functionality to convert SVG content into React components.
Features
SVG to React Conversion: Transforms raw SVG strings into valid React components.
Configurable Output: Supports extensive SVGR configuration options including TypeScript generation, React Native support, and Prettier formatting.
Optimization: Optional SVGO integration for optimizing SVG content before conversion.
API Reference
Tools
convert_svg_to_react
Converts an SVG string into a React component.
Input Schema:
Parameter | Type | Description | Default |
|
| Required. The raw SVG content to convert. | - |
|
| Name for the generated React component. |
|
|
| Configuration options for SVGR. |
|
Options Object:
The options parameter supports the following keys:
icon(boolean | string | number): Replace SVG width and height with a custom value.native(boolean): Modify all SVG nodes for React Native.typescript(boolean): Generate TypeScript component.dimensions(boolean): Keep width and height attributes from the root SVG tag.expandProps("start" | "end" | boolean): Forward properties to the SVG tag.prettier(boolean): Format output with Prettier.prettierConfig(object): Specify custom Prettier configuration.svgo(boolean): Use SVGO to optimize SVG code.ref(boolean): Add ref support to the component.memo(boolean): Wrap component withReact.memo.replaceAttrValues(object): Map of attribute values to replace.svgProps(object): Add props to the root SVG tag.titleProp(boolean): Add title prop support.descProp(boolean): Add description prop support.jsxRuntime("classic" | "automatic" | "classic-preact"): Specify the JSX runtime to use.exportType("named" | "default"): Specify export type (named or default).
Return Value:
Returns a text content block containing the generated React component code.
Example Usage:
Prompts
svg_to_react_native
A convenience prompt that converts SVG to a React Native component with recommended settings.
Title: SVG to React Native Component
Description: Convert SVG to React Native component with TypeScript and named export
Arguments:
Parameter | Type | Description |
|
| Required. SVG content or file path to SVG |
Preset Options:
This prompt automatically applies the following options:
native: true- Generates React Native compatible componentstypescript: true- Outputs TypeScript codejsxRuntime: automatic- Uses the automatic JSX runtimeexportType: named- Uses named exports
Usage:
This prompt guides the assistant to use the convert_svg_to_react tool with React Native-specific configurations, making it easier to generate mobile-ready components without manually specifying all options.