You do not have to copy and upload every HTML file produced by Claude Code or Codex. Register HTML2WEB’s public Remote MCP address once, then ask the agent to “publish this file as a one-hour link.” It can call the publishing tool and return the URL. The public Free endpoint needs neither an API key nor a bearer token.

Publish source directly, then protect retries and updates

Prefer publish_share with the file’s UTF-8 content and filename. A local path alone is not file content. A .md filename selects Markdown; an .html filename selects HTML. publish_html, publish_markdown and publish_html_file remain compatibility tools.

Download the JSON-RPC request example. It embeds the Markdown sample. Replace its example idempotencyKey with a new random key before first use; reuse that new key with unchanged arguments only when retrying the same request. A replay returns the original URL without recovering private ownership credentials. Retry records last up to 24 hours for the same caller identity; an anonymous IP or UTC-day change can change that identity.

Before replacing a share, call get_share_status, then pass its contentVersion as expectedContentVersion to update_share. A stale version fails instead of overwriting newer work. On a conflict, read the latest status and resolve the edit before retrying. Management tools accept the public URL in slug. Anonymous management requires the private manageToken; an authorized Pro OAuth connection can manage its own shares without sending that token.

Return the public url and expiry to the recipient. Keep manageToken, manageUrl and creatorPreviewUrl private. This request example has not been sent to production. The tool contract was inspected at revision 633f4b4 (apps/api/src/mcp.ts); it does not establish current CLI version compatibility.

MCP in one sentence

The Model Context Protocol lets an AI client discover and call tools offered by an external service. The official MCP Tools specification defines how a server provides tool names, descriptions, and input schemas, and how a client executes them through tools/call.

HTML2WEB uses that protocol for publish, update, and delete tools. Connecting a server does not publish files automatically. A tool runs when the user requests publication and the client’s approval policy permits it.

Connect HTML2WEB to Claude Code

Run this command in a terminal:

claude mcp add --transport http --scope user html2web https://html2web.iill.dev/mcp

--transport http selects the Streamable HTTP transport used by the Remote MCP. --scope user makes the connection available across projects. Keep the default or use --scope local when only one project needs it.

Check the connection:

claude mcp list

You can also inspect it from the /mcp menu in a Claude Code session. Confirm current options in the official Claude Code MCP documentation.

A request to use in Claude Code

Publish report.html with HTML2WEB.

- Expiration: 24 hours
- Password: none
- Before publishing, scan for API keys, tokens, connection strings,
  personal information, customer data, internal hostnames, and local asset paths.
- If you find any, do not publish. Report only the file location and reason.
- On success, show only the share URL and expiration time in the public response.
- Never print the management token in a public response or chat channel.

Connect HTML2WEB to Codex

The registration command shown in the HTML2WEB setup guide is:

codex mcp add html2web --url https://html2web.iill.dev/mcp

List registered servers with:

codex mcp list

The Codex app, CLI, and IDE extension may share MCP settings for the same Codex host. If a client has been running for a long time, restart it after adding the server or begin a new session so it refreshes the tool list.

A request to use in Codex

Publish docs/audit.md as Markdown through HTML2WEB.

- Expiration: one hour
- Scan for secrets and personal information before publishing.
- Stop if it contains an internal server address or customer data.
- Use publish_share with the Markdown source and filename audit.md.
- On success, report only the share URL and expiration time.
- Do not include the management token in a public message.

Tools provided by the HTML2WEB MCP

The current public tools listed in the HTML2WEB MCP documentation are:

Tool Purpose
publish_share Preferred: publish UTF-8 source directly, with filename-based format selection
get_publish_limits Read limits and publishing availability for this connection
publish_html Compatibility: publish an HTML string
publish_markdown Compatibility: render and publish a Markdown string
publish_html_file Compatibility: publish a Base64-encoded HTML or Markdown file
update_share Replace owned content with expectedContentVersion to guard against stale edits
delete_share Delete a share immediately
set_password Add, change, or remove the viewing password
set_expiry Change expiration within the current plan
get_share_status Read status and contentVersion without returning the body

The public Free endpoint accepts files up to 1 MiB. Expiration must be 30m, 1h, or 24h, defaults to 1h, and is subject to fair-use limits.

Require a scan before publication

Automation removes a step where a person might otherwise see the file. Include the scan in the publishing request:

Before publishing, find and report:
1. Secret patterns such as sk-, ghp_, AKIA, and Bearer tokens
2. Keys, secrets, and database connection strings copied from .env
3. Real names, email addresses, phone numbers, employee IDs, and customer names
4. Internal IP addresses, domains, and staging URLs
5. Local-only paths such as file://, localhost, and ./assets

If you find any item, do not call the publishing tool. Stop.

Pattern matching is not complete. On the first day you connect the MCP, check the same file in the manual HTML-to-URL interface so you understand the published result, expiration, and password behaviour.

A management token is not the viewing URL

The publish response may include a management token that can update or delete the share. It is the ownership key for that share, even though it is not an API key.

  • Send the share URL to recipients.
  • Keep the management token and management link with the author.
  • Do not paste the full response JSON into Slack, an issue, or a PR.
  • Losing the token may make the share difficult to manage before it expires.

The token is not required to view the link.

Troubleshooting

HTML2WEB is absent from the tool list

Run claude mcp list or codex mcp list to confirm registration. Restart the client. In Claude Code, also check whether the registered scope applies to the current project.

The file exceeds 1 MiB

Base64-encoded inline images are a common cause. Reduce them, or replace simple charts with inline SVG and tables.

The expiration value is rejected

The public Free endpoint accepts only 30m, 1h, and 24h.

It works locally but breaks after publishing

Separate CSS, JavaScript, and image files do not follow the document. Ask the agent to create “one self-contained HTML file with no external dependencies.”

The endpoint reports a quota error

Wait until the reset time in the response, or follow the upgrade flow in the official documentation from a browser. Do not append checkout URLs or arbitrary tokens to the MCP setting.

When manual upload is better

  • You will publish the file only once.
  • You need to inspect the rendered result before publishing.
  • Company policy prohibits external MCP connections.
  • The file is too sensitive to enter an agent context.
  • You prefer to select expiration and password in the interface.

Automation is valuable for repeated work. It does not need to replace every manual publication from the start.

MCP automation does not change the result’s lifecycle. It remains a review link for up to 24 hours with noindex by default. Move to maintained hosting when you need a stable domain, search visibility, continuous updates, and monitoring.

A password does not justify publishing sensitive information. A recipient can still save or forward the content.

Frequently asked questions

Does the public MCP really require no sign-in?

The current Free endpoint at https://html2web.iill.dev/mcp connects without an API key or bearer token. Fair-use limits still apply.

Can an agent upload files without my permission?

Tool calls follow the user’s request and the client’s approval policy. Start by requiring confirmation for write tools until you understand the flow.

Do I register it separately in Claude Code and Codex?

Yes. They use separate client settings, so connect each one once. Both then use the same HTML2WEB tools and limits.

Can I update content at the same address?

Use get_share_status first, then update_share with expectedContentVersion. Keep the management token private; an authorized Pro OAuth connection can manage its own shares without sending it.