Groundfloor Docs

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:

.mcp.json
{
  "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

ToolGives the agent
whoami, workspace_contextWho's signed in, and what's in the workspace: Coderunners, apps, environments and more
workspaces_listThe workspaces you can access
docs_list, docs_getThese docs, by topic, such as coderunner, shell, feature-flags, databases
suggest_cliThe 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_logsYour Coderunners, their status and their logs
apps_list, apps_get, environments_list, secrets_list, flags_list, files_listWhat exists. Secret values are never returned
apps_auth_getA 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_listYour 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_listA 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_statusThe status of the workspace's data plane
quota_get, billing_summaryYour organization's plan usage and limits, and spend (Owners, Admins and Billing admins only)
coderunner_cancel_deploymentDeletes a deployment
coderunner_bind_environmentPermanently binds a Coderunner that has no environment to one. Needs Groundfloor MCP 0.2.13 or later
coderunner_invoke_accessReads 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_deployment on "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_environment and coderunner_invoke_access below, 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.

  1. Pick the path from the goal.

    The user wants…Do thisDon't
    To run code: a function, job, schedule or servicegf deployCreate an app for it
    To publish a Shell app's UIgf apps init, then npm run release and gf apps publishRun gf deploy on the starter kit
    To package an existing Service as a productgf apps create --kind standalone --primary-coderunner <id>—
  2. Inspect before acting. Call workspace_context and docs_get, then run the command suggest_cli returns. Don't call coderunner_cancel_deployment unless the user asked you to delete a deployment, or coderunner_bind_environment until the user has chosen the environment.

  3. 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 --yes when there's no terminal, so check it's the right one first.

  4. Never put secrets or .env files in code or uploads. Store them in Secrets and read them at runtime; see Configuration and secrets.

  5. 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.

  6. 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:

CallerUsual causeFix
Any team member, with email_not_verifiedTheir email address isn't verified yetThey verify it, then run gf login again. See Verify your email
A team member, with gf tokenTheir workspace role is too lowWriter to change data or deploy, Admin to create collections. See Team and roles
An app user, from a Shell appTheir role has no grant on that collectionGrant it on Site access. New collections are open only to admin
A Coderunner, with an M2M tokenReading secrets without Can read secrets, or changing flagsTurn 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

On this page