HTML to Markdown MCP
About
Fetch web pages and convert HTML to clean, formatted Markdown. Handles large pages with automatic file saving to bypass token limits.
Details
- Author
- levz0r
- Categories
- Web Scraping, Other
Jump to
Setup
Install HTML to Markdown MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/levz0r/html-to-markdown-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
An MCP (Model Context Protocol) server that converts HTML content to Markdown format using Turndown.js.
- Features
- Installation
- Usage
- With Claude Code
- With Claude Code (Plugin)
- With Claude Desktop
- With Cursor
- With Codex
- Using Local Development Version
- Available Tools
- When does it activate?
- SSRF Protection
- Allowing Local Network Access
- πFetch and convert web pages- Automatically fetch HTML from any URL
- π Convert HTML to clean, formatted Markdown
- π Preserves formatting (headers, links, code blocks, lists, tables)
- ποΈ Automatically removes unwanted elements (scripts, styles, etc.)
- π Auto-extracts page titles and metadata
- β‘ Fast conversion using Turndown.js
- πSSRF protection- Blocks requests to private/internal networks by default
Or use with npx (no installation required):
claude mcp add --transport stdio html-to-markdown -- npx html-to-markdown-mcp
claude mcp add --transport stdio html-to-markdown -- html-to-markdown-mcp
This project can also be installed as a Claude Code plugin, which bundles the MCP server and makes it easy to share with teams.
/plugin marketplace add levz0r/html-to-markdown-mcp /plugin install html-to-markdown@levz0r/html-to-markdown-mcp
Or enable for your teamby adding to your project's.claude/settings.json:
{ "extraKnownMarketplaces": { "levz0r/html-to-markdown-mcp": { "source": { "source": "github", "repo": "levz0r/html-to-markdown-mcp" } } }, "enabledPlugins": { "html-to-markdown@levz0r/html-to-markdown-mcp": true } }
Add this server to your Claude Desktop configuration file:
{ "mcpServers": { "html-to-markdown": { "command": "npx", "args": ["html-to-markdown-mcp"] } } }
{ "mcpServers": { "html-to-markdown": { "command": "html-to-markdown-mcp" } } }
Add this server to your Cursor MCP settings file:
{ "mcpServers": { "html-to-markdown": { "command": "npx", "args": ["html-to-markdown-mcp"] } } }
{ "mcpServers": { "html-to-markdown": { "command": "html-to-markdown-mcp" } } }
- Open Cursor Settings:β + ,(macOS) orCtrl + ,(Windows/Linux)
- Navigate toFileβPreferencesβCursor Settings
- Select theMCPoption
- Add a new global MCP server with the configuration above
- Global:~/.cursor/mcp.json(available across all projects)
- Local:.cursor/mcp.jsonin your project directory (project-specific)
After adding the configuration, restart Cursor for the changes to take effect.
Add this server to your Codex configuration using the CLI or by editing the config file:
Option 1: Using Codex CLI (Recommended):
codex mcp add html-to-markdown -- npx -y html-to-markdown-mcp
codex mcp add html-to-markdown -- html-to-markdown-mcp
[mcp_servers.html-to-markdown] command = "npx" args = ["-y", "html-to-markdown-mcp"]
[mcp_servers.html-to-markdown] command = "html-to-markdown-mcp"
The configuration file is located at~/.codex/config.tomlon all platforms (macOS, Linux, and Windows).
After updating the configuration, restart Codex or your Codex session for the changes to take effect.
If you're developing or testing locally, you can add the MCP server directly from your local code:
claude mcp add --transport stdio html-to-markdown -- node /absolute/path/to/html-to-markdown-mcp/index.js
{ "mcpServers": { "html-to-markdown": { "command": "node", "args": ["/absolute/path/to/html-to-markdown-mcp/index.js"] } } }
Replace/absolute/path/to/html-to-markdown-mcpwith the actual path to your cloned repository.
Fetch HTML from a URL or convert provided HTML content to Markdown format.This tool is automatically used by Claude whenever HTML needs to be fetched and converted.
- url(string): URL to fetch and convert (eitherurlorhtmlis required)
- html(string): Raw HTML content to convert (eitherurlorhtmlis required)
- includeMetadata(boolean, optional): Include metadata header (default: true)
- maxLength(number, optional): Maximum length of returned content in characters. Content exceeding this will be truncated with a message. Useful for large pages to avoid token limits.
- saveToFile(string, optional): File path to save the full content. When specified, saves the complete markdown and returns only a summary. Recommended for very large pages.
{ "url": "https://example.com" }
{ "html": "<h1>Hello World</h1><p>This is a <strong>test</strong>.</p>" }
Example 3: Fetch large page and save directly to file
{ "url": "https://www.docuseal.com/docs/api", "saveToFile": "./docuseal-api.md" }
Example 4: Limit returned content length
{ "url": "https://example.com", "maxLength": 5000 }
# Example Domain Source: https://example.com Saved: 2025-10-09T12:00:00.000Z --- # Example Domain This domain is for use in illustrative examples...
Save markdown content to a file on disk. Use this to persist converted HTML or any markdown content.
- content(string, required): The markdown content to save
- filePath(string, required): The file path where the markdown should be saved (can be relative or absolute)
{ "content": "# My Document\n\nThis is some markdown content.", "filePath": "./output/document.md" }
Usage:You can chain both tools together - first convert HTML to markdown, then save the result to a file.
The MCP server will automatically be used by Claude when you:
- Ask to fetch information from a webpage
- Request to convert HTML to Markdown
- Need to extract content from a URL
- Ask to summarize or analyze a webpage
- Request to save markdown content to a file
- "What's onhttps://example.com?"
- "Fetch and summarize this article: https://..."
- "Convert this webpage to Markdown"
- "Extract the main content from this URL"
- "Save this webpage as a markdown file"
- "Fetchhttps://example.comand save it to article.md"
If you want to contribute or modify the server:
# Clone the repository git clone https://github.com/levz0r/html-to-markdown-mcp.git cd html-to-markdown-mcp # Install dependencies npm install # Run the server npm start
Run the test suite using Node's built-in test runner:
# Run all tests npm test # Run tests in watch mode (re-runs on file changes) npm run test:watch
- Tool discovery tests
- HTML to markdown conversion tests
- URL fetching tests
- File saving tests
- Truncation and large page handling tests
- SSRF protection tests
- Integration workflow tests
The project uses automated CI/CD for publishing to npm:
-
Update versionusing npm version scripts:
npm run version:patch # 1.0.0 -> 1.0.1 npm run version:minor # 1.0.0 -> 1.1.0 npm run version:major # 1.0.0 -> 2.0.0
Push the tagto trigger automated publishing:
- Run all tests
- Publish to npm if tests pass
- Add provenance information to the package
npm run release:patch --otp=<code> npm run release:minor --otp=<code> npm run release:major --otp=<code>
By default, the server blocks URL requests to private and internal network addresses to preventServer-Side Request Forgery (SSRF)attacks. This includes:
- Loopback addresses (127.0.0.0/8,::1)
- Private networks (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16)
- Link-local / cloud metadata endpoints (169.254.0.0/16)
- Non-HTTP(S) schemes (file://,ftp://, etc.)
DNS resolution is checked to prevent bypass via hostnames that resolve to private IPs.
If you need to convert HTML from local or internal servers (e.g., a local dev server), you can opt in with the--allow-localflag or theALLOW_LOCAL_NETWORKenvironment variable:
# Via CLI flag npx html-to-markdown-mcp --allow-local
# Via environment variable ALLOW_LOCAL_NETWORK=true npx html-to-markdown-mcp
Claude Desktop / Cursor configuration with local access:
{ "mcpServers": { "html-to-markdown": { "command": "npx", "args": ["html-to-markdown-mcp", "--allow-local"] } } }
Warning:Only enable local network access if you trust the AI agent's URL inputs. With this flag enabled, the server can reach internal services, localhost ports, and cloud metadata endpoints.
- Protocol:Model Context Protocol (MCP)
- Conversion Library:Turndown.js
- Transport:stdio
- Node.js:ES modules
This server uses the same conversion approach asmarkdown-printer, a browser extension for saving web pages as Markdown files.
Fetches web pages and converts them to clean markdown, focusing on main content extraction.
Fetches web content from a URL and converts it from HTML to markdown for easier consumption by LLMs.
Local-first MCP server that captures web URLs (X, Reddit, YouTube, Wikipedia, articles) as typed data + Markdown into a self-hosted capture/store/recall substrate, with offline semantic recall. Six tools over a local khiipd daemon; run khiipd serve first.
Download webpages as markdown files using the r.jina.ai service, with configurable directories and persistent settings.
Fetches content from any URL and converts it to HTML, JSON, Markdown, or plain text.
Extracts and transforms webpage content into clean, LLM-optimized Markdown using Mozilla's Readability algorithm.
Convert any URL to clean, LLM-ready Markdown
Extracts and transforms webpage content into clean, LLM-optimized Markdown using the Readability algorithm.
Extracts web content from a URL and converts it to clean Markdown format.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




