Skip to main content
Glama
README.md
# ๐ŸŽจ vectorizer-ai-mcp

[![Pipeline Status](https://gitlab.com/agentic.ai.forge/vectorizer-ai-mcp/badges/main/pipeline.svg)](https://gitlab.com/agentic.ai.forge/vectorizer-ai-mcp/-/pipelines)
[![Coverage](https://gitlab.com/agentic.ai.forge/vectorizer-ai-mcp/badges/main/coverage.svg)](https://gitlab.com/agentic.ai.forge/vectorizer-ai-mcp/-/commits/main)
[![Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Minimal MCP server for [Vectorizer.AI](https://vectorizer.ai) - AI-powered bitmap to vector conversion.

## โœจ Features

- ๐Ÿ–ผ๏ธ **vectorize_image**: Convert PNG/JPG/WEBP/BMP/GIF to SVG/PDF/EPS/DXF
- ๐Ÿ’พ **save_file**: Save vectorized output to local files
- ๐Ÿ“Š **check_account**: Verify API credentials and credit balance

## ๐Ÿ“ฆ Installation

```bash
# With uv (recommended)
uv pip install .

# With pip
pip install .
```

## โš™๏ธ Configuration

Configuration is managed via environment variables using [pydantic-settings](https://docs.pydantic.dev/latest/concepts/pydantic_settings/).

### Required Variables

| Variable | Description |
|----------|-------------|
| `VECTORIZER_API_ID` | Your Vectorizer.AI API ID |
| `VECTORIZER_API_SECRET` | Your Vectorizer.AI API secret |

๐Ÿ”‘ Get your credentials at [vectorizer.ai/api](https://vectorizer.ai/api).

### Optional Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `VECTORIZER_API_BASE_URL` | `https://api.vectorizer.ai/api/v1` | API base URL |
| `VECTORIZER_TIMEOUT` | `180.0` | Request timeout in seconds (max 600) |

### Using direnv (recommended)

Create a `.envrc` file in the project directory:

```bash
export VECTORIZER_API_ID="your-api-id"
export VECTORIZER_API_SECRET="your-api-secret"
# Optional: increase timeout for large images
export VECTORIZER_TIMEOUT="300"
```

Then run `direnv allow` to load the environment.

## ๐Ÿš€ Running the Server

### Standalone

```bash
# With uv
uv run vectorizer-ai-mcp

# Or if installed
vectorizer-ai-mcp
```

### With Claude Code

Add to `.mcp.json`:

```json
{
  "mcpServers": {
    "vectorizer-ai": {
      "command": "vectorizer-ai-mcp",
      "env": {
        "VECTORIZER_API_ID": "your-api-id",
        "VECTORIZER_API_SECRET": "your-api-secret"
      }
    }
  }
}
```

Or with uv (no global install needed):

```json
{
  "mcpServers": {
    "vectorizer-ai": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/vectorizer-ai-mcp", "vectorizer-ai-mcp"],
      "env": {
        "VECTORIZER_API_ID": "your-api-id",
        "VECTORIZER_API_SECRET": "your-api-secret"
      }
    }
  }
}
```

## ๐Ÿ› ๏ธ Tools

### vectorize_image

Convert bitmap to vector graphics.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `image` | string | โœ… | Local file path, URL, or base64-encoded image |
| `output_format` | string | | svg (default), pdf, eps, dxf, png |
| `mode` | string | | production (1 credit), preview (0.2), test (free) |
| `output_path` | string | | Save output directly to this path |
| `max_colors` | int | | Limit colors (0-256, 0=unlimited) |
| `curves` | string | | all, beziers_only, lines_only, arcs_and_lines |
| `palette` | string | | Color palette mapping (see below) |

**Example:**
```python
vectorize_image(
  image="/path/to/logo.png",
  output_format="svg",
  mode="production",
  output_path="/path/to/logo.svg"
)
```

#### Palette Parameter

The `palette` parameter allows you to map or remove specific colors during vectorization. This is useful for:
- Making backgrounds transparent
- Remapping colors to a specific palette
- Removing unwanted colors from the output

**Format:** `[color][-> remapped][~ tolerance];`

| Syntax | Description |
|--------|-------------|
| `#RRGGBB` | Opaque color |
| `#RRGGBBAA` | Color with alpha (00 = transparent) |
| `-> #color` | Remap to different color |
| `~ 0.02` | Tolerance (0-2.0, default 2.0) |

**Examples:**

```python
# Remove dark background (make transparent)
vectorize_image(
  image="/path/to/logo.png",
  palette="#0d1117 -> #00000000;",
  output_path="/path/to/logo-transparent.svg"
)

# Snap colors to specific palette
vectorize_image(
  image="/path/to/logo.png",
  palette="#FF0000 ~ 0.02; #00FF00 ~ 0.02; #0000FF ~ 0.02; #00000000;",
  output_path="/path/to/logo-limited.svg"
)
```

### check_account

Verify API credentials and check credit balance. No parameters required.

### save_file

Save base64-encoded content to a local file.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `content_base64` | string | โœ… | Base64-encoded file content |
| `path` | string | โœ… | Destination file path |

## ๐Ÿ’ฐ Pricing

| Mode | Credits | Quality |
|------|---------|---------|
| ๐Ÿงช **Test** | Free | Watermarked |
| ๐Ÿ‘๏ธ **Preview** | 0.2 | Watermarked, lower res |
| โœ… **Production** | 1.0 | Full quality |

Credits start at $0.20/credit (50 credits for $9.99/month).

## ๐Ÿง‘โ€๐Ÿ’ป Development

```bash
# Install dev dependencies
uv sync --dev

# Run tests
uv run pytest

# Lint & format
uv run ruff check --fix src/ tests/
uv run ruff format src/ tests/
```

## ๐Ÿ“„ License

MIT