Example page · Ex. 01 Class I · ExtensionsCross-filed IV · Curiosities
handrail
Your hx-post buttons, published as WebMCP tools an agent can call.
- Any
hx-postthat carries anhx-toolname is registered as a tool. The button is the API. - The schema comes from the element: its form fields, its
hx-vals, itsaria-description. This is what the agent reads instead of a screenshot. - A tool call fires the element's own request. Same endpoint, same headers,
HX-Sourceand all. The server can't tell, and doesn't need to. - The swap lands for whoever is watching. Press a button yourself: you and the agent share one request path and one log.
hx-posts. Press one.
- Kind
- extension
- Language
- JavaScript
- htmx
- 4.x
- Status
- experimental
- Licence
- MIT
- Speaks
- WebMCP
§1Description
What it is.
An htmx 4 extension that turns the buttons you already have into tools an agent can call, with no second API to keep in step.
How it works.
Agents are learning to use websites by squinting at screenshots and guessing which button does what. A hypermedia page already knows what its buttons do, because the server wrote them. handrail just says so out loud: it reads each tool-named element, registers it with navigator.modelContext, and when the agent calls, it clicks the element the way htmx would.
That means validation, auth and rendering stay on the server, exactly where they were. The page is the tool server. There is nothing else to deploy.
- Name
- The rail you hold on the stairs. Something for an agent to hold while it walks your interface.
- Where it runs
- Any htmx 4 page served to a browser that exposes
navigator.modelContext. Inert everywhere else. - Not the same as
- An MCP server. handrail runs in the page; the agent talks to the page.
§2Source
- Maintainers
- example-maintainer, example-2Made-up handles: an example has no people
- Repository
- NoneAn example, listed to show the page at size
- Register
- projects.jsonEx. 01, an example number: examples never take a register No.
- Skin
- skin-handrail.cssworn inside fig. 1 only
- Frame
- Signalthe house frame; a skin dresses only the demo window
- Copy
handrail.jsnext to htmx- Load
<script src="/js/handrail.js"></script>after htmx, nodefer- Name
hx-tool="close_issue"on anyhx-post- Describe
aria-descriptionbecomes the tool's description- Needs
- htmx 4.x · an agent that speaks WebMCP