Loyalteez MCP Server

Loyalteez MCP Server

Model Context Protocol (MCP) server for Loyalteez, enabling AI assistants to design loyalty programs, create events, track rewards, and access comprehensive documentation.

Category
访问服务器

README

Loyalteez MCP Server

Model Context Protocol (MCP) server for Loyalteez - enabling AI assistants to design loyalty programs, create events, track rewards, and access comprehensive documentation.

npm version Tests TypeScript MCP License

Overview

The Loyalteez MCP Server provides AI tools (Claude, ChatGPT, Cursor, etc.) with direct access to Loyalteez's loyalty infrastructure. Design entire programs through natural conversation, create custom events, track rewards, and access full documentation - all via the MCP protocol.

The First Loyalty Platform with Native AI Integration - Enable AI assistants to build complete loyalty integrations through natural conversation.

Features

  • 30 Tools: Comprehensive toolset for loyalty program integration
  • 11 Resources: Reference materials including contracts, SDK docs, error codes, and more
  • Program Design: AI-powered loyalty program generation with event structures, tiers, and implementation code
  • Event Management: Create and track infinitely flexible custom events with channel constraints and domain validation
  • User Identity: Resolve platform identities to Loyalteez wallets
  • Engagement Services: Streak tracking, leaderboards, achievements, and activity logging
  • Webhook Support: Validate signatures and generate receiver code for any framework
  • Mobile Examples: React Native, iOS, Android, and Flutter integration examples
  • Code Generation: Generate complete implementations with TypeScript types, error handling, and tests
  • Documentation Access: Full developer docs available as MCP resources (lazy-loaded and cached)
  • Platform Support: Discord, Telegram, Web, Shopify, Gaming, and more

Scope

The MCP server focuses on 3rd-party developer integration capabilities. For brand admin features (Stripe checkout, DNS verification, analytics), use the Partner Portal. See SCOPE.md for detailed scope definition.

Installation

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

# Clone the repository
git clone https://github.com/Alpha4-Labs/loyalteez-mcp.git
cd loyalteez-mcp

# Install dependencies
npm install

# Build the project
npm run build

The built server will be available at dist/index.js.

Usage

With Claude Desktop

Add to your Claude Desktop MCP configuration:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

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": ["/absolute/path/to/loyalteez-mcp/dist/index.js"],
      "env": {
        "LOYALTEEZ_NETWORK": "mainnet",
        "LOYALTEEZ_BRAND_ID": "0x47511fc1c6664c9598974cb112965f8b198e0c725e"
      }
    }
  }
}

Environment Variables

  • LOYALTEEZ_NETWORK: Network to use - mainnet (default) or testnet
  • LOYALTEEZ_BRAND_ID: Your brand wallet address (optional, can also be provided per-tool)

Available Tools

Program Design

  • loyalteez_design_program: Design a complete loyalty program from context

Event Management

  • loyalteez_create_event: Create a single custom event
  • loyalteez_create_events_batch: Create multiple events at once
  • loyalteez_track_event: Fire any event and reward users
  • loyalteez_get_event_config: Get all configured events for a brand
  • loyalteez_bulk_events: Submit multiple events in a single request
  • loyalteez_admin_reward: Manually reward users (mod/admin triggered)

User Identity & Balance

  • loyalteez_resolve_user: Convert platform identity to Loyalteez wallet
  • loyalteez_get_user_balance: Get user's LTZ balance and transaction history
  • loyalteez_check_eligibility: Check if user can claim an event reward
  • loyalteez_get_user_stats: Get comprehensive user statistics

Engagement Services

  • loyalteez_streak_checkin: Process streak check-in with multipliers
  • loyalteez_get_streak_status: Get current streak status
  • loyalteez_claim_streak_milestone: Claim milestone bonuses (7, 30, 100, 365 days)
  • loyalteez_log_activity: Track voice time, messages, reactions with daily caps
  • loyalteez_calculate_reward: Calculate final reward with role multipliers
  • loyalteez_get_leaderboard: Get ranked leaderboards by metric
  • loyalteez_update_leaderboard_stats: Update user stats after reward

