AWS Bedrock: Knowledge Base MCP server

Query and retrieve information from AWS knowledge bases using the Bedrock Agent Runtime.
Back to servers
Provider
Anthropic
Release date
Nov 19, 2024
Language
TypeScript
Package
Stats
40.6K stars

The AWS Knowledge Base Retrieval MCP Server allows you to access and retrieve information from AWS Knowledge Bases using the Bedrock Agent Runtime. It implements the Model Context Protocol (MCP) to enable AI assistants to search and retrieve context from your AWS knowledge base.

Features

  • RAG (Retrieval-Augmented Generation): Retrieve context from the AWS Knowledge Base based on a query and a Knowledge Base ID
  • Customizable results: Option to retrieve a configurable number of results
  • Easy integration: Works with Claude Desktop and VS Code

Installation

Prerequisites

Before installation, you'll need:

  1. AWS access key ID
  2. AWS secret access key
  3. AWS region
  4. Appropriate permissions for Bedrock Agent Runtime operations

Installation for Claude Desktop

Add the MCP server configuration to your claude_desktop_config.json file using one of the following methods:

Using Docker

{
  "mcpServers": {
    "aws-kb-retrieval": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "AWS_ACCESS_KEY_ID",
        "-e",
        "AWS_SECRET_ACCESS_KEY",
        "-e",
        "AWS_REGION",
        "mcp/aws-kb-retrieval-server"
      ],
      "env": {
        "AWS_ACCESS_KEY_ID": "YOUR_ACCESS_KEY_HERE",
        "AWS_SECRET_ACCESS_KEY": "YOUR_SECRET_ACCESS_KEY_HERE",
        "AWS_REGION": "YOUR_AWS_REGION_HERE"
      }
    }
  }
}

Using NPX

{
  "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_REGION": "YOUR_AWS_REGION_HERE"
      }
    }
  }
}

Installation for VS Code

Manual Installation

To manually install in VS Code, add the server configuration to your User Settings (JSON) file:

  1. Press Ctrl + Shift + P and type Preferences: Open Settings (JSON)
  2. Add the following configuration:
{
  "mcp": {
    "inputs": [
      {
        "type": "promptString",
        "id": "aws_access_key",
        "description": "AWS Access Key ID",
        "password": true
      },
      {
        "type": "promptString",
        "id": "aws_secret_key",
        "description": "AWS Secret Access Key",
        "password": true
      },
      {
        "type": "promptString",
        "id": "aws_region",
        "description": "AWS Region"
      }
    ],
    "servers": {
      "aws-kb-retrieval": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-aws-kb-retrieval"],
        "env": {
          "AWS_ACCESS_KEY_ID": "${input:aws_access_key}",
          "AWS_SECRET_ACCESS_KEY": "${input:aws_secret_key}",
          "AWS_REGION": "${input:aws_region}"
        }
      }
    }
  }
}

Alternatively, you can add this configuration to a file called .vscode/mcp.json in your workspace (omit the mcp root key in this case).

Usage

Once installed, you can use the AWS Knowledge Base Retrieval server through the following tool:

retrieve_from_aws_kb

This tool performs retrieval operations using the AWS Knowledge Base.

Inputs:

  • 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)

Example usage:

When using Claude with the MCP server configured, you can ask it to retrieve information from your AWS Knowledge Base:

Please use the retrieve_from_aws_kb tool to search for information about EC2 instances in my AWS Knowledge Base with ID kb-12345abcde.

The AI assistant will then use the tool with appropriate parameters:

retrieve_from_aws_kb(
  query: "EC2 instances",
  knowledgeBaseId: "kb-12345abcde",
  n: 3
)

The results retrieved from the AWS Knowledge Base will be incorporated into the AI assistant's response.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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