# Leal MCP

> Leal MCP Server handles customer loyalty operations for retail businesses across Latin America. Your AI agent connects directly to Leal, giving you access to member profiles, point balances, transaction history, and segment details. Use it to automate retention campaigns, view store network data, and manage personalized rewards without logging into a dashboard.

## Overview
- **Category:** marketing-automation
- **Price:** Free
- **Tags:** loyalty-program, cashback, customer-segmentation, omnichannel-marketing, retail-tech, customer-retention

## Description

Your AI client connects straight to **Leal**, so you never have to log into some clunky dashboard just to run customer loyalty operations. This server gives your agent direct access to the core systems that keep shoppers coming back, letting you manage rewards and understand member behavior on the fly.

First off, you can verify everything is working right with **`check_leal_status`**, which confirms a live API connection between your agent and the Leal system. From there, you've got deep access to every customer profile in the network. You start by pulling a member’s entire history using **`get_member`** based on their ID; this retrieves everything about them. If you need an overview of who's signed up, use **`list_members`** to get a paginated list of all active loyalty members.

When it comes to points and money, your agent handles the accounting for ya. You can check any member’s current point total instantly with **`get_member_balance`**. To see how those points got there—whether they were earned or redeemed—you use **`get_member_transactions`**, which lists every single transaction tied to that specific account. If you need a full, unfiltered look at what's happening across the whole platform, **`list_transactions`** generates a comprehensive list of all loyalty transactions globally.

Understanding your customer groups is huge for targeted campaigns. You can pull a master roster of existing categories using **`list_segments`**, seeing names like 'High Spenders' or 'New Joiners.' To get the nuts and bolts on one specific group, run **`get_segment`** to pull the detailed definition and membership count for that segment.

For physical store planning, you don’t gotta guess. Run **`list_stores`** to get a complete overview of every location registered in the network, and then use **`get_store`** to retrieve specific operational details about any single enrolled retail spot.

When it comes to getting customers excited, your agent handles both rewards and marketing visibility. You can list every reward option available for shoppers using **`list_rewards`**, which shows the point costs and rules attached to those perks. To track what's working in terms of sales boosts, use **`list_campaigns`** to fetch a full list of active marketing campaigns alongside their key performance metrics.

You can also map out how customers are defined by reviewing the detailed segmentation data using **`get_segment`**, or you can get a complete understanding of all possible groupings available through **`list_segments`**. This whole setup means your agent doesn't just pull reports; it gives you the mechanism to act on that data immediately for retail businesses across Latin America.

## Tools

### check_leal_status
Verifies the live API connection between your AI client and the Leal system.

### get_member
Retrieves a single customer’s complete loyalty profile using their ID.

### get_member_balance
Checks the current point total for any specified member.

### get_member_transactions
Lists every historical transaction associated with a specific member’s account.

### get_segment
Pulls the detailed definition and membership count for a specified customer segment.

### get_store
Retrieves specific operational details about an enrolled retail store location.

### list_campaigns
Lists all running marketing campaigns and their key performance metrics.

### list_members
Retrieves a paginated list of all active loyalty members in the system.

### list_rewards
Lists every reward option available to customers, including point costs and rules.

### list_segments
Retrieves a master list of all pre-defined customer segments (e.g., 'High Spenders', 'New Joiners').

### list_stores
Provides an overview and list of every store location registered in the network.

### list_transactions
Generates a comprehensive, unfiltered list of all loyalty transactions across the entire platform.

## Prompt Examples

**Prompt:** 
```
List all loyalty members.
```

**Response:** 
```
You have 3,450 loyalty members. Gold: 234, Silver: 890, Bronze: 2,326. Most recent: Maria S. (joined today).
```

**Prompt:** 
```
Check points balance for member mbr_1029.
```

**Response:** 
```
Member Maria S.: 4,250 points (Gold tier). Last earning: +500 points from purchase at Store Downtown (yesterday).
```

**Prompt:** 
```
Show all available rewards.
```

**Response:** 
```
5 rewards available: '10% Discount' (1000 pts), 'Free Shipping' (500 pts), ' Cashback' (2000 pts), 'VIP Access' (5000 pts), 'Birthday Gift' (auto).
```

## Capabilities

### Retrieve detailed customer profiles
Fetch a specific member's full loyalty profile, including their tier status and personal details.

### Track point balances and history
Get a member’s current points total and list every transaction that affected that balance.

