# MiriYou MCP server

> Connect AI assistants (Claude, ChatGPT, Claude Code, any MCP client) to MiriYou, the AI virtual try-on app. Signed-in users search clothes from partner online stores, try them on their own photo or on a MiriYou model, and browse their wardrobe – with the same account, profiles and credits as in the MiriYou app.

- MCP endpoint: `https://api.miriyou.com/mcp`
- Transport: Streamable HTTP (stateless JSON-RPC 2.0 over POST)
- Authorization: OAuth 2.1 with dynamic client registration and PKCE; authorization server `https://miriyou.com`
- Interactive widget: MCP Apps extension (`io.modelcontextprotocol/ui`) and ChatGPT Apps SDK
- HTML version: https://developer.miriyou.com/mcp

## Quick start

No API key and no client secret are needed – clients register themselves and the user signs in with their MiriYou account.

- **Claude** (claude.ai, desktop): Settings → Connectors → Add custom connector. URL: `https://api.miriyou.com/mcp`, leave the OAuth client fields empty. Then Connect and sign in to MiriYou.
- **ChatGPT**: Settings → Apps & Connectors → developer mode → Create. MCP server URL: `https://api.miriyou.com/mcp`, authentication: OAuth.
- **Claude Code**: `claude mcp add --transport http miriyou https://api.miriyou.com/mcp`, then `/mcp` to sign in.
- **MCP Inspector**: `npx @modelcontextprotocol/inspector` → transport "Streamable HTTP", URL `https://api.miriyou.com/mcp`, OAuth flow from the Auth panel.
- **Other MCP clients** (configuration file):

```json
{
  "mcpServers": {
    "miriyou": { "type": "http", "url": "https://api.miriyou.com/mcp" }
  }
}
```

