# PatoCard MCP server

PatoCard's MCP server lets an AI agent work with a business's loyalty program:
look up a customer's card and stamps, list programs and rewards, and read the
statistics. It is a remote server (Streamable HTTP):

```
https://patocard.com/api/mcp
```

Every connection belongs to ONE business: the agent only ever sees that
business's data. The MCP is included in **every plan** (Startup and up).

## Before connecting: the owner may not need it

If the owner just wants a stamp card, give them a prefilled link instead (no
connection needed): `https://patocard.com/herramientas/tarjeta-de-sellos-gratis?negocio=…&giro=…&premio=…&meta=…&emoji=…`.
See https://patocard.com/llms.txt.

## Connect

**claude.ai / Claude desktop (OAuth):** PatoCard is in Claude's connectors
directory: Settings → Connectors → Browse → search "PatoCard" → Connect.
(Or Add custom connector → paste `https://patocard.com/api/mcp`.) Claude opens PatoCard's
sign-in; the business owner approves the connection. No key to copy.

**Claude Code (API key):** the owner creates a key in the PatoCard panel
(Ajustes → Integraciones) and runs:

```
claude mcp add --transport http patocard https://patocard.com/api/mcp --header "Authorization: Bearer pc_live_TU_LLAVE"
```

**Clients that take JSON (Cursor, etc.):**

```json
{
  "mcpServers": {
    "patocard": {
      "url": "https://patocard.com/api/mcp",
      "headers": {
        "Authorization": "Bearer pc_live_TU_LLAVE"
      }
    }
  }
}
```

**Clients that only speak stdio:**

```json
{
  "mcpServers": {
    "patocard": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://patocard.com/api/mcp",
        "--header",
        "Authorization: Bearer pc_live_TU_LLAVE"
      ]
    }
  }
}
```

OAuth metadata: `https://patocard.com/.well-known/oauth-protected-resource` and
`https://patocard.com/.well-known/oauth-authorization-server`.

**Permissions.** OAuth scopes `lectura` (read) and `operacion` (operate). On
the consent screen the owner chooses whether the agent can only read or can
also operate (create customers, give stamps, redeem rewards, design cards,
prepare campaigns that the owner approves in the panel). With an API key, a
read key reads and a read-write key operates. Nothing an agent does deletes
data; every action is logged as done by an AI agent.


## Tools

