Clay CLI

Give your AI agent access to your Hyperclay files

Clay CLI runs on your computer so your AI agent can read and edit the plain HTML files you host on hyperclay.com. Every change goes into version history, stale writes are refused, and an agent cannot delete your work.

1. Sign in and paste an agent key
npx -y @panphora/claycli login
2. Add Clay CLI to Claude Code
claude mcp add clay -- npx -y @panphora/claycli mcp
Cursor (.cursor/mcp.json) and Claude Desktop (claude_desktop_config.json)
{
  "mcpServers": {
    "clay": {
      "command": "npx",
      "args": ["-y", "@panphora/claycli", "mcp"]
    }
  }
}

Requires Node 20.18.1 or later. Pass --read-only after mcp to offer only the 10 reading tools. Check or end a session with npx -y @panphora/claycli status and npx -y @panphora/claycli logout.

Prefer no install: connect to the hosted MCP server at hyperclay.com/mcp

Hyperclay also runs a hosted MCP server at https://hyperclay.com/mcp for Claude Code, Claude.ai, Claude Desktop, Cursor and ChatGPT. Every tool except publish_site works on both. publish_site needs Clay CLI because the hosted server cannot read files on your computer. Setup for each tool is at hyperclay.com/docs/agents.

Hosted MCP setup for Claude Code
claude mcp add --transport http hyperclay https://hyperclay.com/mcp
claude mcp login hyperclay

What an agent can do

Your agent can inspect an HTML file in pieces, update exact text or structured data, restore an earlier save, or publish a local folder to its own address. Clay CLI provides 18 tools, and 10 of them only read.

Documents can be at most 8 MB. Large documents are read in pieces: an outline first, then the parts the agent selects, and small changes go through edit_document.

Read

5 tools

list_documents read only
List the documents the key can reach.
read_document read only
Read the whole document when small, or an outline, or the parts the agent selects by CSS selector or character range.
outline_document read only
Read the element tree with selector paths and sizes.
find_in_document read only
Find where text or a regular expression appears, with the element around it.
read_data read only
Read the page's structured data.

Change

4 tools

edit_document
Replace exact text in the version the agent read.
save_document
Save a whole document.
create_document
Create a new document at a path such as notes/plan.html. Missing folders are created. Refused if anything is already there.
write_data
Change the page's structured data.

History

3 tools

list_versions read only
List the saved versions of a document.
read_version read only
Read an earlier version from version history.
restore_version
Restore a document to an earlier version.

Sites and addresses

6 tools

list_sites read only
List site folders the key can reach, with each site's address, home page and page count.
list_files read only
List folders, documents and files under a folder.
publish_site
Upload a local folder as a site. Sends only what changed, never deletes files that exist only on hyperclay.com, and claims the subdomain last.
claim_subdomain
Give a document or a site folder its public address at <name>.hyperclay.com.
add_domain
Add a custom domain to a document or a site folder, and answer the two DNS records to set.
domain_status read only
Check each custom domain, whether it is active, and the DNS records it needs.

Keys and safety

You choose which files an agent can reach and what level of editing it gets. Even when an agent can edit, your existing pages are protected from conflicting writes, irreversible edits and leaked tokens.

Agent keys

  • Make an agent key in the Hyperclay dashboard: open the account menu, then choose "Agent keys…".
  • Give the key a name, limit it to one team or one folder if you want, and pick one of three access levels: reading, changing content, or full editing.
  • The agent acts as you, with no more access than you have.
  • Revoke any key at any time. "Recent activity" in the Agent keys dialog shows what each key changed.
  • On your computer, the key is saved in ~/.config/claycli/credentials.json, readable only by you. It is never accepted as an argument on the command line, so it stays out of shell history, and it is never printed. Set CLAY_CLI_KEY in the environment instead of a saved key if you prefer.

What protects your files

  • Every write is based on the version the agent read. If the document or file changed in the meantime, the write is refused and the agent is told to read it again.
  • Every change to a document is kept in version history as "Recorded by you through <key name>", so any change can be restored.
  • When an agent replaces a file, the old bytes are kept as a backup.
  • Agents cannot delete, rename, move or share anything. They cannot make a private page public, cannot remove a custom domain, and cannot change a subdomain once it is set.
  • A save that contains an agent key or an OAuth token is refused.
  • Each key can make at most 60 page saves and 300 file writes a minute, so an agent stuck in a loop cannot fill the history.

The command line, for scripts

Use the claycli command in shell scripts, build steps or terminal tasks when you want direct commands outside an MCP client.

Example commands
claycli list
claycli read hyperclay:123 --outline
claycli read hyperclay:123 --select 'main > section'
claycli edit hyperclay:123 --find 'Draft' --replace 'Final' --if-match <etag>
claycli create notes/plan.html --file ./plan.html
claycli versions hyperclay:123
claycli subdomain hyperclay:123 my-tool
npx -y @panphora/claycli publish ./maya demos/maya --subdomain maya --dry-run

A document is hyperclay:<id> or its hyperclay.com URL. Document commands take --json. Without a global install, each command also runs as npx -y @panphora/claycli <command>.

Where it runs, and the rename

Clay CLI connects to your hosted Hyperclay files today and keeps existing Clay Agent setups working without changes.

Works with hyperclay.com

Hyperclay hosts HTML files that edit and save themselves. Its documents are plain HTML files you can open, edit and share.

Clay CLI works with hyperclay.com today. Support for the HTML Clay and Hyperclay Local desktop apps comes in a later version.

Renamed from Clay Agent

Clay CLI was called Clay Agent (@panphora/clay-agent, command clay-agent). Nothing you set up breaks.

Running npx -y @panphora/clay-agent passes every command to Clay CLI and stays current, a saved key still signs you in, CLAY_AGENT_KEY still works, and an existing MCP entry needs no edit.