Connecting an AI agent through MCP
Homelander has an MCP server at <PUBLIC_URL>/mcp. An admin can connect an AI agent such as Claude or ChatGPT to it; the agent then reads and changes the data space and writes drafts of the site: the home page index.html at / and more pages such as contacts.html at /contacts. It never publishes: an admin previews a draft (switching between its pages) and publishes the whole site in the panel (Admin → Site → Pages). Every page an agent writes carries a visible "Powered by homelander-bot" link to the repository; a draft without it is refused. A site you upload yourself as a zip is not checked.
Everything the agent does is done as the admin who connected it, and the audit log shows it as "admin · via MCP (agent)".
Who can connect an agent
Only a user with both Admin and MCP turned on. Any admin can switch MCP on or off for any admin, including themselves, on the user card (Admin → Users → the user → Roles → MCP). The switch has no effect without Admin.
Turning MCP or Admin off, or disabling the user, disconnects every agent of that user at once; turning it back on does not bring them back — each agent needs a new approval.
Connect Claude
- Turn MCP on on your own user card.
- In Claude (claude.ai, Claude Desktop or the mobile app): Settings → Connectors → Add custom connector. Name it, and set the URL to
<PUBLIC_URL>/mcp(for examplehttps://home.example.org/mcp). No client ID or secret is needed. - Claude opens a Homelander page that asks to log in (phone + code in Telegram, as usual) and then shows "Allow Claude to act as you in Homelander?" with the address the answer goes to. Check that it is
claude.ai(orclaude.com), then press Allow. - Ask Claude to look at the data (
data_catalog) or to design the home page. It reads the page guide first, writes a draft and gives you a link like<PUBLIC_URL>/admin/pages/12to preview and publish.
Claude Code works the same way (claude mcp add --transport http homelander <PUBLIC_URL>/mcp); it uses a loopback address (http://localhost:<port>/…) for the answer.
Connect ChatGPT
- Turn MCP on on your own user card.
- Open chatgpt.com/plugins, press + → Add custom MCP server, give it a name and set the URL to
<PUBLIC_URL>/mcp. Choose OAuth if asked; no client ID or secret is needed (ChatGPT registers itself). Custom MCP servers are not available on every ChatGPT plan; in Business, Enterprise and Edu workspaces an admin may have to allow them first. - ChatGPT opens the Homelander login and consent page. Check that the answer goes to
chatgpt.com, then press Allow.
ChatGPT uses the fixed callback https://chatgpt.com/connector_platform_oauth_redirect because Homelander returns the issuer (iss, RFC 9207) in every authorization response. (A real ChatGPT connection has not been tried yet.)
See and revoke connected agents
The user card shows Messengers → Connected agents: the agent's name, when it was connected and last used. Revoke disconnects it at once (its tokens stop working); connecting again needs a new approval.
Other agents
To keep strangers from registering a fake "Claude" that sends approvals to their own server, Homelander accepts only agents whose answer address is on an allow-list. The default list is:
https://claude.ai/api/mcp/auth_callback
https://claude.com/api/mcp/auth_callback
https://chatgpt.com/connector_platform_oauth_redirect
http://localhost:*
http://127.0.0.1:** stands for any port and is allowed only for localhost and 127.0.0.1 (local tools such as Claude Code). To allow another agent, set MCP_REDIRECT_URIS to the full comma-separated list, including the defaults you want to keep, and restart:
MCP_REDIRECT_URIS=https://claude.ai/api/mcp/auth_callback,https://claude.com/api/mcp/auth_callback,https://chatgpt.com/connector_platform_oauth_redirect,http://localhost:*,http://127.0.0.1:*,https://agent.example/oauth/callbackWhat the agent can do
| Tool | What it does |
|---|---|
data_catalog, data_get | read data items (values, tables with rows) |
data_set_value, data_create_table, data_update_table_columns | create and change items |
data_rows_upsert, data_rows_delete | change table rows |
data_set_visibility, data_delete | set who reads an item (public, residents, admins), delete it |
asset_upload | upload an image for image values and cells |
page_guide | how a page is built here (also the resource homelander://guide/page) |
page_list_versions, page_get_version | read site versions, their pages (with addresses) and files |
page_create_draft, page_update_draft, page_copy_to_draft | write drafts |
simple_page_guide | how simple pages are written: Markdown, numbering and anchors (also the resource homelander://guide/simple-page) |
simple_page_list, simple_page_get, simple_page_list_versions | read simple pages (/p/<slug>), their editions and drafts |
simple_page_create, simple_page_create_draft, simple_page_update_draft | create a simple page and write its drafts |
Every data item has a visibility:
public— anyone, guests too; pages read it from/api/v1/public/data.residents— signed-in residents and admins. A page cannot ask for it (it runs in a sandbox without the visitor's session): the site header sends it to the page in ahomelander:datamessage (seepage_guide, section 3). Homelander adds a small script to every page it serves that asks for it with a one-time code from the frame address and a privateMessageChannel, so the data reaches only the page the header opened: if the frame goes to another document (for example a link withouttarget="_top"), nothing more is sent there. Images of such items come as signed links that work for about an hour.admins— only admins, in the panel and through MCP; never served to the site.
Built-in modules keep their own items: the information feed owns every key starting with feed. and publishes the latest 20 posts as the table feed.posts (residents by default). Such items carry an owner (module:feed) and are read-only for the agent except their visibility; new keys under a module's prefix are refused (key_reserved). Items of a module that is turned off stay in the database but are not served to the site.
New items are admins unless the agent or the admin sets another visibility. A published page can show residents data to any logged-in resident (and its script could pass it on, for example in a link it opens), so publish only pages you have looked at.
Simple pages (the Pages module) are Markdown text in Homelander's own design at /p/<slug>, such as the house chat rules. Each has drafts and numbered editions; numbered items get stable anchors (#3.2) that links and other modules cite. The agent writes drafts; an admin publishes, rolls back and deletes them, and only an admin changes who can read a published page. The Pages module keeps the public item pages.list (published public pages with their links).
There is no tool to publish, unpublish or delete a page version or a simple page edition. Page names admin, login, register, oauth, site, api, mcp, healthz, my, p, assets, telegram, favicon, robots and sitemap are reserved; data_set_value takes url and phone values as well.
Technical notes
- OAuth 2.1 with PKCE (S256), Homelander as its own authorization server: metadata at
/.well-known/oauth-protected-resource/mcpand/.well-known/oauth-authorization-server, dynamic client registration at/oauth/register, tokens at/oauth/token, revocation at/oauth/revoke. The consent page is/oauth/authorizein the web app. Authorization responses carryiss(RFC 9207). Theresourceparameter may be the MCP URL or the server origin. - Access tokens last 1 hour, refresh tokens 30 days and are replaced on every use. A replaced refresh token that comes back more than 30 seconds later means the token chain leaked: the agent is disconnected. A new approval ends the tokens of the earlier one. Only hashes of codes and tokens are stored.
- At most 300 MCP requests a minute per connected agent; 30 requests a minute per address on the OAuth endpoints.