bedrock-kb-mcp-server
Allows querying documents stored in an Amazon Bedrock Knowledge Base via semantic search (Retrieve) and multi-hop reasoning (AgenticRetrieveStream), with support for metadata filtering and managed embeddings.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@bedrock-kb-mcp-serversearch for documents about AWS deployment best practices"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Bedrock Managed Knowledge Base with AgentCore MCP Gateway
A CDK project that deploys a fully managed Amazon Bedrock Knowledge Base backed by S3, exposed as an MCP server via AgentCore Gateway. This allows AI assistants like Claude Code and Kiro to query your documents through the standard MCP protocol.
Architecture
┌─────────────┐ ┌───────────────────────┐ ┌──────────────────────┐
│ S3 Bucket │────▶│ Managed Knowledge │────▶│ AgentCore Gateway │
│ (Documents)│ │ Base (Bedrock) │ │ (MCP Server) │
└─────────────┘ │ - Managed embeddings │ │ - Retrieve │
│ - Managed vector store│ │ - AgenticRetrieve │
│ - Managed reranker │ │ Stream │
└───────────────────────┘ └──────────┬───────────┘
│
AWS IAM (SigV4)
│
┌───────────┴───────────┐
│ MCP Clients │
│ (Claude Code, Kiro) │
└───────────────────────┘Related MCP server: Modular RAG MCP Server
Project Structure
bedrock_kb/
├── app.py # CDK app entry point
├── cdk.json # CDK configuration
├── pyproject.toml # Python project (managed by uv)
├── .mcp.json.example # MCP server config template for Claude Code
├── bedrock_kb/
│ ├── __init__.py
│ └── stack.py # CDK stack definition
├── tests/
│ ├── __init__.py
│ └── test_stack.py # Infrastructure tests
└── scripts/
└── sync_and_ingest.sh # Upload docs & trigger ingestionPrerequisites
Python 3.13+
uv (Python package manager)
AWS CDK CLI (
npm install -g aws-cdk)AWS credentials configured (
aws configure)
Deploy
# 1. Bootstrap CDK (one-time per account/region)
cdk bootstrap aws://<ACCOUNT_ID>/us-east-1
# 2. Deploy the stack
uv run cdk deploy --context account=<ACCOUNT_ID> --context region=us-east-1Note the outputs after deployment:
BucketName — where to upload your documents
KnowledgeBaseId — the Bedrock KB identifier
GatewayUrl — the MCP server endpoint
GatewayIdentifier — the gateway ID
Upload Documents and Trigger Ingestion
Place your documents (PDF, TXT, MD, HTML, DOCX, CSV) in a local directory, then:
./scripts/sync_and_ingest.sh ./my-docs/This syncs files to S3 and starts a Bedrock ingestion job. Monitor progress:
aws bedrock-agent get-ingestion-job \
--knowledge-base-id <KB_ID> \
--data-source-id <DS_ID> \
--ingestion-job-id <JOB_ID>Adding metadata for filtering
You can attach metadata to any document by placing a .metadata.json companion file next to it in S3. The metadata file must be named exactly <filename>.metadata.json and sit in the same directory. This enables filtering search results by custom attributes like department, document type, or date.
Folder structure:
my-docs/
├── compliance/
│ ├── company-policy.pdf
│ └── company-policy.pdf.metadata.json
└── technical/
├── architecture-guide.md
└── architecture-guide.md.metadata.jsonMetadata file format (company-policy.pdf.metadata.json):
{
"metadataAttributes": {
"department": "HR",
"document_type": "Policy",
"year": "2026",
"public": "false"
}
}The metadataAttributes object contains key-value pairs that Bedrock indexes alongside the document content. When querying via the Retrieve tool, you can filter results using these attributes (e.g., only return documents where department = "Engineering").
Connect Claude Code
AgentCore Gateway requires AWS SigV4-signed requests (service bedrock-agentcore). Since Claude Code doesn't natively sign MCP requests with AWS credentials, we use mcp-proxy-for-aws — an AWS-provided stdio MCP proxy that:
Receives MCP requests from Claude Code over stdin/stdout
Signs them with your local AWS credentials (from
~/.aws/credentials, env vars, or SSO)Forwards them to the AgentCore Gateway over HTTPS
Streams responses back to Claude Code
Option A: use it from anywhere (recommended)
Your knowledge base isn't tied to this repo, so register the MCP server at user scope — it becomes available in every project, not just this one. Use uvx (not uv run) so the proxy runs standalone without needing this project's venv:
claude mcp add bedrock-kb --scope user -- uvx mcp-proxy-for-aws https://<GATEWAY_URL>/mcp --region us-east-1Replace <GATEWAY_URL> with the GatewayUrl output from your deploy. This is stored in your global Claude config (~/.claude.json), so re-run the command (it overwrites) any time you redeploy and the Gateway URL changes.
Option B: scope it to this project only
Copy the included .mcp.json.example template to .mcp.json and fill in the GatewayUrl output:
cp .mcp.json.example .mcp.json
# then edit .mcp.json, replacing <GATEWAY_URL> with the GatewayUrl output value.mcp.json is gitignored since it embeds an account/region-specific endpoint. With this option Claude Code only loads the server when run inside this directory, and you'll need to approve the bedrock-kb MCP server when prompted.
IAM permissions for the caller
Your IAM identity (user or role) needs permission to invoke the gateway:
{
"Effect": "Allow",
"Action": "bedrock-agentcore:InvokeGateway",
"Resource": "arn:aws:bedrock-agentcore:us-east-1:<ACCOUNT>:gateway/<GATEWAY_ID>"
}Exposed MCP Tools
Once connected, your MCP client will have access to two tools:
Tool | Description |
| Simple semantic search — returns relevant document chunks |
| Advanced multi-hop reasoning with managed reranking — recursively decomposes complex queries |
Run Tests
uv run pytest tests/ -vDestroy
uv run cdk destroy --context account=<ACCOUNT_ID> --context region=us-east-1This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceAn MCP server implementation that provides tools for retrieving and processing documentation through vector search, enabling AI assistants to augment their responses with relevant documentation context23265MIT
- Alicense-qualityBmaintenanceConverts unstructured documents into a searchable knowledge base and exposes retrieval tools via MCP protocol for AI agents to query.MIT
- Alicense-qualityDmaintenanceEnables Claude Desktop to search custom knowledge bases using retrieval-augmented generation via a simple MCP tool.MIT
- Flicense-qualityDmaintenanceEnables AI assistants to intelligently search and reference documentation using hybrid semantic + keyword search via MCP protocol.
Related MCP Connectors
Real-time Amazon, WIPO & PACER data for AI agents — 19 tools via the MCP protocol.
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
Agentic search over your Dewey document collections from any MCP-compatible client.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/lorenzomicheli/bedrock-kb-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server