AWS Knowledge Base MCP server

Integrates with AWS Knowledge Bases to retrieve information using Bedrock Agent Runtime, enabling RAG operations with structured metadata for organizational knowledge access.
Back to servers
Setup instructions
Provider
Sam McLeod
Release date
Mar 13, 2025
Language
TypeScript

The AWS Knowledge Base Retrieval MCP Server provides access to AWS Knowledge Base information through Bedrock Agent Runtime, enabling retrieval-augmented generation (RAG) capabilities for Claude and other AI models that support the Model Context Protocol.

Installation Options

Docker Installation

You can run the MCP server using Docker with either IAM Access Keys or AWS SSO authentication.

Using IAM Access Keys

{
  "mcpServers": {
    "aws-kb-retrieval": {
      "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_OPTIONAL_SESSION_ID_FOR_SSO_TEMPORARY_CREDENTIALS_HERE",
        "AWS_REGION": "YOUR_AWS_REGION_HERE",
        "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
      }
    }
  }
}

Using AWS SSO

{
  "mcpServers": {
    "aws-kb-retrieval": {
      "command": "docker",
      "args": [ "run", "-i", "--rm", "-e", "AWS_REGION", "-e", "AWS_KB_IDS", "-v", "${HOME}/.aws:/root/.aws", "mcp/aws-kb-retrieval-server" ],
      "env": {
        "AWS_REGION": "YOUR_AWS_REGION_HERE",
        "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
      }
    }
  }
}

NPX Installation

Alternatively, you can install and run the server using NPX.

Using IAM Access Keys

{
  "mcpServers": {
    "aws-kb-retrieval": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-aws-kb-retrieval"
      ],
      "env": {
        "AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
        "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
        "AWS_SESSION_TOKEN": "YOUR_OPTIONAL_SESSION_ID_FOR_SSO_TEMPORARY_CREDENTIALS_HERE",
        "AWS_REGION": "YOUR_AWS_REGION_HERE",
        "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
      }
    }
  }
}

Using AWS SSO

{
  "mcpServers": {
    "aws-kb-retrieval": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-aws-kb-retrieval"
      ],
      "env": {
        "AWS_REGION": "YOUR_AWS_REGION_HERE",
        "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
      }
    }
  }
}

Local Repository Installation

If you've cloned and built the repository locally:

{
  "mcpServers": {
    "aws-kb": {
      "command": "node",
      "args": [
        "/path/to/mcp-aws-kb/dist/index.js"
      ],
      "env": {
        "AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
        "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
        "AWS_SESSION_TOKEN": "YOUR_OPTIONAL_SESSION_ID_FOR_SSO_TEMPORARY_CREDENTIALS_HERE",
        "AWS_REGION": "YOUR_AWS_REGION_HERE",
        "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
      },
      "disabled": false,
      "autoApprove": [
        "retrieve_from_aws_kb"
      ],
      "timeout": 120
    }
  }
}

Setting Up AWS Credentials

Option 1: IAM Access Keys

  1. Obtain AWS access key ID, secret access key, and region from the AWS Management Console
  2. Ensure these credentials have appropriate permissions for Bedrock Agent Runtime operations
  3. Set the environment variables in your configuration as shown above
  4. For temporary credentials, include the session token using AWS_SESSION_TOKEN

Option 2: AWS SSO (Single Sign-On)

  1. Configure AWS CLI with your SSO profile: aws configure sso
  2. Set only the AWS_REGION environment variable in the MCP server configuration
  3. The server will use the default credential provider chain, which includes SSO credentials

Configuring Knowledge Base IDs

You can specify default knowledge base IDs to use with the retrieval tool:

  1. Create an array of knowledge base IDs in JSON format
  2. Set this as the AWS_KB_IDS environment variable in your configuration
  3. When configured, the knowledgeBaseId parameter becomes optional when using the tool

Using the Retrieval Tool

The server provides a tool called retrieve_from_aws_kb with the following parameters:

  • query (string): The search query for retrieval
  • knowledgeBaseId (string): The ID of the AWS Knowledge Base
  • n (number, optional): Number of results to retrieve (default: 3)

The response returns two items:

  • A text item containing the raw context from the knowledge base
  • A JSON item with structured RAG sources including metadata (id, fileName, snippet, and score)

Building from Source

If you need to build the Docker image from source:

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

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "aws-kb-retrieval" '{"command":"npx","args":["-y","@modelcontextprotocol/server-aws-kb-retrieval"],"env":{"AWS_ACCESS_KEY_ID":"YOUR_ACCESS_KEY_HERE","AWS_SECRET_ACCESS_KEY":"YOUR_SECRET_ACCESS_KEY_HERE","AWS_SESSION_TOKEN":"YOUR_OPTIONAL_SESSION_ID_FOR_SSO_TEMPORARY_CREDENTIALS_HERE","AWS_REGION":"YOUR_AWS_REGION_HERE","AWS_KB_IDS":"[\"kb-12345\", \"kb-67890\"]"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "aws-kb-retrieval": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-aws-kb-retrieval"
            ],
            "env": {
                "AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
                "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
                "AWS_SESSION_TOKEN": "YOUR_OPTIONAL_SESSION_ID_FOR_SSO_TEMPORARY_CREDENTIALS_HERE",
                "AWS_REGION": "YOUR_AWS_REGION_HERE",
                "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "aws-kb-retrieval": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-aws-kb-retrieval"
            ],
            "env": {
                "AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
                "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
                "AWS_SESSION_TOKEN": "YOUR_OPTIONAL_SESSION_ID_FOR_SSO_TEMPORARY_CREDENTIALS_HERE",
                "AWS_REGION": "YOUR_AWS_REGION_HERE",
                "AWS_KB_IDS": "[\"kb-12345\", \"kb-67890\"]"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later