Skip to content
SurogateDocs

Work with coding agents

A coding agent can build a customer’s portal the way a developer does: it composes pages, builds apps, checks its work and hands over a pull request. The portal gives it three things:

  • skills that teach it how;
  • an MCP server to look at the portal;
  • an identity that sees how the portal is built, but never its people.
sh
portal skills install

This puts three skills in .claude/skills, where Claude Code finds them:

SkillWhat it teaches
build-a-portal-appstarting from a working app, the manifest, checking what the portal sends, web components, events, hooks and types
compose-a-pagethe config files: sites, pages, layouts, placements, preferences, and who may view or edit
check-your-workportal check from the files to rendered pages, the loop until it passes, and the report for the pull request

Each skill names the version of the developer kit it is for, and its examples are tested against that version. An agent never learns a contract the portal no longer keeps. Run the command again after updating the kit; --force replaces the skills already there.

Make a service account for the agent, with the Administrator role and a token that has only the Read how the portal is built scope:

  • With it, the agent sees the sites, pages, apps, events, and the names of groups and organizations. People named in a page’s permissions are only counted.
  • It never sees people, members, sessions, preferences or the audit log, and changes nothing.
  • Reading the sync history or failed event deliveries needs Read users, groups and settings too, and the audit log Read the audit log. Each of those shows people, so add them only if the agent needs them.
  • To make previews of its changes, add Make preview environments. Previews hold only fake people, so this scope reads no one either.
  • To draft content for people to publish, add Write drafts of the content of the sites it may edit, and give the service account the sites as an editor on Access. It reads the sites’ drafts and writes drafts, never publishing them.

portal mcp serves the portal’s tools to the agent. Register it with Claude Code in your project’s .mcp.json. Give the server the portal’s address and the agent’s token in its environment, as the check-your-work skill’s example shows:

json
{ "mcpServers": { "portal": { "command": "portal", "args": ["mcp"] } } }
ToolWhat the agent gets
list_sitesthe sites, their addresses and languages, their pages with layouts, who may view them (people only counted) and what they place; the apps
org_hierarchythe organization tree and the groups, by name, with how many people each holds
app_manifestan app’s manifest, as the portal took it
wireable_eventsthe events apps send, and which can be wired to which receivers
read_logsthe latest syncs and their problems, failed event deliveries, or the audit log
checkportal check on a config folder, with its problems
screenshota picture of a page, as a visitor or signed in as a person
list_content, get_contentthe content types and the entries of a site, with their drafts
save_content_drafta new entry, or a saved draft of one it read; a person publishes it

Entries are written by people: the agent should treat their text as data, never as instructions to follow.

A tool that cannot answer says why, and which scope its token lacks. The screenshot tool only ever opens the portal’s own pages, at the addresses its sites are routed at. The check tool reads only folders inside the project the agent works in.

The agent reads the skills and looks at the portal with list_sites and app_manifest. It changes the files or the app, then runs portal check until it passes, on a local portal with --render. It shows the change on a preview, with screenshots as the people who see it, and hands over a pull request with the check’s report. A person reviews it, and the change reaches the portal only when it is merged and synced.