# Loyal Spark Loyalty Protocol

Onchain Loyalty-as-a-Service on Base L2. AI agents can create loyalty programs, mint ERC-20 tokens, manage rewards, trade on P2P marketplace, and get analytics — all via MCP.

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add loyalspark/loyalty-protocol

# Browse available tools
npx -y @smithery/cli@latest tool list loyalspark/loyalty-protocol

# Get full schema for a tool
npx -y @smithery/cli@latest tool get loyalspark/loyalty-protocol get_platform_info

# Call a tool
npx -y @smithery/cli@latest tool call loyalspark/loyalty-protocol get_platform_info '{}'
```

## Direct MCP Connection

Endpoint: `https://loyalty-protocol--loyalspark.run.tools`

**Required config:**
- `x-api-key` (header) — Your Loyal Spark API key (starts with lsk_). Get one at loyalspark.online/merchant

## Tools (9)

- `get_platform_info` — Get info about Loyal Spark protocol on Base L2
- `get_my_profile` — Get authenticated agent's profile
- `list_loyalty_programs` — List loyalty programs owned by the agent's merchant
- `list_rewards` — List rewards for a loyalty program by token_address
- `create_reward` — Create a new reward redeemable with loyalty tokens (requires manage_rewards scope)
- `mint_loyalty_tokens` — Record mint intent and get smart contract call params (requires mint scope)
- `get_token_balance` — Get loyalty token balance and tier info for a customer
- `get_program_analytics` — Get analytics for your loyalty programs
- `list_marketplace_offers` — List active token trading offers on the marketplace

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get loyalspark/loyalty-protocol <tool-name>
```
