AWS DevOps & Developer Productivity Blog
Scaling organizational knowledge in Kiro with Amazon Bedrock Knowledge Bases, LangChain, and MCP
“A pull request comes back with a single comment: “This doesn’t follow our circuit breaker pattern. Check the Architectural Decision Record .”
You know the architecture decision record exists somewhere. You open your team’s wiki, search “circuit breaker,” scroll past six irrelevant results, find the document, read through it, switch back to your editor, and fix the code. Fifteen minutes are gone. Not because the problem was hard, but because the knowledge lived in one place and the code lived in another.
This plays out multiple times a day across engineering teams. Developers face several recurring challenges when working with organizational knowledge:
- Context switching – Retrieving coding standards, API specs, or architecture decisions means leaving the editor to search wikis, shared drives, or documentation portals
- Knowledge fragmentation – Team knowledge lives across multiple systems, making it difficult to find the right document at the right time
- Onboarding friction – New team members spend days navigating unfamiliar documentation structures before becoming productive
- Stale compliance – Code reviews catch standards violations after the fact, instead of surfacing the correct pattern during development
The documentation exists and is well structured. But it is not accessible from where development happens.
In this post, we show how to connect Amazon Bedrock Knowledge Bases to Kiro through the Model Context Protocol (MCP), enabling developers to query team documentation directly from their editor and get cited answers quickly. Kiro is an agentic IDE that uses MCP to connect developers to external knowledge sources beyond the local workspace. Whether you already have a Knowledge Base or are building one from scratch, setup typically takes a few minutes.
Why MCP with Knowledge Bases When Kiro Already Has Steering and Agent Skills
Kiro provides several built-in mechanisms to give context to the agent:
- Steering files (.kiro/steering/*.md) deliver static instructions and project-level context. They can be included, conditionally matched by file pattern, or manually referenced. Ideal for coding standards, team conventions, and project-specific rules that fit in a few files.
- Agent Skills (.kiro/skills/) offer reusable instructions that users activate to guide agent behavior for specific workflows like code reviews, testing strategies, or deployment procedures.
- File references (#File, #Folder) provide explicit references to local workspace files for point-in-time context.
The MCP with Knowledge Bases approach is complementary, not a replacement. Use Steering for the ten rules every commit must follow. Use Agent Skills for workflow guidance. Use MCP with Knowledge Bases when your organization maintains hundreds of Architectural Decision Records, API specs, runbooks, security guidelines, and onboarding documents. No developer can internalize all of it. Semantic search surfaces the right answer at the right moment.
Together these serve distinct roles: Steering governs Kiro’s behavior, Knowledge Bases hold your organization’s collective knowledge, and MCP provides the connective layer that makes that knowledge accessible to Kiro on demand.
Solution overview
Amazon Bedrock Knowledge Bases has powered RAG workloads for multiple teams since well before Kiro launched. If your team already has a Knowledge Base, you have completed the foundational setup: documents curated, vectors indexed, knowledge layer built. What follows is a five-minute integration that brings all of it into the editor.
The question is not whether to start from scratch. It is simpler than that: how do you bring what you already have into Kiro?
In this integration, the awslabs.bedrock-kb-retrieval-mcp-server bridges the gap between Kiro and your Knowledge Base, translating natural language queries into vector search operations and returning cited passages directly in the editor.
The answer is a single configuration file and an MCP server that takes less than few minutes to connect.
The use cases that change daily workflows
Before we dive into the how, consider what becomes possible when your Knowledge Base lives inside your editor:
Coding standards enforcement in real time. A developer asks Kiro: “What’s our error handling pattern?” and gets back the exact custom error class structure your team agreed on six months ago, complete with the code snippet from your standards document.
API specifications at your fingertips. Instead of opening a browser tab to check authentication requirements, a developer types: “What authentication does the Orders API require?” and immediately sees the JWT scope requirements, header format, and rate limits pulled directly from your OpenAPI spec stored in the Knowledge Base.
Architecture decisions with full context. When someone needs to understand why a decision was made, not just what was decided, they ask Kiro. The Architectural Decision Record comes back with the rationale, the alternatives considered, and the tradeoffs, all cited with source documents.
Kiro CLI in CI/CD. Run headless queries against your Knowledge Base in pipelines. Validate that generated code matches team patterns. Automate compliance checks against your security guidelines during pull request reviews.
Two paths: bring what you have or start fresh
You already have a Knowledge Base
If your team already uses Amazon Bedrock Knowledge Bases, whether it was built for a chatbot, an internal search tool, or a customer-facing assistant, you don’t need to rebuild anything. Your existing Knowledge Base works with Kiro out of the box.
Here’s the approach:
- Tag your existing Knowledge Base with
mcp-multirag-kb=true. This is how the MCP server discovers it. - Configure the MCP server in Kiro (covered in the next section). Your documents, your embeddings, your vector store, all stay exactly where they are.
The official awslabs.bedrock-kb-retrieval-mcp-server auto-discovers Knowledge Bases with that tag. If you have multiple Knowledge Bases (one for API docs, another for architecture decisions, a third for runbooks), tag them all. Kiro can query across your tagged Knowledge Bases.
You don’t have a Knowledge Base yet
If you’re starting fresh, the accompanying sample repository provides a complete AWS CDK application that deploys everything you need: an Amazon S3 bucket for your documents, an Amazon OpenSearch Serverless collection for vector search, and an Amazon Bedrock Knowledge Base that ties it together. The setup script handles deployment in few minutes.
For the full infrastructure deployment walkthrough, including CDK stack details, document ingestion, and monitoring setup, see the repository README.
After the setup script completes, you see the following output confirming the deployment and providing next steps:
Figure 1: Setup script completion output. The script confirms the MCP config is ready, the Knowledge Base tag is set for auto-discovery, and provides sample queries to test immediately.
How it works
The Model Context Protocol (MCP) is what connects Kiro to your Knowledge Base. It acts as a bridge: Kiro connects via MCP on one side, Amazon Bedrock Knowledge Bases uses its Retrieve API on the other, and the MCP server translates between them.
The Architecture Diagram in Repository shows the end-to-end integration.
When you ask Kiro a question, the following sequence occurs:
- Developer asks a question – You type a natural language query in Kiro (IDE or CLI).
- MCP request – Kiro sends your query to the MCP server running as a local child process over stdio.
- Retrieve API call – The MCP server calls the Amazon Bedrock Knowledge Bases Retrieve API (not RetrieveAndGenerate).
- Vector search – Amazon Bedrock embeds your query using Amazon Titan Text Embeddings v2 and searches the Amazon OpenSearch Serverless vector store.
- Ranked chunks returned – The MCP server receives ranked document chunks with relevance scores and passes them back to Kiro.
- Kiro generates the response – Kiro’s own LLM synthesizes the retrieved chunks into a cited answer and presents it directly in your editor.
The official MCP server handles retrieval only. Kiro handles the generation, which means the quality of the response benefits from Kiro’s full conversation context and reasoning capabilities.You get cited answers directly in your editor, no context switching required.
Prerequisites
You need the following to connect the MCP server to Kiro:
- Kiro IDE or CLI installed on your machine
- uv package manager (provides
uvxfor running the server without installation) - AWS CLI v2 configured with credentials that have
bedrock:Retrievepermissions - An existing Amazon Bedrock Knowledge Bases (or deploy one using the sample repository)
Connect your Knowledge Base to Kiro
Create or update .kiro/settings/mcp.json in your project root
{
"mcpServers": {
"awslabs.bedrock-kb-retrieval-mcp-server": {
"command": "uvx",
"args": ["awslabs.bedrock-kb-retrieval-mcp-server@latest"],
"env": {
"AWS_PROFILE": "default",
"AWS_REGION": "<YOUR_REGION>",
"FASTMCP_LOG_LEVEL": "ERROR",
"KB_INCLUSION_TAG_KEY": "mcp-multirag-kb",
"BEDROCK_KB_RERANKING_ENABLED": "false"
},
"disabled": false,
"autoApprove": []
}
}
}
Replace <YOUR_REGION> with the region where your Knowledge Base lives.
– BEDROCK_KB_RERANKING_ENABLED controls whether the server applies Amazon Bedrock’s reranking model to re-score retrieved chunks by relevance before returning them. Set to “true” to enable reranking for higher-quality results at the cost of additional latency and reranking model charges. The default is “false”, which returns results ranked by vector similarity only.
– Note on permissions: Kiro inherits the same AWS permissions as the profile specified in AWS_PROFILE. The MCP server runs as your local process, so it uses your configured credentials directly. If your profile has broad permissions, Kiro can exercise all of them. For production Knowledge Bases, use a profile with least-privilege access – bedrock:Retrieve is sufficient for read-only queries.
Key settings:
- command: “
uvx” runs the server without installing anything permanently. It downloads, executes, and cleans up automatically. KB_INCLUSION_TAG_KEYtells the server to auto-discover any Knowledge Bases tagged withmcp-multirag-kb=true.autoApproveis empty by default. Add “ListKnowledgeBases” and “QueryKnowledgeBases” to skip confirmation prompts for read-only queries. Both tools are read-only — they retrieve data from your Knowledge Base without modifying it, so auto-approving them is appropriate for read-only workflows.
Restart Kiro. The MCP server connects and discovers your tagged Knowledge Bases automatically.
What this looks like in practice
Same pull request. Same reviewer comment about the circuit breaker pattern. But this time, you do not open a browser. You ask Kiro:
"What's our circuit breaker pattern?"
Kiro calls the MCP server, queries the Knowledge Base, and returns the result directly in your editor:
Figure 2: Kiro querying the Knowledge Base for the circuit breaker pattern. It calls ListKnowledgeBases to discover tagged Knowledge Bases, reads the local ADR file, and calls QueryKnowledgeBases to return the full parameter table from ADR-001 with source attribution.
The response includes the architecture decision record, the specific parameters (failure threshold, reset timeout, success threshold), and the source file reference. You fix your code quickly — no context switch, no browser tab, no searching.
Example: Querying API specifications
A developer types: "What authentication does the Orders API require?"
Kiro returns:
All requests require a valid JWT in the Authorization: Bearer <token> header. Tokens are issued by the Auth Service and must include the orders:read or orders:write scope.
Source: api-spec-orders.md
Example: Discovering documentation gaps
A teammate asks Kiro: "What security headers should our APIs return?"
The MCP server queries the Knowledge Base and returns the security guidelines document, which covers authentication, input validation, and secrets management — but does not mention HTTP response security headers. Kiro recognizes this gap in the retrieved content and, using its own workspace context (Kiro can read local files like security-guidelines.md independently of the MCP server), recommends the headers that should be added based on the existing security posture documented elsewhere.
Figure 3: Kiro querying security guidelines from the Knowledge Base. The MCP server returns the existing security posture (JWT handling, input validation, secrets management), and Kiro identifies the missing HTTP response security headers section, recommending additions based on the documented security context.
This illustrates how Kiro combines Knowledge Base retrieval with its native workspace awareness. The MCP server handles the retrieval; Kiro handles the reasoning across all available context.
The LangChain alternative: a cloud-agnostic approach with more control
The official MCP server covers most use cases. For advanced scenarios – provider portability (swap between Amazon Bedrock, OpenAI, or local models), server-side RAG with built-in relevance filtering, or custom LCEL chain composition, see the LangChain alternative section in the repository README.
You can run both servers simultaneously. Kiro selects the right tool based on your query.
Figure 4: Both MCP servers running simultaneously. Kiro calls `ask_knowledge_base` on the LangChain server and `ListKnowledgeBases` on the official server in parallel, then falls back to `QueryKnowledgeBases` to retrieve the full security guidelines for API authentication from the kiro-dev-knowledge-base.
For the complete LangChain setup, including provider swapping (OpenAI, Ollama, local models) and LCEL chain details, see the LangChain alternative section in the repository.
The Architecture Diagram for Langchain alternative in Repository shows the end-to-end integration.
Best practices for your Knowledge Base content
The quality of answers depends on the quality of your documents:
- Write Markdown with clear headings. The 512-token chunking works best with self-contained sections under each heading.
- Include code examples. Developers use returned snippets immediately. An error handling standard with a code sample is ten times more useful than one without.
- Use consistent naming. If your API is called “Orders API” in one document and “Order Service” in another, retrieval suffers.
- Keep documents current. Stale docs erode trust faster than missing docs. Set a quarterly review cadence.
Kiro CLI: Knowledge Base queries in your terminal and CI/CD
The same MCP configuration works for both Kiro IDE and Kiro CLI:
# Interactive
kiro-cli chat
# Headless (for scripts and pipelines)
kiro-cli chat --no-interactive --trust-tools=read \
"What's our circuit breaker pattern?"
The --no-interactive runs without a session, and – --trust-tools=read auto-approves read-only tool calls (like QueryKnowledgeBases) without prompting. Headless mode requires the KIRO_API_KEY environment variable. To generate an API key, follow the steps in the Kiro Documentation.
Use headless mode in CI/CD pipelines to validate generated code against team standards, or in onboarding scripts that walk new developers through your architecture decisions.
Cleanup
The MCP server is an open-source tool; costs apply to the underlying AWS resources (Amazon OpenSearch Serverless, Amazon S3 storage, and Amazon Bedrock API calls). The primary ongoing cost is Amazon OpenSearch Serverless, which charges for OCU (OpenSearch Compute Unit) capacity even when idle. Amazon S3 storage and Amazon Bedrock API calls are pay-per-use. For detailed pricing, see the Amazon S3 Pricing page and Amazon Bedrock Pricing page. Destroy resources when you’re done experimenting:
cd kiro-bedrock-kb-mcp/infrastructure
npx cdk destroy --all
For detailed cleanup instructions, see the repository README.
Conclusion
In this blog post, we showed how to connect Amazon Bedrock Knowledge Bases to Kiro through MCP, turning organizational documentation into an in-editor knowledge assistant. This integration addresses the challenges outlined at the beginning of this post:
- No more context switching – Developers query coding standards, API specs, and architecture decisions without leaving their editor
- Unified knowledge access – A single MCP configuration connects to multiple Knowledge Bases, regardless of where the original documents live
- Faster onboarding – New team members get cited answers to questions quickly, without navigating unfamiliar documentation systems
- Proactive standards enforcement — Team standards surface during development rather than after a code review catches a violation.
Two paths to get started:
- Existing Knowledge Base – Tag it with
mcp-multirag-kb=true, add the MCP configuration to Kiro, and start querying after few minutes. - Starting fresh – Deploy the sample infrastructure using the repository, upload your team documents, and connect.
Your documentation already held the answers. Now developers get them quickly, without leaving their workflow.