Create an API key on your account page. Then either add the remote MCP server https://www.htmltourl.dev/api/mcp to your agent (it exposes a publish_html tool), or have the agent POST HTML to https://www.htmltourl.dev/api/publish. Both return the live URL.
Option 1 — MCP (Claude Code, Claude Desktop, Cursor, any MCP client)
The endpoint speaks MCP's Streamable HTTP transport and exposes three tools:
publish_html—html(orfiles), optionalslug,password,update. Returns the URL.list_pages— your live pages and plan usage.delete_page— removes a page byslug.
Claude Code
claude mcp add --transport http htmltourl https://www.htmltourl.dev/api/mcp \
--header "Authorization: Bearer hu_your_key_here"
Cursor, Claude Desktop and other clients (JSON config)
{
"mcpServers": {
"htmltourl": {
"url": "https://www.htmltourl.dev/api/mcp",
"headers": { "Authorization": "Bearer hu_your_key_here" }
}
}
}
Then just ask: "Build a one-page summary of this CSV and publish it with htmltourl as q3-summary."
Option 2 — REST API (scripts, CI, notebooks, custom agents)
curl -X POST https://www.htmltourl.dev/api/publish \
-H "Authorization: Bearer $HTMLTOURL_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Build #512 passed</h1>", "slug": "ci-512"}'
The response contains url, slug and expiresAt. Multi-file sites go in a files map; ZIPs can be posted as application/zip. Full reference: API docs.
Option 3 — An instruction file, no integration
Agents that can run shell commands only need to be told how. Add this to AGENTS.md, CLAUDE.md or your system prompt:
## Sharing HTML
When the user wants to share an HTML file, publish it:
curl -s -X POST https://www.htmltourl.dev/api/publish \
-H "Authorization: Bearer $HTMLTOURL_KEY" -H "Content-Type: text/html" \
--data-binary @path/to/file.html
Reply with the "url" from the JSON response.
Rules that keep agents safe
- Keys are account credentials. Store them in environment variables or the MCP client config, never in the HTML.
- Published means visible. Anyone with the URL can view source. Tell the agent not to publish secrets, customer data or internal URLs, and use
passwordfor internal reports. - Use
updateto republish to the same slug instead of creating a new page each run. - Pages are noindex and follow your plan's limits (Free: 3 pages, 24 hours).