Skip to main content
Glama
tatn

MCP Server Fetch Python

by tatn

get-rendered-html

Fetch fully rendered HTML from a URL, including JavaScript-generated content, for web pages requiring client-side rendering. Ideal for SPAs and dynamic web applications.

Instructions

Fetches fully rendered HTML content using a headless browser, including JavaScript-generated content. Essential for modern web applications, single-page applications (SPAs), or any content that requires client-side rendering to be complete.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the target web page (ordinary HTML including JavaScript, etc.).

Implementation Reference

  • Core handler function that executes the tool logic: launches a headless Chromium browser using Playwright, navigates to the provided URL, retrieves the fully rendered HTML content, and returns it as a string.
    async def get_parsed_html_string_by_playwright(url:str)->str:
        
        async with async_playwright() as p:
            browser = await p.chromium.launch()
            page = await browser.new_page()
            await page.goto(url)
            parsed_html = await page.content()
            await browser.close()
            return parsed_html
  • Dispatch logic in the main @server.call_tool() handler that invokes the specific implementation for 'get-rendered-html'.
    elif name == "get-rendered-html":
        parsed_html = await get_parsed_html_string_by_playwright(url)
        result_string = str(parsed_html)
  • Registers the 'get-rendered-html' tool in the MCP server's list_tools(), including name, description, and input schema.
     types.Tool(
        name="get-rendered-html",
        description="Fetches fully rendered HTML content using a headless browser, including JavaScript-generated content. Essential for modern web applications, single-page applications (SPAs), or any content that requires client-side rendering to be complete.",  # noqa: E501
        inputSchema={
            "type": "object",
            "properties": {
                "url": {"type": "string", "description":"URL of the target web page (ordinary HTML including JavaScript, etc.)."}  # noqa: E501
            },
            "required": ["url"],
        },
    ),
  • JSON schema defining the tool's input: an object with a required 'url' string property.
    inputSchema={
        "type": "object",
        "properties": {
            "url": {"type": "string", "description":"URL of the target web page (ordinary HTML including JavaScript, etc.)."}  # noqa: E501
        },
        "required": ["url"],
    },
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tatn/mcp-server-fetch-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server