How to Use the Churnkey MCP in Mastra AI
Build resilient Churnkey workflows with Mastra AI. Automate retention tasks with conditional logic, retries, and error handling built in.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Churnkey MCP to Mastra AI
Create your Vinkius account to connect Churnkey 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.
Automate GDPR Compliance
Build a fully automated GDPR request handler with a Mastra AI workflow. When a request comes in, the first step can call `get_customer_gdpr_data` to package up the user's information. Mastra's engine can then stage this data for review or delivery. After confirmation, a subsequent step in the same workflow triggers `delete_customer_gdpr_data`. Because Mastra handles retries, you don't have to worry about transient network failures. If the deletion succeeds, the workflow can proceed to send a final confirmation email.
Proactive Billing Recovery Workflows
Don't just analyze churn, automate the fix. Create a Mastra AI agent that periodically runs `list_retention_sessions` to find sessions triggered by billing failures. This becomes the starting point for your recovery workflow. Based on the session details, your workflow can use conditional logic. For example: if the customer has a secondary email on file in your CRM, use it to call `update_billing_contacts` in Churnkey. For larger-scale fixes, you can batch updates with `bulk_update_billing_contacts`.
Build Smart Retention Analysis Agents
You can build a Mastra AI agent that acts as a churn watchdog. Set up a workflow that runs `get_session_aggregates` daily. The agent can then check if the number of cancellations for a specific reason has spiked. If a threshold is crossed, the workflow branches. It can then use `list_customer_retention_history` and `get_retention_session_details` to pull specifics from the relevant sessions and post a detailed alert to a Slack channel. This whole process runs automatically via this MCP Server.
Set up Churnkey 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 Churnkey 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: "churnkey-mcp-client",
servers: {
"churnkey-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "Churnkey Agent",
model: openai("gpt-4o"),
instructions: "You have access to Churnkey tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent Churnkey 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 Churnkey. 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 Churnkey MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Churnkey MCP today
We host it, we monitor it, we maintain it. You just paste one token.