How to Use the KeyCDN (Content Delivery Network) MCP in Mastra AI
Build autonomous CDN workflows that purge caches and monitor bandwidth using Mastra AI.
Works with every AI agent you already use
…and any MCP-compatible client
Connect KeyCDN (Content Delivery Network) MCP to Mastra AI
Create your Vinkius account to connect KeyCDN (Content Delivery Network) 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.
Automated cache invalidation via Mastra AI
`purge_zone_cache_all` wipes the entire edge cache for a selected distribution zone. Mastra AI triggers this tool inside automated deployment workflows, ensuring your production updates go live globally without manual intervention. If the API call hits a rate limit, Mastra's built-in retry engine handles backoffs automatically. This guarantees your edge cache stays synchronized with your origin server even during heavy traffic spikes.
Dynamic custom domain mapping
`add_zone_alias` registers a custom CNAME domain to your existing KeyCDN distribution. Mastra AI coordinates this step with your DNS updates, verifying that the routing works before exposing the new alias to production traffic. Your workflows handle the entire domain lifecycle. If a domain needs removal, the agent calls `delete_zone_alias` to clean up your CDN configuration without leaving orphaned records.
Programmatic bandwidth cost controls
`list_traffic_reports` retrieves bandwidth consumption metrics across all active zones. Mastra AI processes these reports inside scheduled workflows, monitoring for unusual egress patterns that indicate a DDoS attack or a misconfigured asset. The workflow takes immediate action when traffic exceeds your set limits. You can configure the agent to alert your engineering team or temporarily adjust pull zone settings to protect your origin server.
Set up KeyCDN (Content Delivery Network) 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 KeyCDN (Content Delivery Network) 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: "keycdn-content-delivery-network-mcp-client",
servers: {
"keycdn-content-delivery-network-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "KeyCDN (Content Delivery Network) Agent",
model: openai("gpt-4o"),
instructions: "You have access to KeyCDN (Content Delivery Network) tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent KeyCDN (Content Delivery Network) 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 KeyCDN. 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 KeyCDN (Content Delivery Network) MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the KeyCDN (Content Delivery Network) MCP today
We host it, we monitor it, we maintain it. You just paste one token.