How to Use the Viral Loops MCP in Mastra AI
Build resilient, multi-step referral workflows using Mastra AI with the MCP Server.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Viral Loops MCP to Mastra AI
Create your Vinkius account to connect Viral Loops to Mastra AI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.
Manage Campaign Logic
Mastra AI uses `list_campaigns` to discover all available campaigns before building logic around them. You then use `get_campaign` to pull detailed information for a specific ID, which helps define workflow steps. This makes your multi-step workflows highly accurate because the process starts with concrete campaign data.
Track User Progress and Milestones
When an event happens (like a sign-up), you can call `create_participant` to add them to the record. You also run `get_milestones` to check reward progress, automatically triggering subsequent workflow steps when thresholds are met. This is perfect for complex operations that need conditional branching based on referral counts.
Handle Participant Data Updates
The server lets you get details for a participant using `get_participant` and then modify those records with `update_participant`. This ability to manage the data flow makes your workflows much more reliable. You can also retrieve the unique link needed via `get_referral_url`, which is key for logging or notification steps.
Set up Viral Loops MCP in Mastra AI
Prerequisites
- Node.js 18+ and a TypeScript project
-
@mastra/mcp+@mastra/corepackages - Active Vinkius subscription with a valid endpoint token
- 1
Install dependencies
Run
npm install @mastra/mcp @mastra/coreplus your preferred model provider (e.g.@ai-sdk/openai). - 2
Configure the MCPClient
Create an
MCPClientwith your Vinkius endpoint as aURLobject. Replace[YOUR_TOKEN_HERE]with your token from cloud.vinkius.com. - 3
Discover and inject tools
Call
mcpClient.listTools()and spread the result into your agent'stoolsobject. All Viral Loops tools become native Mastra tools. - 4
Run with any model
Swap
openai("gpt-4o")for any AI SDK-compatible provider. Callagent.generate()and the agent routes tool calls through MCP automatically.
import { MCPClient } from "@mastra/mcp";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";
const mcpClient = new MCPClient({
id: "viral-loops-mcp-client",
servers: {
"viral-loops-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "Viral Loops Agent",
model: openai("gpt-4o"),
instructions: "You have access to Viral Loops tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent Viral Loops transactions"
);
console.log(result.text); Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by Viral Loops. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.
Why Choose Vinkius
Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.
Real-time monitoring
Live
visibility into every interaction
Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.
Built-in savings
60%
lower AI costs
Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.
Single dashboard
One
place for every integration
Every tool your AI connects to, managed from a single screen. One account, complete control.
Common questions about Viral Loops MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Viral Loops MCP today
We host it, we monitor it, we maintain it. You just paste one token.