How to Use the Amazon Bedrock KB MCP in Mastra AI
Build resilient workflows that query and manage your Amazon Bedrock KB with Mastra AI's workflow engine.
Works with every AI agent you already use
…and any MCP-compatible client
Connect Amazon Bedrock KB MCP to Mastra AI
Create your Vinkius account to connect Amazon Bedrock KB 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 Reliable KB Workflows
This MCP Server exposes the tools you need to automate your Bedrock KB management. A Mastra AI workflow can trigger an ingestion job, then use `list_ingestion_jobs` to poll for completion. If it fails, Mastra's engine can automatically retry or escalate. You can build a workflow that checks all your KBs daily. It would use `list_knowledge_bases` to get the list, then loop through each one using `list_data_sources` to confirm the right sources are attached. It's set-and-forget monitoring for your RAG pipeline.
Add Smarter RAG to Mastra AI Agents
Go beyond simple Q&A. With Mastra AI, you can build conditional logic around Bedrock KB queries. Use the `retrieve` tool to get source documents and check their metadata before deciding whether to proceed with generation. For example, if a query returns documents marked 'confidential,' your workflow could route the request for human approval instead of automatically generating an answer with `retrieve_and_generate`. That's the kind of robust process Mastra AI is built for.
A Resilient MCP Server Connection
This isn't just a basic API wrapper. The Mastra AI client has built-in support for things like exponential backoff. If a call to `get_knowledge_base` fails due to a transient network issue, the client handles the retries for you. You define the workflow, and Mastra AI's engine handles the execution details. By pairing it with this managed MCP server, you get a reliable way to interact with AWS services without writing tons of boilerplate error-handling code.
Set up Amazon Bedrock KB 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 Amazon Bedrock KB 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: "amazon-bedrock-kb-mcp-client",
servers: {
"amazon-bedrock-kb-mcp": {
url: new URL(
"https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
),
},
},
});
const agent = new Agent({
name: "Amazon Bedrock KB Agent",
model: openai("gpt-4o"),
instructions: "You have access to Amazon Bedrock KB tools.",
tools: {
...(await mcpClient.listTools()),
},
});
const result = await agent.generate(
"List recent Amazon Bedrock KB 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 Amazon Bedrock. 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 Amazon Bedrock KB MCP in Mastra AI
Use it with your favorite AI tools
Connect this server to Cursor, Claude, VS Code, and more.
Start using the Amazon Bedrock KB MCP today
We host it, we monitor it, we maintain it. You just paste one token.