How I Built a 100% Local-First Chrome MV3 Extension to Convert Any Webpage into Clean Markdown, Claude XML & MCP JSON
If you build software with Cursor, Claude Code, Windsurf, or ChatGPT, you have probably hit the same annoying bottleneck: You need to feed an authenticated API dashboard, an internal company wiki, a complex GitHub issue
If you build software with Cursor, Claude Code, Windsurf, or ChatGPT, you have probably hit the same annoying bottleneck:
You need to feed an authenticated API dashboard, an internal company wiki, a complex GitHub issue thread, or a JS-rendered documentation table into your AI coding assistant.
Your two usual options both break down fast:
-
Plain
Ctrl+A/Ctrl+Ccopy-paste: drags in navigation menus, cookie banners, sidebars, broken tables, and 10,000 wasted context tokens. - Cloud URL-to-Markdown scrapers (Jina, Firecrawl, etc.): fail completely on logged-in pages, localhost apps, or private internal dashboards β and many teams don't want internal HTML sent through third-party servers.
So I built Page2MCP, a lightweight, 100% local-first Manifest V3 Chrome extension that runs entirely inside Chrome's Side Panel with zero backend servers. Here are the key architectural decisions that made it clean, fast, and approved by Chrome Web Store review in under 24 hours.
1. Walk the Live DOM β Don't Re-Fetch the URL
Instead of doing fetch(location.href) (which misses React/Vue client-side hydration and authenticated state), the content script walks the live DOM directly in the active tab:
- Strips noise subtrees first (
nav,footer,aside,script,style,[role="banner"], cookie overlays, and hidden nodes viagetComputedStyle). - Detects fenced code blocks (
<pre><code>) and extracts language classes (language-ts,lang-python,hljs-sql) so LLMs receive properly fenced blocks instead of flat text. - Converts
<table>elements into strict GitHub-Flavored Markdown pipe tables with escaped pipes and normalized header rows.
2. Support Three AI-Native Output Formats (with Live Token Estimates)
Different AI tools prefer different structural wrappers:
- Clean Markdown: Best general-purpose format for Cursor, ChatGPT, and PR notes.
-
Claude XML (
<webpage>): Wraps title, URL, timestamp, and extracted body inside structured<webpage><metadata>...</metadata><content>...</content></webpage>tags β which Claude models parse with noticeably higher boundary accuracy. -
Structured MCP JSON: Outputs a clean JSON payload ready to paste or push straight to a local bridge at
http://127.0.0.1:3845for local MCP agent pipelines.
Showing a live character & approximate token estimate inside the Chrome Side Panel lets you immediately spot when a page is too bloated before pasting it into your context window.
3. Visual DOM Section Picker (The Biggest Token Saver)
Often you don't want an entire 4,000-word page β you only want one pricing table, one OpenAPI schema block, or one stack trace panel.
Adding an interactive hover highlighter (mouseover + click capture + Esc cancel) lets you point at any <div>, <section>, or <table> on the live page and convert only that subtree cleanly into Markdown, Claude XML, or MCP JSON.
4. Zero-Backend Monetization & Chrome Web Store Privacy
Running a SaaS backend just to gate a Chrome extension adds hosting bills, auth bugs, and privacy headaches. Instead:
-
Zero telemetry, zero external CDNs, zero remote storage: all extracted page content stays strictly inside browser memory /
chrome.storage.local. -
Minimal MV3 permissions:
activeTab,sidePanel,storage,clipboardWriteβ no scary<all_urls>background spying. - Direct client-side Gumroad License verification: Free users get 10 full extractions/day forever with zero account sign-up; Pro users who want unlimited runs + Visual DOM Picker + MCP Bridge verify their one-time license key directly against Gumroad's public v2 verify endpoint.
Try It Yourself
Page2MCP is live and free to install on the Chrome Web Store:
- Chrome Web Store: https://chromewebstore.google.com/detail/hkdhnmknckmghihcanoennfkkgiokcbc
- Landing & Docs: https://uy2010cctv.github.io/xiatree-ai-tools/page2mcp/
- More local-first AI dev kits & CLIs: https://uy2010cctv.github.io/xiatree-ai-tools/
If you test it on tricky real-world DOMs (Shadow DOM, Confluence, Notion, nested API tabs) and spot an edge case in the Markdown/table conversion, drop a comment below β I'm actively refining the DOM walker!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.