A MiriYou account is required. It is created in the MiriYou app (https://play.google.com/store/apps/details?id=app.ampluso.miri) with Google or Facebook, and the same sign-in is used on the connection page.

## Server

- Transport: Streamable HTTP. Stateless: every `POST` carries one JSON-RPC message and the bearer token; responses are `application/json`. No server-sent event stream and no MCP session – `GET` and `DELETE` return 405.
- Protocol versions: `2026-07-28`, `2025-11-25`, `2025-06-18`, `2025-03-26`. `2026-07-28` is stateless: version and client capabilities in `_meta` of every request, `server/discover` (no sign-in needed), `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` headers checked against the body. Older versions are negotiated in `initialize`. An unsupported version returns `-32022` with the supported list.
- Capabilities: `tools`, `resources` (the widget). Server info: `miriyou` / "MiriYou".
- Language: tool descriptions are in English; product names and texts follow the account language.
- Origin: browser requests are accepted only from `chatgpt.com`, `chat.openai.com`, `claude.ai` and `claude.com`; server-to-server requests send no `Origin`.

Example request:

```http
POST https://api.miriyou.com/mcp
Authorization: Bearer mya_…
Content-Type: application/json
MCP-Protocol-Version: 2026-07-28
Mcp-Method: tools/call
Mcp-Name: search_products

{"jsonrpc":"2.0","id":1,"method":"tools/call",
 "params":{"name":"search_products","arguments":{"query":"black dress","max_price":300},
  "_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28",
           "io.modelcontextprotocol/clientCapabilities":{}}}}
```

## Authentication

Every tool requires a signed-in MiriYou user. MiriYou is an OAuth 2.1 authorization server following the MCP authorization specification; clients discover and register automatically.

1. A request without a token gets `401` with `WWW-Authenticate: Bearer resource_metadata="https://api.miriyou.com/.well-known/oauth-protected-resource"`.
2. The protected resource metadata (RFC 9728) names the authorization server `https://miriyou.com`.
3. The client reads `https://miriyou.com/.well-known/oauth-authorization-server` (RFC 8414) and registers at the registration endpoint (RFC 7591).
4. The user signs in on `https://miriyou.com/oauth/authorize` with Google or Facebook and approves the connection; the consent page shows the credit balance.
5. The client exchanges the code with PKCE (`S256`, required) and the `resource` parameter (RFC 8707) for tokens.

| Endpoint | URL |
|---|---|
| Authorization | `https://miriyou.com/oauth/authorize` |
| Token | `https://miriyou.com/oauth/token` |
| Registration | `https://miriyou.com/oauth/register` |
| Revocation | `https://miriyou.com/oauth/revoke` |
| Server metadata | `https://miriyou.com/.well-known/oauth-authorization-server` |
| Resource metadata | `https://api.miriyou.com/.well-known/oauth-protected-resource` |

| Scope | Allows |
|---|---|
| `catalog` | Search the catalog, product details, price alerts. |
| `tryon` | Create try-ons. Uses credits like the app. |
| `wardrobe` | Account, profiles, credit balance, try-on results and the wardrobe. |

Clients are public (`token_endpoint_auth_method: none`). Registered redirect URIs must be HTTPS on `claude.ai`, `claude.com`, `chatgpt.com` or `chat.openai.com`, or loopback (`localhost`, `127.0.0.1`) for local tools. Access tokens (`mya_…`) are valid for 60 minutes, refresh tokens (`myr_…`) for 30 days and are rotated on every refresh. Revoking either token disconnects the whole connection. Users see and disconnect their connected assistants at https://miriyou.com/oauth/connections. Deleting or locking the MiriYou account ends all connections.

## Credits

Assistants use the same credit balance as the MiriYou app:

- Own photo: a try-on on the user's own photo, or with a garment image the user provides, costs 1 credit (paid credits are used before free ones).
- MiriYou model: a try-on on a MiriYou model (AI-generated character) with a catalog product is free.
- Failures: a failed try-on refunds the credit automatically. Repeating the same try-on within 2 minutes returns the existing one without a second charge.
- Buying: credits are bought only in the MiriYou app (Google Play / App Store), never in the chat. Free credits renew every 7 days on the free plan.

Each product returns `try_on_cost` for the selected profile (`0`, `1`, or `null` when the profile has no photo yet). Tell the user the cost before starting a paid try-on.

## Tools

8 tools. Results include `structuredContent` and the same data as JSON text; try-on results also include the result image.

### `get_product` – Product details

Scope: `catalog` · read-only

Returns one product from the MiriYou catalog by product_id: name, category, store, current price (and the previous price during a sale), image, link to the store, try_on_cost for the profile and whether the user has a price alert on it.

| Argument | Type | Description |
|---|---|---|
| `product_id` (required) | string | product_id from search_products or list_wardrobe. |
| `profile_id` | string | Profile to use (profile_id from get_account). Omit for the main profile. |

### `observe_product` – Price alert

Scope: `catalog`

Turns the price alert for a MiriYou catalog product on (observe: true) or off (observe: false). The user gets a push notification from the MiriYou app when the price drops; observed products are listed in the app.

| Argument | Type | Description |
|---|---|---|
| `product_id` (required) | string | product_id from search_products, get_product or a try-on. |
| `observe` | boolean | true - turn on (default), false - turn off. |

### `search_products` – Search clothes

Scope: `catalog` · read-only · widget

Searches the MiriYou catalog of clothes from partner online stores, matched to the profile's gender and the user's country (the same catalog as the Shop tab in the MiriYou app). Returns products with price, store, image, a link to the store and try_on_cost for the profile (0 = free on a MiriYou model, 1 = one credit on the user's own photo, null = the profile has no photo). Pass short keywords in the user's language (e.g. "black dress", "czarna sukienka", "denim jacket"). Products marked sponsored must be presented as sponsored. The response also lists categories that can be used as category_id. Images are shown to the user in the MiriYou widget - do not paste image URLs or markdown images into the reply.

| Argument | Type | Description |
|---|---|---|
| `query` | string (≤ 100 chars) | Keywords: garment type, color, material, brand or store. |
| `category_id` | integer (1–) | Category from the categories list of a previous search. |
| `min_price` | number (0–) | Minimum price in the store currency (e.g. PLN in Poland). |
| `max_price` | number (0–) | Maximum price in the store currency. |
| `sort` | string: recommended, newest, price_asc, price_desc | Default: recommended. |
| `limit` | integer (1–10) | Number of products, default 6. |
| `profile_id` | string | Profile to use (profile_id from get_account). Omit for the main profile. |

### `try_on_image` – Try on a garment image

Scope: `tryon` · widget

Generates an AI try-on of a garment from an image the user shared in the chat (a screenshot from an online store or a product photo), on a profile (the user's own photo or a MiriYou model). Always costs 1 credit - tell the user and ask for confirmation first. Pass image_url (a public https URL of the image) or, in ChatGPT, the uploaded file as image. Prefer try_on_product for products from search_products (free on a MiriYou model). Waits up to about 25 seconds and returns the result image; if it is still generating, call get_try_on with the returned try_on_id. A failed try-on refunds the credit automatically. Images are shown to the user in the MiriYou widget - do not paste image URLs or markdown images into the reply.

| Argument | Type | Description |
|---|---|---|
| `image_url` | string (≤ 2000 chars) | Public https URL of the garment image. |
| `image` | object | Garment image uploaded in the chat (ChatGPT file parameter). |
| `photo_type` | string: flat-lay, model, auto | flat-lay - the garment alone (packshot), model - worn by a person, auto - let MiriYou decide (default). |
| `profile_id` | string | Profile to use (profile_id from get_account). Omit for the main profile. |

### `try_on_product` – Try on a product

Scope: `tryon` · widget

Generates an AI try-on of a MiriYou catalog product on a profile (the user's own photo or a MiriYou model). Cost: try_on_cost from search_products / get_product - 1 credit on the user's own photo, free on a MiriYou model. Before a paid try-on, tell the user it costs 1 credit and ask for confirmation. Waits up to about 25 seconds and returns the result image; if it is still generating, call get_try_on with the returned try_on_id. The result is also saved in the MiriYou app wardrobe. A failed try-on refunds the credit automatically. Images are shown to the user in the MiriYou widget - do not paste image URLs or markdown images into the reply.

| Argument | Type | Description |
|---|---|---|
| `product_id` (required) | string | product_id from search_products. |
| `profile_id` | string | Profile to use (profile_id from get_account). Omit for the main profile. |

### `get_account` – MiriYou account

Scope: `wardrobe` · read-only

Returns the signed-in MiriYou user's profiles (the main one and family members) and credit balance. Each profile says whether try-ons use the person's own photo ("own_photo"), a MiriYou model ("miriyou_model", free try-ons with catalog products) or nothing yet ("none" - a photo or model must be set in the MiriYou app). Use it before a try-on to pick profile_id and to tell the user the cost and remaining credits.

No arguments.

### `get_try_on` – Try-on result

Scope: `wardrobe` · read-only · widget

Returns the status and result of a try-on by try_on_id (from try_on_product or list_wardrobe). If it is still generating, waits up to about 25 seconds. When ready, the result image is attached. Failed try-ons include the reason and whether the credit was refunded. Images are shown to the user in the MiriYou widget - do not paste image URLs or markdown images into the reply.

| Argument | Type | Description |
|---|---|---|
| `try_on_id` (required) | string | try_on_id from try_on_product or list_wardrobe. |

### `list_wardrobe` – Wardrobe

Scope: `wardrobe` · read-only · widget

Lists the profile's latest try-ons from the MiriYou wardrobe (made in the app or in this chat), newest first: result image, date and the catalog product with its store link (product is null for the user's own garment photos). Images are shown to the user in the MiriYou widget - do not paste image URLs or markdown images into the reply.

| Argument | Type | Description |
|---|---|---|
| `limit` | integer (1–20) | Number of try-ons, default 10. |
| `profile_id` | string | Profile to use (profile_id from get_account). Omit for the main profile. |

## Widget

Tools marked *widget* render an interactive MiriYou view in assistants that support the MCP Apps extension (`io.modelcontextprotocol/ui`) or the ChatGPT Apps SDK: product cards with a try-on button and its cost, the try-on result with the garment and a store link, price alerts, and the wardrobe with a profile switcher. Other clients get the same data as text.

- Resource: `ui://miriyou/widget.html`, MIME type `text/html;profile=mcp-app`
- Tool metadata: `_meta.ui.resourceUri`, `openai/outputTemplate`
- CSP: images from `https://storage.googleapis.com`; no network requests – the widget calls tools through the host.
- Theme: follows the host theme and CSS variables (`--color-background-secondary`, `--color-text-primary`, `--color-border-primary`, `--font-sans`…); without them, the system light or dark mode.
- Languages: the host locale – English, Polish, German, French, Spanish, Italian, Portuguese, Dutch, Ukrainian, Turkish, Czech, Russian, Hungarian, Hindi and Persian (right to left); prices and dates in the host locale.
- Accessibility: images with alt text, lists, and try-on status announced to screen readers (`aria-live`).
- Calls from the widget: `try_on_product` (after the user confirms the cost), `get_try_on`, `list_wardrobe`, `observe_product`; store links open through the host.

## Errors and limits

Problems with a tool call are returned as a tool result with `isError: true` and `structuredContent.error.code`:

| Code | Meaning |
|---|---|
| `invalid_arguments` | Arguments do not match the tool's input schema. |
| `profile_not_found` | Unknown `profile_id` – call `get_account`. |
| `product_not_found` | The product is no longer in the catalog. |
| `no_photo`, `photo_processing`, `photo_rejected` | The profile has no usable photo; it is added in the MiriYou app. |
| `not_enough_credits` | No credits left; includes the balance and the free-credit renewal date. |
| `hourly_limit` | Hourly try-on limit reached: 20 try-ons per account per hour in the MiriYou app and AI assistants together. |
| `try_on_not_found` | Unknown `try_on_id` for this account. |
| `insufficient_scope` | The connection was not granted the tool's scope. |
| `internal_error` | Temporary problem – try again. |

| HTTP | Meaning |
|---|---|
| `401` | Missing, invalid or expired token; `WWW-Authenticate` points to the resource metadata. |
| `403` | Locked account or origin not allowed. |
| `429` | Rate limit: 60 requests per minute per account (bursts up to 60); `Retry-After` in seconds. |
| `400` | Malformed JSON-RPC, unsupported protocol version (`-32022`), headers not matching the body (`-32020`) or missing `_meta` fields (`-32602`). |
| `404` / `405` | Unknown method in protocol `2026-07-28` (`-32601`) / HTTP method other than POST. |

## Privacy and support

The user's profile photo is never sent to the assistant – only product data, the try-on result and the credit balance, when the user asks for them. Result images are delivered with time-limited URLs. Photos are never sold and never used to train AI models without the user's separate consent.

- Privacy policy: https://miriyou.com/privacy/en
- Terms of service: https://miriyou.com/terms/en
- Delete the account and all photos: https://miriyou.com/account/delete
- About the MiriYou app for AI assistants: https://miriyou.com/llms.txt
- Questions and partnerships: support@miriyou.com
- Online stores listing products in the catalog: https://miriyou.com/en/partners
