Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Amazon Q Web Documentation ReaderHow do I set up environment variables in a Next.js app? Documentation: https://nextjs.org/docs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
π Amazon Q Web Documentation Reader
MCP Server for Intelligent Web Content Extraction
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
π― 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
Python 3.12 or higher
uv (recommended) or pip
Step 1: Clone the Repository
git clone https://github.com/yourusername/amazon-q-web_search.git
cd amazon-q-web_searchStep 2: Install Dependencies
Using uv (Recommended):
uv syncUsing 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.jsonmacOS:
~/.aws/amazonq/mcp.jsonWindows:
%USERPROFILE%\.aws\amazonq\mcp.json
Step 2: Create/Edit the Configuration File
Create the directory if it doesn't exist:
mkdir -p ~/.aws/amazonqEdit 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
Start Amazon Q CLI:
q chatCheck if MCP server is loaded:
/mcpYou should see:
doc_reader - read_web_documentation - get_documentation_links - get_page_structure - extract_code_examples - read_multiple_docsIf not loaded:
Check the file path in
mcp.jsonis correctRestart 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:
β Read the main documentation page
β Extract all available links
β Intelligently identify the "Routes" link
β Navigate to the Routes documentation
β Provide you with accurate information
More Examples
Python Documentation:
Can you explain Python asyncio event loops?
Documentation: https://docs.python.org/3/library/asyncio.htmlFastAPI 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 pageoutput_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 pagefilter_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 |
| 30.0s | Request timeout in seconds |
| 10MB | Maximum content size in bytes |
| Custom | HTTP User-Agent string |
| Various | HTML tags to remove during extraction |
| Various | Selectors for finding main content |
π Troubleshooting
MCP Server Not Loading
Check configuration:
cat ~/.aws/amazonq/mcp.jsonVerify 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.pyCheck Amazon Q logs:
q chat logdumpServer 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 --reinstallConnection Timeout
Increase timeout in settings:
q settings mcp.initTimeout 60000π Dependencies
Package | Purpose |
Async HTTP client for fetching web pages | |
HTML parsing and navigation | |
Fast XML/HTML parser | |
HTML to Markdown conversion | |
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.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)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!