Registry / aws / awslabs-bedrock-kb-retrieval-mcp-server

awslabs-bedrock-kb-retrieval-mcp-server

JSON →
library1.0.22pypypiunverified

The `awslabs-bedrock-kb-retrieval-mcp-server` library provides an AWS Labs Model Context Protocol (MCP) server specifically designed for integrating with Amazon Bedrock Knowledge Bases. It allows other MCP-compliant applications to retrieve information from a Bedrock Knowledge Base via a standard HTTP API. As part of the AWS Labs ecosystem, it typically receives updates driven by Bedrock feature enhancements and MCP protocol evolution, currently at version 1.0.19.

pip install awslabs-bedrock-kb-retrieval-mcp-server
INSTALL
IMPORT
SIG · AWSLABS-BEDROCK-KB
A
awslabs-bedrock-kb-retrieval-mcp-server
awspythonv1.0.22
Install
9.4s avg
Import
Disk
104MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.22 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 11.05s
py 3.11
✓ —
✓ 9.75s
py 3.12
✓ —
✓ 8.55s
py 3.13
✓ —
✓ 8.2s
py 3.9
✕ build_error
✕ build_error
104MB installed
● package 104MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BedrockKBRetrievalMCPServer
from awslabs.bedrock_kb_retrieval_mcp_server.server import BedrockKBRetrievalMCPServer
from awslabs.bedrock_kb_retrieval_mcp_server.server import BedrockKBRetrievalMCPServer

This quickstart demonstrates how to instantiate and run the `BedrockKBRetrievalMCPServer` using Uvicorn. It requires AWS credentials configured in the environment or AWS shared credentials file, and a valid Amazon Bedrock Knowledge Base ID. The server will expose an HTTP endpoint for MCP retrieval requests.

import os import uvicorn from bedrock_kb_retrieval_mcp_server.server import BedrockKBRetrievalMCPServer # --- Configuration --- # # Ensure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION are set in your environment # or via ~/.aws/credentials. You also need a Bedrock Knowledge Base ID. KNOWLEDGE_BASE_ID = os.environ.get("BEDROCK_KB_ID", "YOUR_KNOWLEDGE_BASE_ID") REGION_NAME = os.environ.get("AWS_REGION", "us-east-1") # e.g., 'us-east-1', 'us-west-2' if KNOWLEDGE_BASE_ID == "YOUR_KNOWLEDGE_BASE_ID": print("WARNING: BEDROCK_KB_ID environment variable not set. Using placeholder.") print("Please set BEDROCK_KB_ID to a valid Amazon Bedrock Knowledge Base ID.") exit(1) print(f"Initializing Bedrock KB Retrieval MCP Server for KB ID: {KNOWLEDGE_BASE_ID}") print(f"In AWS Region: {REGION_NAME}") # Initialize the server instance try: server = BedrockKBRetrievalMCPServer( knowledge_base_id=KNOWLEDGE_BASE_ID, region_name=REGION_NAME ) # Get the FastAPI application instance fastapi_app = server.get_fastapi_app() # Run the server using Uvicorn # The server will be accessible at http://127.0.0.1:8000 if __name__ == "__main__": print("Starting Uvicorn server on http://127.0.0.1:8000") uvicorn.run(fastapi_app, host="127.0.0.1", port=8000) except Exception as e: print(f"Error initializing or running server: {e}") print("Ensure AWS credentials, region, and Bedrock Knowledge Base ID are correctly configured.")
Debug
Known issues
gotchaIncorrect AWS IAM Permissions: The server requires appropriate IAM permissions to interact with Bedrock Knowledge Bases and associated resources (e.g., S3 buckets for data sources).
fix
Ensure the AWS principal (user/role) running the server has `bedrock:Retrieve`, `bedrock:InvokeModel` (if using custom models), and `s3:GetObject` (for any S3 buckets used by the knowledge base) permissions for the relevant resources.
affects: All versions
gotchaInvalid or Mismatched Knowledge Base ID/Region: Providing a Knowledge Base ID that does not exist, is in a different region, or is not accessible can lead to `ResourceNotFoundException` errors.
fix
Verify that the `knowledge_base_id` and `region_name` provided to `BedrockKBRetrievalMCPServer` constructor are correct and correspond to an accessible Bedrock Knowledge Base in the specified region. Check the Bedrock console for the exact ID and region.
affects: All versions
gotchaAWS Credentials Not Found or Expired: The `boto3` library used internally relies on standard AWS credential provider chain. If credentials are missing, malformed, or expired, the server will fail to connect to AWS services.
fix
Ensure AWS credentials (e.g., `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`) are correctly set as environment variables, or configured in `~/.aws/credentials` or IAM instance profiles/roles for EC2/ECS/EKS deployments.
affects: All versions
Upgrade
Version history
1.0.22latest on PyPI · released May 9, 2026
Audit
Dependencies
mcprequiredCore dependency for Model Context Protocol implementation.
boto3requiredAWS SDK for Python, required for interacting with AWS Bedrock and other services.
langchainrequiredUsed for internal retrieval and processing logic.
fastapirequiredWeb framework used to build the server's API.
uvicornrequiredASGI server for running the FastAPI application.
pydanticrequiredData validation and settings management.
python-dotenvoptionalEnvironment variable loading, often used for configuration.
Agent activity
28 hits · last 30 days
node
26
OpenAI (training)
1
Resources
awslabs-bedrock-kb-retrieval-mcp-server — pip install awslabs-bedrock-kb-retrieval-mcp-server · libregistry