### Identify and analyze customer groups
List existing customer segments or retrieve details on how specific groups are defined within the system.

### Manage store location data
View operational details for all enrolled physical store locations in the network.

### List and review marketing campaigns
Fetch a list of active marketing campaigns, along with their performance metrics.

## Use Cases

### Identifying Churn Risks
A CRM manager notices that the 'Bronze' tier segment hasn't seen activity in 60 days. They prompt their agent: 'Find all members from `list_segments` who are Bronze and haven't used `get_member_transactions` in two months.' The agent runs the necessary checks, identifies 150 names, and drafts a personalized re-engagement email campaign.

### Auditing Points Logic
A developer needs to verify if points were correctly credited after a large purchase. They ask their agent to use `get_member` for the customer ID, followed by `get_member_transactions`. The agent returns a chronological list showing the initial point calculation and the final credit amount, confirming system integrity.

### Planning Multi-Location Promotions
The marketing team wants to run a promotion across three specific stores. They start by running `list_stores` to confirm location IDs. Then they use these IDs with the agent to verify which store has enough inventory capacity before drafting the final campaign plan using `list_campaigns`.

### Launching New Rewards
The team wants to know what rewards are available and how many points cost them. They first run `list_rewards` to see all options, then they use that data alongside `list_segments` to predict which segment would be most motivated by a 'Free Shipping' reward.

## Benefits

- Stop manually exporting CSVs for member data. Use `list_members` to pull the entire roster instantly, letting your agent count out 'Gold' versus 'Bronze' tier counts in seconds.
- Deep dive into spending habits using `get_member_transactions`. You can ask your agent not just for points, but for a summary of point movements over the last 90 days.
- Target specific groups with precision. Use `list_segments` and then `get_segment` to pull data only on customers who match 'High Value' criteria, avoiding irrelevant noise.
- Keep track of physical retail health using `list_stores`. You can check if a specific store location has been updated or activated without calling the internal admin portal.
- Fast campaign review. Instead of pulling up multiple dashboards, run `list_campaigns` to get metrics and performance summaries on every active marketing effort at once.

## How It Works

The bottom line is: your AI client uses these tools to bypass dashboards and talk directly to Leal’s operational database.

1. Your AI client calls the Leal MCP Server using a specific tool (e.g., `list_members`).
2. The server executes the request against the Leal API, pulling raw data on members, transactions, or segments.
3. Your agent receives structured JSON data. It then interprets that data—for instance, calculating the percentage of 'Gold' tier members who haven't transacted in 90 days—and presents the actionable summary to you.

## Frequently Asked Questions

**How do I check if my API connection is working with check_leal_status?**
Run `check_leal_status` first. It confirms the live link between your agent and Leal. If it returns success, you're clear to run any other tool.

**What is the difference between list_members and get_member?**
`list_members` gives you a paginated roster of all members. `get_member` takes one specific ID and pulls that single person's entire, deep profile.

**Can I check points balance for every member? Using get_member_balance?**
No, you can't query all members at once. You must first use `list_members` to get a list of IDs, and then run `get_member_balance` on each ID individually.

**Where do I find data for store locations? Do I use list_stores or get_store?**
`list_stores` gives you an overview and a full list of all registered stores. `get_store` lets you drill down into the specific operational details for one single store location.

**How do I see what rewards customers can use? Using list_rewards?**
`list_rewards` provides a complete catalog of every available reward option, detailing their required points and redemption rules.

**What's the difference between using `list_transactions` and calling `get_member_transactions`?**
`list_transactions` gives you a high-level summary of all activity across every member. Use `get_member_transactions` when you need the complete, detailed history for one specific user.

**What kind of data points can I get about customer groupings using `get_segment`?**
`get_segment` provides deep details on how a segment was defined and what criteria members must meet. You learn the rules for group membership, not just the list of people.

**When I run `list_campaigns`, how does the server handle very large numbers of campaigns?**
The API supports pagination for massive lists. If the results exceed the default page size, you'll receive a `next_page_token` in the response header to fetch all remaining data chunks.

**Can I check a member's points balance?**
Yes. `get_member_balance` returns the current points balance and tier for any loyalty member.

**Can I view transaction history?**
Yes. `get_member_transactions` shows individual history and `list_transactions` shows all loyalty transactions.

**How do I manage customer segments?**
`list_segments` shows all segments and `get_segment` returns configuration and member count for any segment.