How to Use the Kong Gateway MCP in Mastra AI
Build resilient, self-healing API gateway workflows with Mastra AI and our Kong Gateway integration.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Kong Gateway MCP to Mastra AI
Create your Vinkius account to connect Kong Gateway 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 incident response with Mastra AI
The `get_status` and `update_plugin` tools let your workflows monitor gateway health and apply rate limits when traffic spikes. If a service experiences high error rates, Mastra AI triggers conditional branches to protect your backend. You can build workflows that automatically inject rate-limiting plugins when an endpoint is under load. The agent handles the detection and mitigation using the MCP server, keeping your APIs online without manual intervention.
Safe configuration rollbacks and retries
The `update_route` and `update_service` tools allow you to modify your API setup with built-in safety nets. If a route update fails or causes errors, Mastra's workflow engine automatically retries the operation or rolls back the changes. You do not have to write complex error-handling logic for API gateway failures. The integration handles the API calls, while the framework ensures that any failed configuration step triggers a fallback block to restore the previous state.
Human-in-the-loop gateway approvals
The `create_plugin` and `delete_route` tools on this MCP server can be locked behind manual confirmation steps. You configure the agent to draft the API gateway changes and pause for an engineer's sign-off before applying them. This setup gives you the speed of agentic configuration with the security of human oversight. Your team receives a Slack alert or dashboard notification, reviews the proposed change, and approves it with a single click.
Set up Kong Gateway 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 Kong Gateway 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: "kong-gateway-mcp-client",
servers: {
"kong-gateway-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "Kong Gateway Agent",
model: openai("gpt-4o"),
instructions: "You have access to Kong Gateway tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent Kong Gateway 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 Kong Gateway. 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 Kong Gateway MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Kong Gateway MCP today
We host it, we monitor it, we maintain it. You just paste one token.