Home / MCP / AWS KB Retrieval MCP Server

AWS KB Retrieval MCP Server

Provides access to AWS Knowledge Base data using RAG with configurable knowledge bases and result counts.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "aws_kb_docker": {
            "command": "docker",
            "args": [
                "run",
                "-i",
                "--rm",
                "-e",
                "AWS_ACCESS_KEY_ID",
                "-e",
                "AWS_SECRET_ACCESS_KEY",
                "-e",
                "AWS_REGION",
                "-e",
                "AWS_KB_IDS",
                "mcp/aws-kb-retrieval-server"
            ],
            "env": {
                "AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
                "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
                "AWS_SESSION_TOKEN": "YOUR_SESSION_TOKEN",
                "AWS_REGION": "YOUR_AWS_REGION_HERE",
                "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
            }
        }
    }
}

This MCP server enables Retrieval-Augmented Generation (RAG) against the AWS Knowledge Base using the Bedrock Agent Runtime. You provide a query and a Knowledge Base ID, and the server returns both raw context and structured metadata about the sources, helping you build informed responses from AWS knowledge sources.

How to use

You interact with the AWS Knowledge Base Retrieval MCP Server through an MCP client. You can query a specific knowledge base and request a configurable number of results. The server returns the raw context from the knowledge base alongside a structured set of sources with metadata, so you can display, filter, or rank results in your application.

Typical usage patterns include querying with a specific topic, selecting a knowledge base by ID, and choosing how many results to fetch. The results help you deliver contextually relevant information to users, support agents, or decision-makers by augmenting your responses with verifiable knowledge from AWS.

How to install

Prerequisites: you need Docker installed or you can run the MCP server locally via NPX or a local Node build. You also need access to AWS credentials if you intend to call AWS services.

Option A: Docker (recommended for quick start) - build and run the MCP server image.

docker build -t mcp/aws-kb-retrieval -f src/aws-kb-retrieval-server/Dockerfile .

Run the server with AWS credentials provided as environment variables. This example uses IAM Access Keys and a specific Knowledge Base IDs list.

docker run -i --rm \
  -e AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY_HERE \
  -e AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY_HERE \
  -e AWS_REGION=YOUR_AWS_REGION_HERE \
  -e AWS_KB_IDS=["kb-12345", "kb-67890"] \
  mcp/aws-kb-retrieval-server

Option B: NPX with IAM Access Keys - run the MCP server without building a Docker image.

npx -y @modelcontextprotocol/server-aws-kb-retrieval

Set the required environment variables in your shell or in your MCP client configuration, for example AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, and AWS_KB_IDS, if you want to specify default knowledge bases.

Option C: Local repository usage - start the server from a built dist/index.js file.

node /path/to/mcp-aws-kb/dist/index.js

Configuration and credentials notes

You can use one or more knowledge base IDs by setting AWS_KB_IDS to a JSON array of IDs. When provided, knowledgeBaseId becomes optional in the tool call.

If you use AWS SSO, ensure your AWS_REGION is configured and that your shell environment provides AWS credentials via the default provider chain (including SSO). For SSO, only set the AWS_REGION in the MCP configuration and rely on the AWS CLI SSO profile for credentials.

Tools and capabilities

retrieve_from_aws_kb - Performs retrieval operations against the AWS Knowledge Base. Input: query, knowledgeBaseId, and optional n for the number of results. Output includes a raw context text and a structured JSON with metadata for each source (id, fileName, snippet, score). This separation enables flexible downstream processing and presentation.

Available tools

retrieve_from_aws_kb

Performs retrieval operations against the AWS Knowledge Base. Accepts query, knowledgeBaseId, and optional n for the number of results. Returns raw context text and a separate JSON with structured RAG sources (id, fileName, snippet, score).