| # MCP Server Usage Guide | |
| ## Connecting to Any2SVG MCP Server | |
| ### Local Development | |
| When running locally, the MCP server is available at: | |
| ``` | |
| http://localhost:7860/gradio_api/mcp/sse | |
| ``` | |
| ### Hugging Face Spaces | |
| When deployed to HF Spaces: | |
| ``` | |
| https://YOUR-USERNAME-any2svg.hf.space/gradio_api/mcp/sse | |
| ``` | |
| ## Client Configuration | |
| ### Claude Desktop / Cursor / Cline | |
| Add to your MCP client config: | |
| ```json | |
| { | |
| "mcpServers": { | |
| "any2svg": { | |
| "url": "http://localhost:7860/gradio_api/mcp/sse" | |
| } | |
| } | |
| } | |
| ``` | |
| ### For SSE-incompatible clients (e.g., Claude Desktop) | |
| Use mcp-remote: | |
| ```json | |
| { | |
| "mcpServers": { | |
| "any2svg": { | |
| "command": "npx", | |
| "args": [ | |
| "mcp-remote", | |
| "http://localhost:7860/gradio_api/mcp/sse" | |
| ] | |
| } | |
| } | |
| } | |
| ``` | |
| ## Available Tools | |
| ### image_to_svg | |
| Convert any raster image to SVG vector graphics. | |
| **Parameters:** | |
| - `image` (required): Image URL or base64 data | |
| - `color_mode` (optional): "color" or "binary" (default: "color") | |
| - `filter_speckle` (optional): 1-100 (default: 4) | |
| - `color_precision` (optional): 1-8 (default: 6) | |
| **Returns:** | |
| - `svg_file_path`: Path to saved SVG file | |
| - `svg_content`: SVG markup string | |
| ## Environment Variables | |
| - `SVG_OUTPUT_DIR`: Directory for saved SVG files (default: `./output`) | |
| - `GRADIO_MCP_SERVER`: Set to `true` to enable MCP mode | |