Skip to main content
Glama
Amazon Q Web Documentation Reader

Amazon Q Web Documentation Reader

🌐 Amazon Q Web Documentation Reader

MCP Server for Intelligent Web Content Extraction

Python MCP License

Features β€’ Installation β€’ Setup β€’ Usage β€’ Tools


✨ Features

  • 🧠 Intelligent Navigation - Amazon Q (Claude 4.5) decides which documentation pages to visit

  • 🧹 Clean Content Extraction - Removes navigation, ads, scripts, and other non-content elements

  • πŸ“ Multiple Output Formats - Supports both Markdown and plain text output

  • πŸ’» Code Block Extraction - Specifically extracts code examples from documentation

  • πŸ“Š Page Structure Analysis - Extracts heading hierarchy and table of contents

  • πŸ”— Link Discovery - Finds and filters documentation links

  • πŸ“š Batch Processing - Read multiple documentation pages at once


Related MCP server: Nexus MCP Server

🎯 How It Works

User: "I'm having issues with Razorpay routes"
      Documentation: https://razorpay.com/docs

Amazon Q (Claude 4.5):
  1. Reads main docs page
  2. Sees links: ["Payments", "Routes", "Webhooks", ...]
  3. Intelligently decides: "Routes link is relevant!"
  4. Navigates to Routes documentation
  5. Extracts content and solves your problem

All navigation decisions = Amazon Q's Claude brain 🧠
MCP Server = Clean content extraction tool πŸ› οΈ

πŸ“¦ Installation

Prerequisites

Step 1: Clone the Repository

git clone https://github.com/yourusername/amazon-q-web_search.git
cd amazon-q-web_search

Step 2: Install Dependencies

Using uv (Recommended):

uv sync

Using pip:

pip install -e .

πŸ”§ Setup with Amazon Q

Step 1: Locate Your MCP Configuration File

Amazon Q looks for MCP server configuration in:

  • Linux/WSL: ~/.aws/amazonq/mcp.json

  • macOS: ~/.aws/amazonq/mcp.json

  • Windows: %USERPROFILE%\.aws\amazonq\mcp.json

Step 2: Create/Edit the Configuration File

Create the directory if it doesn't exist:

mkdir -p ~/.aws/amazonq

Edit or create ~/.aws/amazonq/mcp.json:

For Linux/WSL:

{
  "mcpServers": {
    "doc_reader": {
      "command": "/full/path/to/amazon-q-web_search/.venv/bin/python",
      "args": ["/full/path/to/amazon-q-web_search/main.py"]
    }
  }
}

For macOS:

{
  "mcpServers": {
    "doc_reader": {
      "command": "/full/path/to/amazon-q-web_search/.venv/bin/python",
      "args": ["/full/path/to/amazon-q-web_search/main.py"]
    }
  }
}

For Windows:

{
  "mcpServers": {
    "doc_reader": {
      "command": "C:\\full\\path\\to\\amazon-q-web_search\\.venv\\Scripts\\python.exe",
      "args": ["C:\\full\\path\\to\\amazon-q-web_search\\main.py"]
    }
  }
}

πŸ’‘ Tip: Replace /full/path/to/ with the actual path where you cloned the repository.

Step 3: Verify Installation

  1. Start Amazon Q CLI:

    q chat
  2. Check if MCP server is loaded:

    /mcp

    You should see:

    doc_reader
      - read_web_documentation
      - get_documentation_links
      - get_page_structure
      - extract_code_examples
      - read_multiple_docs
  3. If not loaded:

    • Check the file path in mcp.json is correct

    • Restart Amazon Q CLI

    • Check logs: q chat logdump


πŸš€ Usage

Basic Example

In Amazon Q CLI, simply ask about documentation:

I'm having issues with Razorpay routes. Can you help me understand how they work?
Documentation: https://razorpay.com/docs/

Amazon Q will:

  1. βœ… Read the main documentation page

  2. βœ… Extract all available links

  3. βœ… Intelligently identify the "Routes" link

  4. βœ… Navigate to the Routes documentation

  5. βœ… Provide you with accurate information

More Examples

Python Documentation:

Can you explain Python asyncio event loops?
Documentation: https://docs.python.org/3/library/asyncio.html

FastAPI Tutorial:

How do I create a basic FastAPI application?
Documentation: https://fastapi.tiangolo.com/

AWS Lambda:

How do I create a Lambda function with Python?
Documentation: https://docs.aws.amazon.com/lambda/

πŸ›  Available Tools

Amazon Q intelligently chains these tools to navigate documentation:

1. read_web_documentation

Fetches and extracts clean documentation content from a web page.

Parameters:

  • url (required): The URL of the documentation page

  • output_format (optional): "markdown" (default) or "text"

Returns: Extracted documentation content with title and metadata


2. get_documentation_links

Extracts all links from a documentation page with optional filtering.

Parameters:

  • url (required): The URL of the documentation page

  • filter_pattern (optional): Pattern to filter links (e.g., "api", "guide")

Returns: List of links found on the page


3. get_page_structure

Extracts the heading structure and table of contents from a documentation page.

Parameters:

  • url (required): The URL of the documentation page

Returns: Hierarchical structure of headings on the page


4. extract_code_examples

Extracts all code blocks from a documentation page.

Parameters:

  • url (required): The URL of the documentation page

