Labsco
divvi-xyz logo

Divvi MCP Server

from divvi-xyz

Automatically integrate the Divvi referral SDK into JavaScript and TypeScript blockchain applications.

๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Divvi MCP Server

A Model Context Protocol (MCP) server that provides AI assistants with tools for working with the Divvi ecosystem. Currently focuses on automatic integration of the @divvi/referral-sdk into JavaScript/TypeScript blockchain applications, with more Divvi-related functionality planned for future releases.

Overview

Integrating referral tracking into blockchain applications typically requires understanding SDK documentation, modifying transaction flows, and maintaining integration code as protocols evolve. This MCP server eliminates that complexity by turning any AI assistant into a Divvi integration expert that can automatically implement referral tracking following current best practices.

Compatible with any JavaScript/TypeScript blockchain application, including:

  • Frontend frameworks: React, Next.js, Vue, Angular, Svelte, vanilla JavaScript
  • Backend applications: Node.js, Express, Fastify, serverless functions
  • Full-stack frameworks: Next.js, Nuxt, SvelteKit, Remix
  • Desktop/mobile: Electron, React Native, Ionic
  • Any JS/TS app that makes blockchain transactions

The server currently provides an MCP tool (integrate_divvi_referral_sdk) that:

  1. ๐Ÿ“– Guides AI agents to read the latest official Divvi SDK documentation
  2. ๐Ÿ” Instructs project analysis to understand the target application structure
  3. ๐Ÿ”ง Provides integration parameters (consumer address and provider campaigns)
  4. โœ… Ensures proper implementation following official patterns and best practices

Key Features

  • Always up-to-date: Instructs AI agents to read documentation directly from the official repository
  • Universal compatibility: Works with React, Vue, Angular, Node.js, vanilla JS, and any JavaScript/TypeScript framework
  • Blockchain library agnostic: Supports viem, ethers, wagmi, and other Web3 libraries
  • Non-prescriptive: Provides guidance while letting AI agents use their own capabilities intelligently
  • Future-proof: Instructions adapt as the Divvi SDK evolves
  • Extensible: Designed to support additional Divvi ecosystem tools and functionality

Technical Note: This integration is implemented as an MCP "tool" rather than a "prompt" type. While the MCP specification includes a prompt type that would be more semantically appropriate for this use case, we chose the tool implementation for broader compatibility, as Cursor doesn't currently support MCP prompts.

How It Works

1. Documentation-Driven Integration

The tool instructs AI agents to read the official SDK documentation from: https://raw.githubusercontent.com/divvi-xyz/divvi-referral-sdk/refs/heads/main/README.md

This ensures the integration always follows the latest patterns and examples.

2. Project Analysis

AI agents analyze the target project to understand:

  • Package manager (npm/yarn)
  • JavaScript/TypeScript framework being used
  • Blockchain libraries (viem, ethers, wagmi)
  • Existing transaction patterns
  • Account management approach

3. SDK Integration

Following the official documentation, AI agents implement:

  • SDK installation
  • Import statements
  • Transaction modifications (adding referral tags)
  • Referral submission after transactions
  • Proper error handling

4. Validation

The integration ensures:

  • All blockchain transactions include referral tracking
  • Referral failures don't break existing transaction flows
  • Code follows project conventions
  • Integration uses the provided addresses correctly

Development

Local Development

# Start in development mode
yarn dev

# Run tests
yarn test

# Type checking
yarn typecheck

# Linting
yarn lint

# Format code
yarn format

Project Structure

src/
โ”œโ”€โ”€ index.ts          # Main MCP server implementation
โ”œโ”€โ”€ index.test.ts     # Unit tests
โ””โ”€โ”€ ...

scripts/              # Build and utility scripts
dist/                 # Compiled output

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes following the existing code style
  4. Add tests for new functionality
  5. Run the test suite: yarn test
  6. Submit a pull request

API Reference

Current Tools

Tool: integrate_divvi_referral_sdk

Provides instructions for integrating the @divvi/referral-sdk into a project.

Parameters

ParameterTypeRequiredDescription
consumerAddressstringYesYour Divvi dapp wallet address (builder registration)

Returns

Comprehensive integration instructions that guide AI agents through:

  • Reading official documentation
  • Analyzing project structure
  • Implementing the integration
  • Validating the result

Future Tools

Additional tools for the Divvi ecosystem are planned for future releases. These may include:

  • Data integration: Helpers for tracking referral performance and metrics
  • Protocol interaction: Direct interaction with Divvi protocol contracts
  • Campaign management: Tools for creating and managing referral campaigns

Stay tuned for updates as we expand the server's capabilities!

Support