| Tool | What it does | Arguments |
|---|---|---|
| `mi_negocio` | Which business the key belongs to, its scope, and the programs with goals and rewards. The first one an agent calls. | — |
| `onboarding` | The 7 steps to get the business's card ready: which are done, which comes next and what the owner does in person, with the link to their dashboard. | — |
| `programas` | The loyalty programs: mechanic, stamp goal, reward and sign-up link. | — |
| `buscar_cliente` | Customers by phone or email, with their cards and balances. No search by name. | telefono or email |
| `cliente` | A customer by id, with their cards. | id |
| `tarjeta` | A card by id: balance, pending rewards, whether it's in Wallet, and latest visits. | id |
| `estadisticas` | The numbers for 7, 30 or 90 days: active customers, stamps, rewards, by program, and who comes most. | dias: 7 | 30 | 90 |
| `vista_tarjeta` | An image of how the card looks; accepts a trial design without saving it, and the empty, halfway and full states. | programaId, sellos?, estados?, …design |
| `listar_imagenes` | The images the business already has (logos, backgrounds, stamps), with their id to reuse them. | tipo? |
| `guia_diseno` | Recommended sizes and ratios for each image, the iOS 27 poster zones, and tips. | — |
| `liga_subida` | A single-use link (30 min) for the owner to upload a photo from their phone. Requires permission to operate. | tipo |
| `ver_subida` | If the owner already uploaded the photo, the image's id. | subidaId |
| `subir_imagen` | Saves a base64 image (up to ~3 MB, it's shrunk automatically). Requires permission to operate. | tipo, base64, nombre? |
| `historial_diseno` | Previous versions of a program's name, reward and design. | programaId |
| `revertir_diseno` | Takes a program back to an earlier version (and it can be undone). Requires permission to operate. | programaId, versionId |
| `liga_alta` | A program's sign-up link, with its QR as an image. | programaId |
| `crear_programa` | Creates a stamp card with its design: classic or iOS 27 poster, colors, the stamp's emoji and shape, background and logo from a URL, vocabulary and back-of-card texts. Requires permission to operate. | nombre, meta, premio, maxSellosDia?, estilo?, colores?, emoji?, fondoUrl?, logoUrl?, … |
| `editar_programa` | Changes a card's name, reward or design (whatever you send). The goal and daily cap stay in the panel. Requires permission to operate. | programaId, … |
| `alta_cliente` | Signs up a customer and returns their card's link. Requires permission to operate. | programaId, nombre, telefono, email?, notificar? |
| `dar_sello` | Records a visit, with the business's caps. Requires permission to operate. | tarjetaId |
| `canjear_premio` | Marks a reward as handed over. Requires permission to operate. | premioId |
| `pedir_campana` | Prepares a message to a segment of customers; it stays pending until the owner approves it in the panel. | programaId, segmento, umbral?, titulo, cuerpo |
| `crear_negocio` | No account: builds a DRAFT business with its card and returns the image, a token to adjust it, and the link for the owner to claim it (expires in 72 h). | negocio, giro, ciudad?, premio, meta?, …design |
| `editar_borrador` | No account: changes the draft (name, card and design). | borrador, … |
| `vista_borrador` | No account: image of the draft; tries changes without saving them. | borrador, estados?, …design |
| `estado_borrador` | No account: whether it was claimed and how long until it expires; can reissue the link. | borrador, reponerLiga? |
| `liga_subida_borrador` | No account: a link for the owner to upload a photo to the draft. | borrador, tipo |
| `ver_subida_borrador` | No account: the id of the photo the owner uploaded. | borrador, subidaId |

Start with `mi_negocio`: it says which business the connection belongs to
and its programs, goals and rewards.

## Things to ask it

- "¿Cuántos sellos le faltan a Ana (55 1234 5678) para su premio?"
- "How many active customers did we have in the last 30 days, by program?"
- "Who are my 10 most frequent customers this month?"
- "¿Qué premio da la tarjeta de Hot Bar y cuántos sellos pide?"

## Card design guide (guía de diseño)

Recommended style: **poster** (iOS 27). El póster de iOS 27 llena toda la tarjeta con la foto y es lo que más se luce. El pase lleva los dos estilos: los iPhone que todavía no tienen iOS 27 y Google Wallet usan la versión clásica automáticamente. Úsalo siempre salvo que el dueño pida la clásica.

| Image | Size | Ratio |
|---|---|---|
| Fondo del póster de iOS 27 (fondoUrl / fondoImagenId con estilo «poster») | 1035×1515 px | 1:1.46 (vertical, casi 2:3) |
| La franja de la tarjeta clásica (iPhone sin iOS 27) y la imagen principal de Google Wallet | Apple: 1125×432 px (2.6:1); Google: 1032×812 px (1.27:1) | — |
| Logo del negocio (logoUrl / logoImagenId) | 480×150 px o más | 3.2:1 (horizontal) |
| Imagen del sello (selloImagenId / selloVacioImagenId) | 512×512 px | 1:1 (cuadrado) |
| Ícono de la notificación (se sube en el panel) | 114×114 px o más | 1:1 (cuadrado) |

**Póster — zonas:** De arriba abajo: hasta el 12 %, el logo y el saldo (iOS pone una sombra suave). Del 12 % al 43 %, la cuadrícula de sellos ENCIMA de la foto. Del 43 % al 59 %, la foto se ve limpia: es el mejor lugar para el sujeto. Del 59 % al 77 %, la foto se desvanece al colorFondo. Desde el 77 %, color sólido (colorFondo) con el nombre y los campos.

- Foto vertical; una horizontal se recorta a los lados.
- Pon al sujeto entre el 43 % y el 59 % de la altura, o usa una foto de ambiente o textura (agua, cielo, madera, desenfoque) que aguante los sellos encima.
- Si la foto es clara o con mucho detalle, usa fondoVelo entre 30 y 50 para que los sellos se lean.
- Elige colorFondo del tono de la parte de abajo de la foto: es el color al que se desvanece y el de la banda inferior.
- colorTexto con buen contraste contra colorFondo (el texto principal va en la banda de abajo).
- Sobre una foto, los sellos por ganar se leen mejor con pendiente «solido» o «contorno».

**Clásica y Google:** Salen de la MISMA foto del póster, recortada al centro: no hace falta otra. Por eso conviene que la foto aguante un recorte horizontal en su franja central.

**Logo:**
- PNG con fondo transparente.
- En el póster el logo de Apple cabe en 126×30 pt: si se ve chico, usa logoGrande para dibujarlo grande dentro de la foto.
- Un logo cuadrado o vertical se ve chico en la caja horizontal; si el negocio tiene una versión horizontal (logo + nombre), usa esa.
- Que contraste con el fondo: logo claro sobre foto oscura y al revés.

**Sello:**
- PNG con fondo transparente y una figura simple: se dibuja chico, varias veces.
- Sin sello vacío propio, se usa el ganado en gris.
- Si no hay imagen, un emoji del catálogo (emoji) se ve bien y no requiere nada.

JPG, PNG o WebP. Hasta 12 MB desde una URL o una liga de subida; se reducen solas al tamaño de la tarjeta y debajo de 1 MB.

## No account yet?

A business without an account starts a free 14-day trial (no card) at
https://patocard.com/empezar — a human must accept the terms. Then the owner connects
the agent as above.

More: [REST API](https://patocard.com/docs/api.md) · [llms.txt](https://patocard.com/llms.txt) · hola@patocard.com
