AI agents and MCP
Let an AI coding agent work with Groundfloor through the Groundfloor MCP and the gf CLI — and the rules it should follow.
AI coding agents, such as Claude Code, Cursor or Codex, can work with Groundfloor for you. The Groundfloor MCP lets an agent look at your workspace and read these docs; the agent then makes changes with the gf CLI. Every MCP tool only reads, except two: coderunner_cancel_deployment, which deletes a deployment, and coderunner_bind_environment, which permanently binds a Coderunner to an environment. See The one MCP tool that deletes and The MCP tool that binds an environment.
Set it up
Sign in once yourself
An agent can't complete a browser sign-in, so a person runs gf login and gf workspaces use <workspace-id> first. The MCP and the CLI then use that session. An agent runs gf without a terminal, so gf deploy won't use that saved workspace on its own: the agent passes -w <workspace-id>, or you set GROUNDFLOOR_WORKSPACE_ID (why).
Add the MCP to your agent
Most agents read an MCP config like this, for example .mcp.json in your project:
{
"mcpServers": {
"groundfloor": { "command": "npx", "args": ["-y", "@groundfloorcloud/mcp"] }
}
}Never put a token in this file. In Cursor on macOS, npx may fail to start; install it globally with npm install -g @groundfloorcloud/mcp and point the config at that install instead. The Shell starter kit already includes this config.
What the MCP offers
| Tool | Gives the agent |
|---|---|
whoami, workspace_context | Who's signed in, and what's in the workspace: Coderunners, apps, environments and more |
workspaces_list | The workspaces you can access |
docs_list, docs_get | These docs, by topic, such as coderunner, shell, feature-flags, databases |
suggest_cli | The exact gf command for a goal: deploy, run, publish, logs, secrets, flags, binding an environment, and who can call a Function (invoke_access) |
coderunner_list, coderunner_get_status, coderunner_process_log, coderunner_get_logs | Your Coderunners, their status and their logs |
apps_list, apps_get, environments_list, secrets_list, flags_list, files_list | What exists. Secret values are never returned |
apps_auth_get | A standalone app's sign-in settings, by app ID or slug: client ID (also the audience its backend checks), issuer, JWKS URL, redirect URIs, origins and status. Rolling out, in Groundfloor MCP 0.2.7 or later. To change them, the agent runs gf apps auth |
tenants_list | Your apps' tenants, with Multi-tenant on: ID, name, alias, domains and whether each is enabled. The ID is the one tokens carry in the organization claim. Read-only. In Groundfloor MCP 0.2.15 or later |
domains_list | A standalone app's custom domains, by app_id or by the app's main Coderunner as coderunner_id. Coderunners have no domains of their own |
dataplane_status | The status of the workspace's data plane |
quota_get, billing_summary | Your organization's plan usage and limits, and spend (Owners, Admins and Billing admins only) |
coderunner_cancel_deployment | Deletes a deployment |
coderunner_bind_environment | Permanently binds a Coderunner that has no environment to one. Needs Groundfloor MCP 0.2.13 or later |
coderunner_invoke_access | Reads who can call a Function's or Job's Deployment URL, or sets it to token, or to off after confirming with you; never public. Needs Groundfloor MCP 0.2.14 or later. See The MCP tool for who can call a Function |
The one MCP tool that deletes
coderunner_cancel_deployment does the same as gf coderunner cancel-deployment --deployment-id: it deletes one deployment of a Coderunner. If it's the live deployment, the Coderunner goes offline. The agent must pass a deployment_id, which it can read with coderunner_get_status; there is no default. The tool acts only on the workspace the MCP is set up with (your gf workspaces use default or GROUNDFLOOR_WORKSPACE_ID), never on one the agent names. Any workspace role that can deploy (Writer and above) can do this. If the Coderunner has a persistent disk, deleting the deployment may delete the disk's data: the call is refused unless the agent passes confirm_delete_disk_data: true (MCP 0.2.10 and later), which it should do only after you've confirmed in the conversation.
- Don't auto-approve this tool. It is marked destructive, but in your agent's permission settings leave
coderunner_cancel_deploymenton "ask every time" even if you allow the other Groundfloor tools. - If your agent never needs to delete deployments, deny the tool outright.
- Treat the other tools, apart from
coderunner_bind_environmentandcoderunner_invoke_accessbelow, as safe to auto-approve: they only read.
In Groundfloor MCP 0.2.12 and earlier, the suggest_cli tool description says the MCP "does not execute mutations". That is not true for this tool.
The MCP tool that binds an environment
coderunner_bind_environment does the same as gf coderunner bind-environment -c <coderunner> -e <environment>: it binds a Coderunner that has No environment to an active environment, so its code gets its environment's ID (see Bind a Coderunner to an environment). The agent passes the Coderunner's ID or slug and an environment ID or name. Like the delete tool, it acts only on the workspace the MCP is set up with.
- It's permanent. A bound Coderunner can never move to another environment. The agent should ask you which environment and confirm before calling it, never pick one itself. Keep the tool on "ask every time".
- Binding again to the same environment changes nothing. Nothing changes for the running service until the next deploy; to run the code in another environment, create a Coderunner there or promote into it.
- A connected Git repository stops deploying on push until a workspace member saves the Git source again.
- It needs the Writer, Admin or Owner role. An agent signed in with a machine client also needs Can deploy services.
The MCP tool for who can call a Function
coderunner_invoke_access (Groundfloor MCP 0.2.14 and later) works like gf coderunner invoke-access on the workspace the MCP is set up with. Without a value it reads the current setting and address. It can set token (callers need a token) or off (the address answers 404 to every caller). Before setting off, the agent is told to confirm with you, since it cuts off everyone calling the address; keep the tool on "ask every time". It needs the Writer, Admin or Owner role, and a machine client also needs Can deploy services.
It can't make a Function public. Asked to, it changes nothing and tells the agent to ask you: you choose Public in the Client Portal (the Coderunner's Invoke address), or run gf coderunner invoke-access -c <coderunner> public in your own terminal and confirm there. suggest_cli with the invoke_access intent returns that command but never adds --yes, so the confirmation stays with you.
Rules for agents
Give your agent these rules, or point it to this page. They prevent the most common mistakes.
-
Pick the path from the goal.
The user wants… Do this Don't To run code: a function, job, schedule or service gf deployCreate an app for it To publish a Shell app's UI gf apps init, thennpm run releaseandgf apps publishRun gf deployon the starter kitTo package an existing Service as a product gf apps create --kind standalone --primary-coderunner <id>— -
Inspect before acting. Call
workspace_contextanddocs_get, then run the commandsuggest_clireturns. Don't callcoderunner_cancel_deploymentunless the user asked you to delete a deployment, orcoderunner_bind_environmentuntil the user has chosen the environment. -
Reuse what exists. If a Coderunner or app with that name already exists, deploy to it instead of creating another. Updating an existing Coderunner needs
gf deploy --yeswhen there's no terminal, so check it's the right one first. -
Never put secrets or
.envfiles in code or uploads. Store them in Secrets and read them at runtime; see Configuration and secrets. -
Use built-in features instead of building them. Feature toggles go in feature flags, not a Data Vault collection or
.env. Data goes in the workspace's database, which already exists. -
Report what you did. After deploying, give the Coderunner, version and deployment IDs and the Deployment URL. If a deployment fails, read its logs with
gf coderunner logs.
When an agent gets 403
Check who is calling before changing anyone's role:
| Caller | Usual cause | Fix |
|---|---|---|
Any team member, with email_not_verified | Their email address isn't verified yet | They verify it, then run gf login again. See Verify your email |
A team member, with gf token | Their workspace role is too low | Writer to change data or deploy, Admin to create collections. See Team and roles |
| An app user, from a Shell app | Their role has no grant on that collection | Grant it on Site access. New collections are open only to admin |
| A Coderunner, with an M2M token | Reading secrets without Can read secrets, or changing flags | Turn on Can read secrets; change flags with the CLI. See M2M tokens |
Don't fix an app user's 403 by giving them a team role; that grants far more than they need.
Next steps
- gf CLI — every command.
- Deploy and Shell apps — what the agent is building.