Returns: All code blocks found with their detected languages


5. read_multiple_docs

Reads multiple documentation pages and combines their content.

Parameters:

  • urls (required): List of documentation URLs (max 10)

Returns: Combined content from all pages


πŸ“ Project Structure

amazon-q-web_search/
β”œβ”€β”€ main.py              # Entry point
β”œβ”€β”€ pyproject.toml       # Project configuration
β”œβ”€β”€ README.md            # This file
β”œβ”€β”€ run_mcp.sh           # Startup script (Linux/macOS)
└── src/
    β”œβ”€β”€ __init__.py      # Package initialization
    β”œβ”€β”€ server.py        # MCP server initialization
    β”œβ”€β”€ config.py        # Configuration constants
    β”œβ”€β”€ fetcher.py       # HTTP fetching logic
    β”œβ”€β”€ extractor.py     # HTML content extraction
    β”œβ”€β”€ formatters.py    # Output formatting
    └── tools.py         # MCP tool definitions

βš™οΈ Configuration

Edit src/config.py to customize behavior:

Setting

Default

Description

HTTP_TIMEOUT

30.0s

Request timeout in seconds

MAX_CONTENT_LENGTH

10MB

Maximum content size in bytes

USER_AGENT

Custom

HTTP User-Agent string

REMOVE_TAGS

Various

HTML tags to remove during extraction

CONTENT_SELECTORS

Various

Selectors for finding main content


πŸ› Troubleshooting

MCP Server Not Loading

Check configuration:

cat ~/.aws/amazonq/mcp.json

Verify paths are correct:

  • Use absolute paths, not relative

  • Check that Python executable exists

  • Check that main.py exists

Test server manually:

cd /path/to/amazon-q-web_search
.venv/bin/python main.py

Check Amazon Q logs:

q chat logdump

Server Starts But Tools Don't Work

Verify dependencies are installed:

cd /path/to/amazon-q-web_search
.venv/bin/python -c "import httpx, bs4, markdownify; print('OK')"

Reinstall dependencies:

uv sync --reinstall

Connection Timeout

Increase timeout in settings:

q settings mcp.initTimeout 60000

πŸ“š Dependencies

Package

Purpose

httpx

Async HTTP client for fetching web pages

beautifulsoup4

HTML parsing and navigation

lxml

Fast XML/HTML parser

markdownify

HTML to Markdown conversion

mcp

Model Context Protocol SDK


⚠️ Limitations

Limit

Value

Maximum content size

10MB per page

Maximum URLs per batch

10

Request timeout

30 seconds

Content type

HTML only


🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository

  2. Create your feature branch (git checkout -b feature/AmazingFeature)

  3. Commit your changes (git commit -m 'Add some AmazingFeature')

  4. Push to the branch (git push origin feature/AmazingFeature)

  5. Open a Pull Request


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ’¬ Support

  • πŸ“« Open an Issue for bug reports or feature requests

  • ⭐ Star this repo if you find it useful!


Available Tools

5 tools
extract_code_examplesA
Extracts all code examples/blocks from a documentation page.

This tool specifically targets code blocks in documentation, useful for
finding implementation examples, snippets, and code samples.

Args:
    url: The URL of the documentation page

Returns:
    All code blocks found on the page with their detected languages

Inputs: url (required). Returns: result

get_page_structureA
Extracts the heading structure and table of contents from a documentation page.

This tool helps understand the organization of a documentation page by
extracting all headings and their hierarchy.

Args:
    url: The URL of the documentation page

Returns:
    Hierarchical structure of headings on the page

Inputs: url (required). Returns: result

read_multiple_docsA
Reads multiple documentation pages and combines their content.

This tool fetches and extracts content from multiple URLs, useful when
documentation is spread across several pages.

Args:
    urls: List of documentation URLs to read

Returns:
    Combined content from all pages

Inputs: urls (required). Returns: result

read_web_documentationA
Fetches and extracts clean documentation content from a web page.

This tool is designed to read documentation websites and extract the main
content in a clean, readable format suitable for analysis.

Args:
    url: The URL of the documentation page to read
    output_format: Output format - "markdown" (default) or "text"

Returns:
    Extracted documentation content with title and metadata

Inputs: url (required), output_format. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool targets a distinct aspect of documentation: code blocks, links, page structure, single page content, and multiple pages. Descriptions clearly differentiate them, avoiding overlap.

    Naming Consistency5/5

    All tool names use snake_case with a clear verb_noun pattern (e.g., extract_code_examples, get_documentation_links), providing a predictable and consistent naming scheme.

    Tool Count5/5

    With 5 tools, the server is well-scoped: it covers all essential operations for documentation reading (single/multiple pages, code, links, structure) without unnecessary extras.

    Completeness5/5

    The tool set covers the core functionalities needed for a documentation reader: content extraction, structure, links, and code examples. Minor features like search are absent but not essential for the stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      Not graded
      maintenance
      Enables hybrid web search and intelligent content extraction, combining semantic search with documentation-optimized reading that strips noise and returns clean, token-efficient context for AI agents.
      2
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to crawl websites, extract and store web content with semantic search capabilities using vector embeddings, and retrieve information through natural language queries with tag-based filtering and intelligent content cleaning.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables crawling and extracting clean content from documentation websites with optional LLM-powered analysis for intelligent summaries, code example extraction, and content classification.
      -