MetorialDocs

Set up Piggy in Metorial for Claude, ChatGPT and Cursor

Share Piggy with your team in Claude, ChatGPT and Cursor through Metorial: OAuth or API token sign-in, 21 tools (10 read-only).

To give your team Piggy in Claude, ChatGPT, Cursor and other AI clients, an admin shares the Piggy integration in a Metorial portal, and each person signs in to Piggy with their own account. Agents can manage customer loyalty programs, rewards, gift cards, promotions, and vouchers. The integration has 21 tools, 10 read-only, 10 write and 1 destructive, plus 5 triggers.

What you'll learn

  • How an admin shares Piggy in a portal and how each person connects
  • What Piggy asks for when you connect, and where to find it
  • How to keep the 10 read-only tools and reject the other 11

Before you start

Sign-in methods

MethodTypeWhat a person provides
API TokenAPI tokentoken
OAuth (Client Credentials) (default)OAuthSigns in to Piggy after entering clientId and clientSecret

The portal and metorial setup use OAuth (Client Credentials) unless someone picks another method.

API Token

To connect, a person enters:

  • token: Personal Access Token or Register API key from the Piggy dashboard

OAuth (Client Credentials)

Before the sign-in, setup asks for:

  • clientId: OAuth Client ID
  • clientSecret: OAuth Client Secret

People sign in to Piggy and approve the permissions it lists.

Setup settings

Whichever method you pick, setup also asks for:

  • shopUuid (optional): Default shop UUID to use for operations that require a shop. Can be overridden per-tool.

Use your own Piggy OAuth app

With your own OAuth app, people see your company's name on the Piggy consent screen, and the client ID and secret belong to you.

Start the credentials in Metorial

In the dashboard, select Settings, then Organization Settings. Under Integrations and MCP, select Provider Auth, then Create Auth Credentials. Choose Piggy and copy the Redirect URI.

Register the app with Piggy

Create an OAuth app or client in Piggy and add the redirect URI from Metorial as its redirect or callback URL.

Finish in Metorial

Copy the app's client ID and client secret. Back in Metorial, enter a Name, the Client ID and the Client Secret, review Scopes, and select Create. Then pick these credentials for the Piggy integration.

Admin: share Piggy in a portal

In the dashboard

Open Shared Resources

Open Workforce, choose the portal, and select Shared Resources under Access.

Share a new integration

Select Share a Resource, then New Integration, and choose Piggy. Under Auth Method, keep OAuth (Client Credentials) or pick another. For how members connect, choose Each person connects, so everyone signs in to Piggy as themselves.

Limit the tools

Under Tool Filters, set the write and destructive groups to Reject if agents should only read from Piggy.

Choose who gets it

Add the access groups that should see Piggy. When a person asks for access from the portal, the request appears under Access Requests.

With the CLI

The CLI cannot create the per-user Piggy integration. Once it exists, check which groups have it:

metorial-admin portals access list <portal-id> --type provider_template --search piggy

Employee: connect Piggy

In the portal

Open Piggy in the catalog

Sign in to your portal and open Piggy. The status reads Available.

Authenticate

Under Quick setup, select Authenticate. A Piggy sign-in tab opens. Sign in and approve the permissions listed.

Confirm

The status changes to Configured. If it later reads Needs reconnect, select Reconnect and sign in again.

With the CLI

metorial catalog search piggy
metorial setup <catalog-item-id>

catalog search prints the catalog item ID. metorial setup uses OAuth (Client Credentials). To connect with API Token instead, find its ID with metorial catalog get <catalog-item-id> and add --auth-method <auth-method-id>.

Add it to your AI client

metorial install adds your Piggy connection to a local MCP client such as Claude Code, Cursor or Codex. metorial list prints the integration ID and metorial client list the client identifiers.

metorial list piggy
metorial client list
metorial install <client-identifier> <integration-id>

For a client that takes a server URL, such as ChatGPT, metorial install custom <integration-id> creates an installation token and shows the endpoint details.

Make it read-only

Open the integration's Tool Filters and set the write and destructive groups to Reject. Agents keep the 10 read-only tools, such as list_shops and get_contact, and lose the 10 write tools, such as claim_reward or award_credits, and the destructive tool delete_contact.

Employees see the result on the integration's page in the portal under Tool access. For the full walkthrough, see Tool permissions.

Check it worked

metorial list piggy
metorial tools <integration-id>
metorial call <integration-id> list_shops -d '{}'

metorial tools lists the 21 tools, minus any you rejected. list_shops takes no input. It lists all shops connected to the account.

To see every input a tool takes, run metorial schema <integration-id> <tool-key>.

Tools

Read-only tools (10)

  • list_contacts: List loyalty program contacts with filtering and pagination.
  • list_rewards: List available rewards in the loyalty program.
  • list_loyalty_transactions: List loyalty transactions including credit receptions and reward receptions.
  • get_loyalty_program: Retrieve the loyalty program configuration including program name, max credit amount, custom credit name, and unit settings.
  • list_shops: List all shops connected to the account.
  • list_promotions: List all promotions in the account.
  • get_contact: Retrieve a single contact by UUID or email address.
  • list_giftcard_transactions: Retrieve gift card transaction history with gift card, program, shop, date, sorting, and pagination filters.
  • calculate_credits: Preview the loyalty credits for a unit value without awarding them.
  • list_contact_attributes: Discover contact attribute names and data types before updating contact attributes.

Write tools (10)

  • update_contact: Update a contact's attributes such as name, phone, birthdate, or any custom attributes. Needs contactUuid and attributes.
  • create_contact: Create a new contact in the loyalty system.
  • manage_giftcards: Create, list, get, and find gift cards. Needs action.
  • manage_vouchers: Create, list, find, update, or redeem vouchers. Needs action.
  • manage_prepaid: Manage a contact's prepaid balance. Needs action and contactUuid.
  • manage_contact_identifiers: Create, find, link, or unlink contact identifiers. Needs action.
  • claim_reward: Claim a reward for a contact, deducting the required credits from their balance.
  • trigger_automation: Trigger a contact_updated automation run for a specific contact.
  • award_credits: Award loyalty credits to a contact. Needs contactUuid.
  • reverse_transaction: Reverse a credit reception, prepaid transaction, or gift card transaction by its UUID.

Destructive tools (1)

  • delete_contact: Delete a contact from the loyalty system. Needs contactUuid.

Triggers

Piggy has 5 triggers, which fire on events in Piggy:

  • voucher_events: Triggers when a voucher is created, updated, or redeemed.
  • contact_events: Triggers when a contact is created, updated, or a new contact identifier is created.
  • financial_events: Triggers when a prepaid transaction or gift card transaction is created.
  • engagement_events: Triggers when a form submission is completed, a referral is completed, or a promotion/reward is updated.
  • loyalty_events: Triggers when a new credit reception is created for a contact.

Next steps