AI Integration with Model Context Protocol (MCP)
The Loyalteez MCP Server enables AI assistants like Claude, ChatGPT, and Cursor to directly integrate, manage, and build complete Loyalteez loyalty programsβincluding gamification features like streaks, leaderboards, achievements, and perksβthrough natural conversation.
What is MCP?β
Model Context Protocol (MCP) is an open standard that allows AI assistants to:
- Invoke Tools: Execute actions (API calls, file operations)
- Access Resources: Read structured data (configs, schemas)
- Maintain Context: Understand domain-specific information
Why Use MCP for Loyalteez?β
Instead of manually reading documentation and writing integration code, you can simply describe what you want:
Traditional Integration Flow:
Developer β Reads Docs β Writes Code β Tests β Debugs β Ships
AI-Native Integration Flow:
Developer β Describes Intent β AI Invokes MCP β Validates β Ships
Installationβ
Prerequisitesβ
- Node.js 18+ installed
- Claude Desktop, Cursor, or another MCP-compatible AI assistant
Install the MCP Serverβ
Option 1: Install from npm (Recommended)
npm install -g @loyalteez/mcp-server
Or install locally:
npm install @loyalteez/mcp-server
Option 2: Install from GitHub
git clone https://github.com/Alpha4-Labs/loyalteez-mcp.git
cd loyalteez-mcp
npm install
npm run build
Configurationβ
Claude Desktopβ
Add to your Claude Desktop MCP configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):
If installed via npm:
{
"mcpServers": {
"loyalteez": {
"command": "npx",
"args": ["@loyalteez/mcp-server"],
"env": {
"LOYALTEEZ_NETWORK": "mainnet",
"LOYALTEEZ_BRAND_ID": "0x47511fc1c6664c9598974cb112965f8b198e0c725e"
}
}
}
}
If installed from GitHub:
{
"mcpServers": {
"loyalteez": {
"command": "node",
"args": ["/path/to/loyalteez-mcp/dist/index.js"],
"env": {
"LOYALTEEZ_NETWORK": "mainnet",
"LOYALTEEZ_BRAND_ID": "0x47511fc1c6664c9598974cb112965f8b198e0c725e"
}
}
}
}
Cursorβ
Add to .cursor/mcp.json:
If installed via npm:
{
"servers": {
"loyalteez": {
"command": "npx",
"args": ["@loyalteez/mcp-server"],
"env": {
"LOYALTEEZ_NETWORK": "mainnet",
"LOYALTEEZ_BRAND_ID": "your-brand-id-here"
}
}
}
}
If installed from GitHub:
{
"servers": {
"loyalteez": {
"command": "node",
"args": ["/path/to/loyalteez-mcp/dist/index.js"],
"env": {
"LOYALTEEZ_NETWORK": "mainnet",
"LOYALTEEZ_BRAND_ID": "your-brand-id-here"
}
}
}
}
Environment Variablesβ
LOYALTEEZ_NETWORK: Network to use -mainnet(default) ortestnetLOYALTEEZ_BRAND_ID: Your brand wallet address (optional, can also be provided per-tool)
Quick Start Examplesβ
Example 1: Design a Loyalty Programβ
Simply describe what you want:
User: "Design a loyalty program for my developer Discord with events for
quality contributions, daily check-ins, and helpful answers"
AI: [Uses loyalteez_design_program tool]
Returns: Complete program with:
- Event structure
- Reward amounts
- Implementation code
- Best practices
Example 2: Add Daily Check-insβ
User: "Add daily check-ins with streak bonuses to my Telegram bot"
AI: [Uses loyalteez_streak_checkin tool]
Generates code:
- Bot command handler
- Streak tracking logic
- Multiplier calculations
- Milestone notifications
Example 3: Create Custom Eventsβ
User: "Create 5 events for my Telegram trading community: daily check-in,
helpful answer, trade signal, referral, and milestone celebration"
AI: [Uses loyalteez_create_events_batch tool]
Returns:
- All created events with IDs
- Telegram bot implementation code
- Event tracking examples
Available Toolsβ
The MCP server provides 24+ tools organized into categories:
Program Designβ
loyalteez_design_program- AI-powered program generation
Event Managementβ
loyalteez_create_event- Create single custom eventloyalteez_create_events_batch- Create multiple eventsloyalteez_track_event- Fire events and reward usersloyalteez_get_event_config- Get all configured eventsloyalteez_bulk_events- Batch event trackingloyalteez_admin_reward- Manual admin rewards
User Managementβ
loyalteez_resolve_user- Convert platform identity to walletloyalteez_get_user_balance- Get user balance and historyloyalteez_check_eligibility- Check reward eligibilityloyalteez_get_user_stats- Comprehensive user statistics
Engagement & Gamificationβ
loyalteez_streak_checkin- Process streak check-inloyalteez_get_streak_status- Get streak statusloyalteez_claim_streak_milestone- Claim milestone bonusesloyalteez_log_activity- Track voice/message activityloyalteez_calculate_reward- Calculate rewards with multipliersloyalteez_get_leaderboard- Get ranked leaderboardsloyalteez_update_leaderboard_stats- Update user stats
Social Featuresβ
loyalteez_create_drop- Create time-limited reward dropsloyalteez_claim_drop- Process drop claimsloyalteez_process_third_party_event- Integrate with Mee6, Arcane, etc.
Perks & Redemptionβ
loyalteez_list_perks- Get available perksloyalteez_check_perk_eligibility- Check perk eligibilityloyalteez_redeem_perk- Redeem a perk
Achievementsβ
loyalteez_get_user_achievements- Get user achievementsloyalteez_update_achievement_progress- Update achievement progress
Transactionsβ
loyalteez_relay_transaction- Execute gasless transactions
Available Resourcesβ
The MCP server provides access to:
Documentation Resourcesβ
All developer documentation is available as MCP resources:
loyalteez://docs/architectureloyalteez://docs/api/rest-apiloyalteez://docs/integrations/discordloyalteez://docs/guides/custom-events- ... and 50+ more documentation pages
Static Resourcesβ
- Contracts:
loyalteez://contracts/ltz-token,loyalteez://contracts/perk-nft,loyalteez://contracts/all - Network:
loyalteez://network/config- Soneium network configuration - Event Types:
loyalteez://events/standard- Standard event types reference - Shared Services:
loyalteez://shared-services/endpoints- API endpoints reference - OAuth Providers:
loyalteez://platforms/mappings- OAuth provider ID formats
BrandId Configurationβ
The brandId parameter is required for most operations. You can provide it in two ways:
- Environment Variable (Recommended): Set
LOYALTEEZ_BRAND_IDin your MCP configuration - Tool Parameter: Provide
brandIdas a parameter to each tool call
If neither is provided, tools will return a helpful error message explaining how to set it up.
Common Use Casesβ
Discord Bot Integrationβ
User: "Add loyalty rewards to my Discord bot. Reward users for:
- Daily check-ins (50 LTZ)
- Helpful answers (100 LTZ)
- Voice chat participation (10 LTZ per 5 minutes)"
AI generates complete Discord.js bot code with:
- Command handlers
- Event tracking
- Reward distribution
- Error handling
Telegram Bot Integrationβ
User: "Create a Telegram bot that tracks daily check-ins with streaks"
AI generates complete Telegraf bot code with:
- /checkin command
- Streak tracking
- Milestone notifications
- Leaderboard integration
Web Integrationβ
User: "Add loyalty rewards to my Next.js app for newsletter signups and purchases"
AI generates:
- React components
- API route handlers
- Event tracking hooks
- Balance display components
Best Practicesβ
- Set BrandId in Environment: Use
LOYALTEEZ_BRAND_IDenvironment variable for convenience - Use Resources: AI can access documentation resources to understand best practices
- Test on Testnet: Use
LOYALTEEZ_NETWORK=testnetfor testing - Check Eligibility: Use
loyalteez_check_eligibilitybefore tracking events - Update Leaderboards: Call
loyalteez_update_leaderboard_statsafter rewards
Troubleshootingβ
BrandId Not Foundβ
If you see "BrandId is required but not provided":
- Set
LOYALTEEZ_BRAND_IDin your MCP configuration, or - Provide
brandIdas a parameter to tool calls
Tool Not Foundβ
Ensure you've built the project:
cd loyalteez-mcp
npm run build
Resource Not Foundβ
Resources are loaded at server startup. Ensure:
- Documentation files exist in the expected location
- Resource URIs match the expected format
Architectureβ
AI Assistant (Claude/ChatGPT/Cursor)
β MCP Protocol
Loyalteez MCP Server
β HTTP API
Loyalteez APIs
- Event Handler (api.loyalteez.app)
- Shared Services (services.loyalteez.app)
- Pregeneration (register.loyalteez.app)
Securityβ
- No API keys required - uses public
brandIdidentifier - All inputs validated server-side
- Rate limiting awareness (documented limits)
- Support for testnet/mainnet separation
- BrandId can be set via environment variable for convenience
Related Documentationβ
- REST API Reference
- Shared Services Overview
- Custom Events Guide
- Discord Integration
- Telegram Integration
Next Stepsβ
- Install and configure the MCP server
- Try a simple prompt: "Design a loyalty program for my Discord server"
- Review the generated code and customize as needed
- Deploy and test your integration
Package Informationβ
- npm Package: @loyalteez/mcp-server
- GitHub Repository: Alpha4-Labs/loyalteez-mcp
- Version: 1.0.0
- License: MIT
For more examples and detailed documentation, see the MCP Server README.