Amazon Q Web Documentation Reader

Amazon Q Web Documentation Reader

Enables intelligent navigation and extraction of documentation from websites, allowing Amazon Q to automatically discover relevant pages, extract clean content, and retrieve code examples from web documentation.

Category
访问服务器

README

<div align="center">

🌐 Amazon Q Web Documentation Reader

MCP Server for Intelligent Web Content Extraction

Python MCP License

<p align="center"> <strong>A Model Context Protocol (MCP) server that enables Amazon Q to intelligently navigate and extract documentation from websites.</strong> <br> <em>Amazon Q uses Claude 4.5 to make smart decisions about which pages to visit and what content to extract.</em> </p>

Features • Installation • Setup • Usage • Tools

</div>


✨ 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

🎯 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!

<div align="center"> <sub>Built with ❤️ for Amazon Q Developer</sub> </div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选