Skip to content
AI-generated HTML

Publish HTML from AI agents with the API or MCP

Coding agents write reports, dashboards and prototypes as HTML files — then leave you to figure out sharing. Give them one tool and they return a link instead.

7 min readUpdated October 2026By the HTMLtoURL.dev team
Short answer

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 (or files), optional slug, password, update. Returns the URL.
  • list_pages — your live pages and plan usage.
  • delete_page — removes a page by slug.

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 password for internal reports.
  • Use update to 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).

Questions people ask

Is there an MCP server for publishing HTML?

Yes — https://www.htmltourl.dev/api/mcp, authenticated with your API key. It offers publish_html, list_pages and delete_page.

Can ChatGPT publish to a URL?

Through custom GPT actions or any tool-calling setup that can POST to the REST API with your key.

Does the API cost extra?

No. API and MCP are included on every plan and count towards the same limits.

Read next

Paste HTML. Get a URL.

Code, an .html file, a ZIP or a whole folder becomes a live HTTPS URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep URLs online for good.

Convert HTML to URL