Build an AI Agent with MCP

Connect Claude or any MCP-compatible AI to your DUAL instance using the Model Context Protocol server.

20 minAdvanced

Prerequisites

  • Node.js 18+ installed
  • A DUAL account with API key
  • Claude Desktop, Cursor, or Claude Code installed

What You'll Build

The Model Context Protocol (MCP) lets AI agents interact with external tools natively. DUAL's MCP server exposes 80 tools across 14 API modules — meaning an AI agent can create templates, mint tokens, execute actions, and query data using natural language. In this tutorial you'll install the server, connect it to Claude, and build a complete tokenization workflow driven by conversation.

Step 1 — Install the MCP Server

bash
git clone https://github.com/ro-ro-b/dual-mcp-server.git
cd dual-mcp-server
npm install
npm run build

Step 2 — Configure Claude Desktop

Add the DUAL server to your Claude Desktop config:

json
{
  "mcpServers": {
    "dual": {
      "command": "node",
      "args": ["/path/to/dual-mcp-server/dist/index.js"],
      "env": {
        "DUAL_API_KEY": "your-api-key-here"
      }
    }
  }
}

Config file locations:

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

Restart Claude Desktop after saving.

Step 3 — Authenticate via Chat

If you didn't set an API key, authenticate interactively:

text
You: Log me into DUAL with email dev@example.com

Claude: [calls dual_login] Logged in as dev@example.com. Session authenticated.

Step 4 — Build a Token with Natural Language

Describe what you want and let the AI handle the API calls:

text
You: Create a reward token template called "Coffee Stamp Card" with properties
     for stamps (number, default 0), max_stamps (10), and redeemed (false).

Claude: [calls dual_create_template]
        Created template "Coffee Stamp Card" (ID: tmpl_abc123).

You: Mint 5 of those for wallet "wallet_xyz"

Claude: [calls dual_execute_action to mint 5 objects]
        Minted 5 Coffee Stamp Card objects.

You: Set up a webhook to notify me when any get redeemed

Claude: [calls dual_create_webhook]
        Webhook created for object.updated events.

Step 5 — Available Modules

The MCP server exposes 14 modules with 80 tools total:

ModuleToolsDescription
Wallets10Auth, registration, profile
Organizations10Multi-tenant workspaces
Templates7Token blueprint CRUD
Objects8Token instances, search
Actions7Event Bus operations
Faces6Visual representations
Storage4File management
Webhooks6Real-time notifications
Notifications5Message sending
Sequencer4Batch and ZK queries
API Keys3Access management
Payments2Deposits and config
Support3Feature requests
Public API5Read-only (no auth)

Alternative: Claude Code CLI

bash
claude mcp add dual node /path/to/dual-mcp-server/dist/index.js
Security Note: The MCP server runs locally on your machine. Your API key and JWT tokens never leave your computer — they're passed directly to the DUAL API over HTTPS.

Summary

You've connected an AI agent to the DUAL platform via MCP. The agent can now autonomously create templates, mint tokens, manage organizations, and execute actions through natural conversation. For the full reference, see the MCP Server docs and Setup Guide.