Social Features

  • loyalteez_create_drop: Create time-limited reward drops
  • loyalteez_claim_drop: Process drop claims from users
  • loyalteez_process_third_party_event: Handle events from Mee6, Arcane, Tatsu, etc.

Perks & Redemption

  • loyalteez_list_perks: Get available perks for a brand
  • loyalteez_check_perk_eligibility: Check if user can claim a specific perk
  • loyalteez_redeem_perk: Redeem a perk for a user

Achievements

  • loyalteez_get_user_achievements: Get all achievements for a user
  • loyalteez_update_achievement_progress: Update progress toward achievements

Transactions

  • loyalteez_relay_transaction: Execute gasless blockchain transactions

Available Resources

Documentation Resources

All developer documentation is available as MCP resources with URIs like:

  • loyalteez://docs/architecture
  • loyalteez://docs/api/rest-api
  • loyalteez://docs/integrations/discord
  • loyalteez://docs/guides/custom-events
  • ... and many more

Static Resources

  • Contracts: loyalteez://contracts/ltz-token, loyalteez://contracts/perk-nft, loyalteez://contracts/points-sale, loyalteez://contracts/all
  • Network: loyalteez://network/config - Soneium network configuration
  • Event Types: loyalteez://events/standard - Standard event types reference (includes channel constraints and domain validation)
  • Shared Services: loyalteez://shared-services/endpoints - API endpoints for gamification services
  • OAuth Providers: loyalteez://platforms/mappings - OAuth provider ID formats
  • Error Codes: loyalteez://errors/codes - Complete HTTP status codes and error response reference
  • Error Handling: loyalteez://errors/handling - Error handling patterns and best practices
  • Rate Limits: loyalteez://rate-limits/endpoints - Rate limits by endpoint with reset periods
  • Rate Limit Strategies: loyalteez://rate-limits/strategies - Code examples for handling rate limits
  • SDK Methods: loyalteez://sdk/methods - JavaScript SDK method reference with examples
  • SDK Examples: loyalteez://sdk/examples - SDK usage examples for React, Vue, Next.js

Example Usage

Design a Discord Program

User: "Design a loyalty program for my developer Discord with events for quality contributions"

AI: [Uses loyalteez_design_program tool]
    Returns: Complete program with events, implementation code, and best practices

Create Custom Events

User: "Create 5 events for my Telegram trading community"

AI: [Uses loyalteez_create_events_batch tool]
    Returns: All created events + Telegram bot implementation code

Track Events

User: "Track a helpful_answer event for Discord user 123456789"

AI: [Uses loyalteez_track_event tool]
    Returns: Success, reward amount, new balance, transaction hash

Daily Check-in with Streaks

User: "Set up daily check-ins with streak bonuses for my Telegram bot"

AI: [Uses loyalteez_streak_checkin tool]
    Returns: Current streak, multiplier, reward amount, next milestone

Check User Balance

User: "What's the balance for user discord_123456789?"

AI: [Uses loyalteez_get_user_balance tool]
    Returns: Current balance, wallet address, transaction history

Create a Reward Drop

User: "Create a reaction drop for 50 LTZ, first 100 users"

AI: [Uses loyalteez_create_drop tool]
    Returns: Drop ID, claim URL, embed data for posting

Architecture

AI Assistant (Claude/ChatGPT)
    ↓ MCP Protocol
Loyalteez MCP Server
    ↓ HTTP API
Loyalteez APIs
    - Event Handler (api.loyalteez.app)
    - Shared Services (services.loyalteez.app)
    - Pregeneration (register.loyalteez.app)

Development

Build

npm run build

Type Check

npm run typecheck

Testing

npm test

