Using the MCP Server
The html-to-markdown MCP server exposes the converter's conversion and
metadata-extraction capabilities as MCP tools, so an MCP-compatible client (Claude
Code, Claude Desktop) can convert HTML and pull structured metadata directly,
with no CLI invocation or glue code.
How it runs in this plugin
The plugin auto-registers the server. Its command is the bundled launcher
scripts/mcp-launch.sh, which execs html-to-markdown mcp. On first run the
launcher resolves an html-to-markdown binary: it reuses one already on PATH
or cached in the plugin's bin/, then tries npx/uvx, then Homebrew, then
downloads a prebuilt from the tool's latest GitHub release. Override the channel
with HTML_TO_MARKDOWN_LAUNCHER=auto|npx|uvx|brew|download.
The mcp subcommand ships in a recent release of the tool. If an older
html-to-markdown is already on PATH, it may not expose mcp yet — upgrade
the binary (brew upgrade, re-download, or rebuild) to pick it up.
To run it manually:
html-to-markdown mcp # for Claude Code / Claude Desktop (stdio)
The tools
- convert_html — convert an HTML string to Markdown, Djot, or plain text.
Takes
html (the HTML string), an optional config object mirroring
ConversionOptions, and an optional json flag. With json: true it returns
the full ConversionResult (content, tables, metadata, document structure,
inline images, warnings) instead of the bare converted text.
- extract_metadata — pull structured metadata (document info, Open
Graph / Twitter / JSON-LD / Microdata, headers, links, images) from an HTML
string. Takes only
html.
Both tools accept an HTML string — the MCP server does not fetch URLs or read
files (that is CLI-only). The exact argument schemas come from the running
server; ask the client to list tools to see the live surface.
When to prefer MCP over the CLI or SDK
- Prefer MCP inside an agent session: the agent calls the converter directly
as a tool, with no shell-out and no process management.
- Prefer the CLI for one-shot conversions and shell pipelines (
… | jq).
- Prefer the SDK when embedding conversion in application code.
1---2name: using-the-mcp-server-33description: Use when converting HTML to Markdown or extracting metadata and tables through the html-to-markdown MCP server's tools, rather than shelling out to the CLI. Covers the tool surface, the auto-installing launcher, and when MCP beats the CLI or SDK.4---56<!--7AI-RULEZ :: GENERATED FILE — DO NOT EDIT8Content-Hash: blake3:c6276d5c9515b3ea110d1f483a3c0ac259c4edb0b9e298431f5644d1c4103c669Source-Hash: blake3:b863a9279a8e31251a475dd8c895529ec38eec6b6506af4fe5c874832e9a48a610Schema-Version: v111-->1213# Using the MCP Server1415The `html-to-markdown` MCP server exposes the converter's conversion and16metadata-extraction capabilities as MCP tools, so an MCP-compatible client (Claude17Code, Claude Desktop) can convert HTML and pull structured metadata directly,18with no CLI invocation or glue code.1920## How it runs in this plugin2122The plugin auto-registers the server. Its command is the bundled launcher23`scripts/mcp-launch.sh`, which execs `html-to-markdown mcp`. On first run the24launcher resolves an `html-to-markdown` binary: it reuses one already on `PATH`25or cached in the plugin's `bin/`, then tries `npx`/`uvx`, then Homebrew, then26downloads a prebuilt from the tool's latest GitHub release. Override the channel27with `HTML_TO_MARKDOWN_LAUNCHER=auto|npx|uvx|brew|download`.2829The `mcp` subcommand ships in a recent release of the tool. If an older30`html-to-markdown` is already on `PATH`, it may not expose `mcp` yet — upgrade31the binary (`brew upgrade`, re-download, or rebuild) to pick it up.3233To run it manually:3435```bash36html-to-markdown mcp # for Claude Code / Claude Desktop (stdio)37```3839## The tools4041- **convert_html** — convert an HTML string to Markdown, Djot, or plain text.42 Takes `html` (the HTML string), an optional `config` object mirroring43 `ConversionOptions`, and an optional `json` flag. With `json: true` it returns44 the full `ConversionResult` (content, tables, metadata, document structure,45 inline images, warnings) instead of the bare converted text.46- **extract_metadata** — pull structured metadata (document info, Open47 Graph / Twitter / JSON-LD / Microdata, headers, links, images) from an HTML48 string. Takes only `html`.4950Both tools accept an HTML **string** — the MCP server does not fetch URLs or read51files (that is CLI-only). The exact argument schemas come from the running52server; ask the client to list tools to see the live surface.5354## When to prefer MCP over the CLI or SDK5556- **Prefer MCP** inside an agent session: the agent calls the converter directly57 as a tool, with no shell-out and no process management.58- **Prefer the CLI** for one-shot conversions and shell pipelines (`… | jq`).59- **Prefer the SDK** when embedding conversion in application code.