How to Use the ImageKit (Media Optimization & DAM) MCP in Mastra AI
Build reliable, self-healing media workflows in Mastra AI using this ImageKit MCP Server.
Works with every AI agent you already use
…and any MCP-compatible client
Connect ImageKit (Media Optimization & DAM) MCP to Mastra AI
Create your Vinkius account to connect ImageKit (Media Optimization & DAM) 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.
Build self-healing CDN cache clearing pipelines
Cache purging shouldn't be a manual chore, which is why you can build workflows that automatically run `purge_cdn_cache` when your database updates. If the CDN purge fails, the framework automatically retries the operation with exponential backoff. Your agent uses `get_purge_status` to monitor the invalidation until it succeeds. This ensures your global users never see broken or outdated images due to network hiccups.
Control custom metadata schemas via Mastra AI agents
Managing custom fields across thousands of assets is messy, but your agent can run `create_custom_schema` to set up structured fields for your media library. It can then call `list_custom_fields` to verify the existing schema before applying updates. This prevents schema mismatches from breaking your automation pipelines. You get clean, structured metadata that your workflows can parse without throwing errors.
Keep your storage clean using this MCP Server
Stale files drain your budget, so your agent queries your library using `list_media_files` to identify unused assets. When it finds files that are no longer needed, it runs `wipe_media_asset` or `wipe_batch_assets` to clean up your storage bucket. You can require human approval before these deletions execute. This gives you a safe, semi-automated way to manage storage costs without risking data loss.
Set up ImageKit (Media Optimization & DAM) 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 ImageKit (Media Optimization & DAM) 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: "imagekit-media-optimization-dam-mcp-client",
servers: {
"imagekit-media-optimization-dam-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "ImageKit (Media Optimization & DAM) Agent",
model: openai("gpt-4o"),
instructions: "You have access to ImageKit (Media Optimization & DAM) tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent ImageKit (Media Optimization & DAM) 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 ImageKit. 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 ImageKit (Media Optimization & DAM) MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the ImageKit (Media Optimization & DAM) MCP today
We host it, we monitor it, we maintain it. You just paste one token.