---
name: "27c-mcp-publisher"
description: "Publishes/updates/deletes products on 27c.site via remote HTTP MCP (JSON-RPC 2.0). Invoke when the user asks to publish products through MCP or needs tools/list/tools/call payloads."
---

# 27c.site MCP Publisher (Remote, HTTP)

This document teaches an agent how to use **27c.site remote MCP** (HTTP JSON-RPC 2.0) to publish and manage products/resources.

## Setup flow (what the user must send to the agent)

After the agent is provided with this skill document, the user must also send the MCP server config JSON to the agent so the agent can discover and call the tools.

Send this exact JSON shape (replace the URL):

```json
{
  "mcpServers": {
    "27c.site": {
      "url": "https://27c.site/api/mcp/<MCP_KEY>"
    }
  }
}
```

If a client does not support `mcpServers` config, the agent can still call the MCP endpoint directly over HTTP using the JSON-RPC payloads shown below.

## What you need from the user

- A working MCP endpoint URL:
  - `https://27c.site/api/mcp/<MCP_KEY>`
  - The `<MCP_KEY>` looks like `mcp_xxx...`
- All requests are **HTTP POST** to that URL with:
  - `Content-Type: application/json`

## MCP Client Config (when your client uses `mcpServers`)

Many MCP clients accept a JSON config with a top-level `mcpServers` object. If your client supports this schema, configure it like this:

```json
{
  "mcpServers": {
    "27c.site": {
      "url": "https://27c.site/api/mcp/<MCP_KEY>"
    }
  }
}
```

## 1) List available tools

Request body:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}
```

## 2) Upload an image

27c.site MCP offers three ways to upload images, depending on your use case:

### Option 1: Direct file upload (RECOMMENDED for local/internal images)

This is the easiest and most efficient method, identical to how the admin dashboard uploads images. Use a `multipart/form-data` POST request to:

```
https://27c.site/api/mcp/upload/{YOUR_MCP_KEY}
```

**Example with curl:**
```bash
curl -X POST https://27c.site/api/mcp/upload/mcp_yourkeyhere \
  -F "file=@/path/to/your/image.jpg"
```

**Example with JavaScript fetch:**
```javascript
const formData = new FormData();
formData.append('file', imageFile);

const response = await fetch('https://27c.site/api/mcp/upload/mcp_yourkeyhere', {
  method: 'POST',
  body: formData
});
const result = await response.json();
```

### Option 2: Upload from URL (for public images)

If you have a public image URL, use the `upload_product_image_from_url` tool:

Request body:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "upload_product_image_from_url",
    "arguments": {
      "source_url": "https://example.com/image.jpg"
    }
  }
}
```

### Option 3: Upload base64 encoded image data

If you can't use `multipart/form-data`, use `upload_product_image` with base64-encoded image data:

Request body:

```json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "upload_product_image",
    "arguments": {
      "image_data": "base64_encoded_image_data_here",
      "content_type": "image/jpeg"
    }
  }
}
```

The `image_data` can be raw base64 data or a data URL like `data:image/jpeg;base64,...`.

All upload methods return a JSON object like:

```json
{
  "url": "/api/images/<filename>",
  "filename": "<filename>"
}
```

Use that `/api/images/...` as `image_url` when publishing.

## 3) Publish a product/resource (`publish_product`)

### Field rules

- Required:
  - `name`
  - `image_url` (must be non-empty)
- Required drive/share link (use one of the following; prefer `drive_link`):
  - `drive_link` (preferred)
  - `link` (alias)
  - `quark_link` (legacy alias)
- Optional:
  - `thumb_url` (nullable)
  - `category` (defaults to `all`)
  - `is_active` (defaults to `true`)
  - `price` (defaults to `0`)

Request body example:

```json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "publish_product",
    "arguments": {
      "name": "Example Resource",
      "category": "all",
      "drive_link": "https://example.com/share",
      "image_url": "/api/images/example.jpg",
      "thumb_url": null,
      "is_active": true,
      "price": 0
    }
  }
}
```

## 4) Update a product/resource (`update_product`)

### Rules

- Required:
  - `id`
- If you provide `image_url`, it **cannot** be an empty string.
- If you provide a link field (`drive_link` / `link` / `quark_link`), it **cannot** be empty.

Request body example:

```json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "update_product",
    "arguments": {
      "id": 123,
      "name": "Updated Title",
      "drive_link": "https://example.com/new-share",
      "image_url": "/api/images/new.jpg",
      "thumb_url": null,
      "is_active": true
    }
  }
}
```

## 5) Delete a product/resource (`delete_product`)

```json
{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
    "name": "delete_product",
    "arguments": { "id": 123 }
  }
}
```

## 6) Useful helper tools

- `list_products`
  - Use `mine=true` to list the current key owner's products (including inactive).
  - Use `mine=false` (default) to list public active products only.
- `list_categories`: lists public categories (from active products).
- `health`: validates the MCP key.