See Testing section for details.

Project Structure

loyalteez-mcp/
├── src/
│   ├── index.ts              # Entry point
│   ├── server.ts              # MCP server setup
│   ├── tools/                 # MCP tools
│   │   ├── events.ts
│   │   ├── program-design.ts
│   │   ├── identity.ts
│   │   ├── engagement.ts
│   │   ├── user.ts
│   │   ├── transactions.ts
│   │   ├── drops.ts
│   │   ├── integrations.ts
│   │   ├── perks.ts
│   │   └── achievements.ts
│   ├── resources/             # MCP resources
│   │   ├── docs.ts
│   │   ├── contracts.ts
│   │   ├── network.ts
│   │   ├── event-types.ts
│   │   ├── shared-services.ts
│   │   ├── oauth.ts
│   │   ├── errors.ts
│   │   ├── rate-limits.ts
│   │   └── sdk.ts
│   ├── utils/                 # Utilities
│   │   ├── api-client.ts
│   │   ├── brand-id.ts
│   │   ├── doc-loader.ts
│   │   ├── doc-index.ts
│   │   └── validation.ts
│   └── types/                  # TypeScript types
│       └── index.ts
├── tests/                      # Test suite
│   ├── brand-id.test.ts
│   ├── validation.test.ts
│   ├── resources.test.ts
│   ├── tools.test.ts
│   ├── api-client.test.ts
│   ├── integration.test.ts
│   └── README.md
├── examples/                   # Usage examples
└── README.md

API Endpoints

The MCP server interacts with these Loyalteez APIs:

  • Event Handler: https://api.loyalteez.app (mainnet) / https://api.loyalteez.xyz (testnet)
  • Shared Services: https://services.loyalteez.app (mainnet) / https://services.loyalteez.xyz (testnet)
  • Pregeneration: https://register.loyalteez.app (mainnet) / https://register.loyalteez.xyz (testnet)

BrandId Configuration

The brandId parameter is required for most operations but can be provided in two ways:

  1. Environment Variable (Recommended): Set LOYALTEEZ_BRAND_ID in your environment
  2. Tool Parameter: Provide brandId as a parameter to each tool call

If neither is provided, tools will return a helpful error message explaining how to set it up.

Security

  • No API keys required - uses public brandId identifier
  • All inputs validated server-side
  • Rate limiting awareness (documented limits)
  • Support for testnet/mainnet separation
  • BrandId can be set via environment variable for convenience

Documentation

Full documentation is available as MCP resources. Access via:

loyalteez://docs/{path}

For example:

  • loyalteez://docs/architecture - System architecture
  • loyalteez://docs/api/rest-api - REST API reference
  • loyalteez://docs/integrations/discord - Discord integration guide

Testing

The MCP server includes a comprehensive test suite to validate all tools and patterns.

Run Tests

# Run all tests
npm test

# Run tests in watch mode (for development)
npm run test:watch

# Run tests with coverage report
npm run test:coverage

Test Coverage

Tests cover:

  • BrandId Resolution: Environment variable vs parameter handling
  • Input Validation: All validation utilities (brandId, email, eventType, etc.)
  • Resource Loading: All MCP resource types (contracts, network, events, etc.)
  • Tool Registration: All 24+ tools are properly registered
  • Tool Schemas: Schema validation and brandId optionality
  • API Client: All API methods and error handling
  • Server Integration: Server initialization and configuration

See tests/ directory for detailed test files and tests/README.md for test documentation.

Troubleshooting

BrandId Not Found

If you see "BrandId is required but not provided":

  1. Set LOYALTEEZ_BRAND_ID environment variable, or
  2. Provide brandId as a parameter to the tool call

Tool Not Found

Ensure you've built the project:

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 (e.g., loyalteez://docs/...)

Contributing

This is an internal tool for Alpha4 Labs. For issues or questions, contact the Loyalteez team.

License

MIT

Related

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选