How to Use the Courier MCP in Mastra AI
Build failure-proof notification workflows with Mastra AI. Let your agents send, check, and retry Courier messages automatically through this managed MCP.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Courier MCP to Mastra AI
Create your Vinkius account to connect Courier 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 Your Notification Sequences
Mastra AI's workflow engine can now run your Courier account. Build a sequence that's actually reliable: `send_notification`, wait for a set period, then automatically call `get_message_history` to confirm it was delivered. Here's the key: if a message fails, Mastra's built-in retry logic kicks in. Your workflow can automatically attempt a resend or, based on provider logs, decide to try a different channel. This MCP Server makes your notifications dependable, not just best-effort.
Branch Workflows on User Engagement
Your Mastra AI agent can finally see if your messages are landing. It uses the `list_messages` tool to find a specific message and check its status for opens or clicks. This is where your automations get smart. Build conditional logic in your workflow. If a user clicked the link, your agent can add them to a new audience. If they didn't open the email in 48 hours, the agent can trigger a follow-up SMS. It's closed-loop communication.
Manage Courier Assets with Mastra AI
This connection isn't just about sending messages. Your Mastra AI agent can perform maintenance on your Courier setup. It can pull your brand settings with `list_brands` or get a full inventory of subscription lists with `list_subscription_lists`. Use this for automated housekeeping. Build an agent that periodically checks for old, unused templates via `list_templates` and flags them for cleanup. This is how you turn a simple MCP connection into an automated admin.
Set up Courier 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 Courier 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: "courier-mcp-client",
servers: {
"courier-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "Courier Agent",
model: openai("gpt-4o"),
instructions: "You have access to Courier tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent Courier 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 Courier. 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 Courier MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Courier MCP today
We host it, we monitor it, we maintain it. You just paste one token.