aws-code-examples-mcp

hugh-weston/aws-code-examples-mcp

3.1

If you are the rightful owner of aws-code-examples-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This MCP server provides tools to access AWS code examples, search for content, and get recommendations.

Tools
4
Resources
0
Prompts
0

AWS Docs Code Examples MCP Server

Model Context Protocol (MCP) server for AWS Docs Code Examples

This MCP server provides tools to access AWS code examples, search for content, and get recommendations.

Features

  • Read Documentation: Fetch and convert AWS documentation pages to markdown format
  • Search Documentation: Search AWS documentation using the official search API (global only)
  • Recommendations: Get content recommendations for AWS documentation pages (global only)
  • Search Code Examples: Search for AWS code examples across all services and programming languages
  • Read Code Examples: Retrieve complete source code and context for specific examples
  • Setup Code Examples: Download and prepare code examples for local development and testing
  • Get Available Services List: Get a list of available AWS services in China regions (China only)

Prerequisites

Installation Requirements

  1. Install uv from Astral or the GitHub README
  2. Install Python 3.10 or newer using uv python install 3.10 (or a more recent version)

Installation

Configure the MCP server in your MCP client configuration (e.g., for Amazon Q Developer CLI, edit ~/.aws/amazonq/mcp.json):

{
  "mcpServers": {
    "aws-code-examples-mcp": {
      "command": "uvx",
      "args": ["/path/to/aws-code-examples-mcp"],
      "env": {
        "FASTMCP_LOG_LEVEL": "ERROR",
        "AWS_DOCUMENTATION_PARTITION": "aws",
        "AWS_REGION": "us-east-1",
        "CODE_EXAMPLES_S3_VECTOR_BUCKET": "code-examples-mcp-demo",
        "CODE_EXAMPLES_S3_VECTOR_INDEX": "text-index",
        "BEDROCK_TEXT_EMBEDDING_MODEL_ID": "amazon.titan-embed-text-v2:0",
        "SAGEMAKER_CODE_EMBEDDING_MODEL_ID": "nomic-embed-code-endpoint",
        "CODE_CONTENT_S3_BUCKET": "code-example-content-partitions"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Note: Set AWS_DOCUMENTATION_PARTITION to aws-cn to query AWS China documentation instead of global AWS documentation.

Basic Usage

Example:

Tools

read_documentation

Fetches an AWS documentation page and converts it to markdown format.

read_documentation(url: str) -> str

search_documentation (global only)

Searches AWS documentation using the official AWS Documentation Search API.

search_documentation(search_phrase: str, limit: int) -> list[dict]

recommend (global only)

Gets content recommendations for an AWS documentation page.

recommend(url: str) -> list[dict]

get_available_services (China only)

Gets a list of available AWS services in China regions.

get_available_services() -> str

Development

Install dependencies:

uv sync --dev

Run tests:

uv run pytest

Run the server:

uv run aws-code-examples-mcp

License

Apache-2.0