# Image

Agent image resize: load a public/staging URL or small base64 image, resize with contain/cover/exact or max_edge/scale, encode jpeg/png/webp, return a staging URL (optional base64).

**Service id:** `img`  
**Version:** `0.1.0`  
**Status:** `available`

## Authentication

MCP endpoint: `https://mcp.glc-rag.hu/mcp` (streamable HTTP)

**Agents (recommended):** self-register with `account_type=agent` to get an
auto-approved token — see [https://mcp.glc-rag.hu/guide/agent](https://mcp.glc-rag.hu/guide/agent).

Or register as a human on the public site (all listed services are auto-approved),
wait for system-admin approval, then create a token.

```http
Authorization: Bearer mcp_...
```

Cursor `mcp.json` example:

```json
{
  "mcpServers": {
    "img": {
      "url": "https://mcp.glc-rag.hu/mcp",
      "headers": {
        "Authorization": "Bearer mcp_YOUR_TOKEN"
      }
    }
  }
}
```

## Tools

### `img_info`

Read image width/height/format/mode from url or small base64 (no resize).

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "Public http(s) or staging image URL"
    },
    "content_base64": {
      "type": "string",
      "description": "Small image as base64 or data: URL"
    }
  },
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "url": "https://mcp.glc-rag.hu/staging/EXAMPLE"
}
```

### `img_resize`

Resize/convert an image and publish the result to staging. Provide url or content_base64, plus width/height/max_edge/scale.

**Input schema:**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "content_base64": {
      "type": "string"
    },
    "width": {
      "type": "integer",
      "minimum": 1,
      "maximum": 8192
    },
    "height": {
      "type": "integer",
      "minimum": 1,
      "maximum": 8192
    },
    "max_edge": {
      "type": "integer",
      "minimum": 1,
      "maximum": 8192,
      "description": "Cap longest edge (aspect preserved)"
    },
    "scale": {
      "type": "number",
      "minimum": 0.01,
      "maximum": 8,
      "description": "Multiply dimensions (e.g. 0.5)"
    },
    "fit": {
      "type": "string",
      "enum": [
        "contain",
        "cover",
        "exact"
      ],
      "default": "contain"
    },
    "format": {
      "type": "string",
      "enum": [
        "jpeg",
        "png",
        "webp",
        "keep"
      ],
      "default": "keep"
    },
    "quality": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 85
    },
    "background": {
      "type": "string",
      "default": "#ffffff",
      "description": "Fill when flattening alpha to jpeg/webp"
    },
    "strip_metadata": {
      "type": "boolean",
      "default": true
    },
    "return_base64": {
      "type": "boolean",
      "default": false,
      "description": "Also include image_base64 (avoid for large outputs)"
    }
  },
  "additionalProperties": false
}
```

**Examples:**

```json
{
  "url": "https://example.com/photo.jpg",
  "max_edge": 1024,
  "format": "jpeg"
}
```

```json
{
  "url": "https://example.com/a.png",
  "width": 400,
  "height": 400,
  "fit": "cover"
}
```

```json
{
  "url": "https://example.com/a.png",
  "scale": 0.5,
  "format": "webp"
}
```

### `img_status`

Image service health and limits.

**Input schema:**

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

**Examples:**

```json
{}
```

## Usage notes

Large images: POST /staging/upload → url, then img_resize({ url, max_edge }). Modes: max_edge (longest side), scale, width and/or height with fit=contain|cover|exact. EXIF orientation is applied. Defaults: fit=contain, format=keep, quality=85, strip_metadata=true. img_info is free; img_resize charges credits (base + output MiB).

## Errors / limits

SSRF-blocked URL, oversize input, invalid image, missing size target, or staging full → `{error, is_error}`. Insufficient credits → platform debit error.

## Agent discovery

- Agent registration: `https://mcp.glc-rag.hu/guide/agent`
- Markdown: `https://mcp.glc-rag.hu/guide/img.md`
- Index: `https://mcp.glc-rag.hu/llms.txt`
- MCP resource: `docs://img`
