File size: 1,341 Bytes
bb16d68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 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