page2md-mcp
Page2MD
Paste a URL, get the page's real content back as clean Markdown — headings, links, images, lists, code blocks and tables, with nav and footer chrome stripped. Built for RAG pipelines and LLM workflows, and for agents that read documentation: tabbed and collapsible panels are converted in full, not just the visible one, and every result carries a completeness report so missing or cut content is never silent.
Pure Python standard library — no dependencies, nothing to pip install.
MCP server
This repo is a Model Context Protocol (MCP) server: mcp_server.py
speaks MCP over stdio (JSON-RPC, protocol version 2024-11-05) using only
the Python standard library — no MCP SDK required. It exposes one tool,
implemented on top of the local converter in converter.py:
Tool | Input | Output |
|
|
|
Run it directly:
python3 mcp_server.pyOr with Docker (a Dockerfile is included, python:3.12-slim, no installs):
docker build -t page2md .
docker run -i page2mdAdd it to any MCP client (e.g. Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"page2md": {
"command": "python3",
"args": ["/path/to/page2md-mcp/mcp_server.py"],
"env": { "PAGE2MD_RAPIDAPI_KEY": "your_key_here" }
}
}
}The PAGE2MD_RAPIDAPI_KEY env var is optional — without it the free
local converter runs; with it, conversions go to the hosted Page2MD API
on RapidAPI (see "Deep mode" below).
Related MCP server: web2md-mcp
The completeness report
Most converters silently return only the visible tab of a tabbed docs page — the other panels exist in the HTML but never reach your RAG index, and nothing tells you they were dropped. Page2MD walks the whole document regardless of visibility and reports what it found:
"completeness": {
"panels_found": 5,
"panels_included": 5,
"truncated": false,
"notes": ["page contains 5 tabbed/collapsible panel(s); 5 included in full"]
}panels_found/panels_included—role="tabpanel"elements, tab-panel classes and<details>blocks, and how many of them made it into the Markdown.truncated— output is capped at 200,000 characters; if a page converts to more, the Markdown is cut at a line boundary and this flag (plus a note) says so. A truncated result never pretends to be complete.
What the local converter handles
Headings, paragraphs, links (relative URLs resolved), images (alt text + resolved
src), nested ordered/unordered lists, blockquotes, inline code, fencedpreblocks, simple pipe tables (pipes in cells escaped), definition lists,<details>sections.Chrome stripped:
script,style,nav,footer, forms and other non-content elements, plusrole="navigation"/"banner"/"contentinfo"/"search"containers.Lenient parsing: unclosed and mismatched tags do not crash it.
Plain-text responses are returned as-is.
Known limits: no JavaScript execution (content that only exists after client-side rendering is not in the HTML and cannot be converted), tables with merged cells are flattened, and deeply exotic markup may lose formatting. The completeness report covers panels and truncation; it cannot detect content that was never in the served HTML.
Deep mode (hosted API)
export PAGE2MD_RAPIDAPI_KEY=your_key_here
python3 mcp_server.pyWith a key set, url_to_markdown POSTs the URL to the hosted
Page2MD API — the same conversion the production backend serves
(POST /convert with {"url": ...}, returning JSON with
markdown / title / url) — via its RapidAPI gateway:
Env var | Default | Meaning |
| (unset = local mode) | Your RapidAPI key for the Page2MD listing |
|
| Gateway host (the RapidAPI convention for the listing slug |
|
| Endpoint path |
If the hosted call fails, the tool falls back to the local converter and says so in the completeness notes — it never returns an empty shell. Hosted results note that panel-level completeness is determined by the hosted converter.
Get a key on RapidAPI — the hosted API is the Page2MD listing by NewKwLab.
Tests
python3 tests/run_tests.pyRuns the converter and the MCP server against local fixtures only
(a localhost stub server and file:// URLs — no external network):
a tabbed docs page whose hidden panels must all appear, a messy
article with nested lists/tables/code, garbage inputs, a 404, an
oversized page that must report truncation, and full stdio
protocol checks (initialize / tools/list / tools/call).
Use without MCP
import converter
result = converter.url_to_markdown("https://example.com/docs")
print(result["markdown"])
print(result["completeness"])License
MIT
Available Tools
1 toolurl_to_markdownA
Fetch a web page and convert its real content to clean Markdown: headings, paragraphs, links, images, lists, blockquotes, code blocks and tables, with nav/footer chrome stripped. Tabbed and collapsible panels (e.g. documentation tabs, ) are included in full - not just the visible panel - and the result carries a completeness report {panels_found, panels_included, truncated, notes} so missing or cut content is never silent. Without an API key the conversion runs locally; with PAGE2MD_RAPIDAPI_KEY set it uses the hosted Page2MD API on RapidAPI.
Inputs: url (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
There is exactly one tool, so there is no possibility of confusion with a sibling tool. Its purpose (fetch a URL and return clean Markdown) is stated unambiguously in the description.
The single name url_to_markdown is descriptive snake_case and clearly conveys source and output format. With only one tool there is no cross-tool pattern to validate, which caps this slightly below full marks.
One tool is thin in absolute terms, but the server's scope is narrowly and honestly defined as URL-to-Markdown conversion, and the tool packs real capability (panel extraction, completeness reporting, local vs. hosted modes). It is not a trivial stub, so the minimal surface is defensible.
The single tool covers the full pipeline for its domain: fetch, clean, convert, strip chrome, and report completeness. Minor gaps remain—no batch/multi-URL input and no direct file-write or alternate output formats—but an agent can work around these.
Related MCP Connectors
Turn web page URLs into clean, LLM-ready Markdown. Plain HTTP, no browser.
Turn public web pages into clean Markdown for LLMs, RAG and AI agents
Web scraping for AI agents. Converts URLs to clean, LLM-ready Markdown with anti-bot bypass.
Convert any web page into clean, LLM-ready Markdown. Strips ads, navigation and clutter; keeps headings, tables, code and links.
Related MCP Servers
- AlicenseAqualityBmaintenanceFetch URLs and return clean, LLM-ready markdown with metadata and layered prompt injection defense. Configurable timeouts, word limits, JS rendering, and link extraction. All-in-one MCP server + CLI.114 PyPI2MIT
- AlicenseAqualityBmaintenanceMCP Server for Web2MD — convert webpage URLs to clean Markdown from Claude Desktop, Cursor, or any MCP-compatible agent.12MIT
- AlicenseAqualityDmaintenanceMCP server that converts URLs to clean Markdown/Text for LLM agents.540 npm5MIT
- AlicenseAqualityCmaintenanceA fast, dependency-light MCP server that converts web pages into clean Markdown, structured metadata, and classified links for language models.343 npmMIT