# MCP tools

Address: `https://console.boring-cloud.app/mcp`, Streamable HTTP, without sessions. To connect, see [Connect an agent](https://boring-cloud.app/docs/connect.md).

Every answer is one text block that contains JSON. When something is refused, the result has `isError: true` and this content:

```json
{ "status": "error", "code": "VALIDATION_FAILED", "message": "…", "details": {} }
```

What each code means: [Errors](https://boring-cloud.app/docs/errors.md). Arguments of the wrong type are refused before that, with a plain text that names the argument. A connection belongs to one workspace, so `workspaceId` can always be left out.

## Order of calls

1. `get_guide`, once at the start of a conversation.
2. `list_apps`, to see whether the app already exists, or `create_app`.
3. `deploy_app`.
4. Give the `url` to the person.

## Read

### `get_guide`

No arguments. Returns `{ guide }`, a Markdown text with the approved stack, brand and external APIs of this workspace, and how to build and deploy. Follow it.

### `get_runtime_contract`

No arguments. Returns the manifest rules, the runtime rules and the limits of this server as JSON.

### `list_workspaces`

No arguments. Returns the workspace of this connection, with the person's role.

### `list_apps`

Returns `{ apps: [App] }`, the apps this person can see.

### `get_app`

`appId`. Returns one App:

```json
{
  "id": "ngnez58go2clotwr",
  "name": "Supply requests",
  "description": null,
  "url": "https://a1b2c3d4e5f6g7.example-apps.net",
  "status": "active",
  "accessMode": "private",
  "hasDatabase": true,
  "currentDeploymentId": "3gqjm5hie1ewfefx",
  "currentVersion": 4,
  "myRole": "manager",
  "canManage": true,
  "canAdminister": true,
  "canOpen": true
}
```

The answer has a few more fields, such as the owner and dates. `currentVersion` is `null` before the first release. `canManage` says whether you can deploy it. An archived app has `canManage: false`: the person restores it in the console.

### `get_app_url`

`appId`. Returns `{ url, status, published, accessMode }`.

### `list_deployments`

`appId`. Returns `{ deployments: [Deployment] }`, newest first. Each has an `id`, a `version`, a `status`, `isCurrent`, and an `error` when it failed.

### `deployment_status`

`appId`, `deploymentId`. Returns one Deployment.

## Create and deploy

### `create_app`

| Argument      | Required | Rules                  |
| ------------- | -------- | ---------------------- |
| `name`        | yes      | 1 to 80 characters     |
| `description` | no       | at most 280 characters |

Returns the new App. It is private to the person. Each call creates another app, so call it once.

### `deploy_app`

| Argument         | Required                | Rules                                                                    |
| ---------------- | ----------------------- | ------------------------------------------------------------------------ |
| `appId`          | yes                     |                                                                          |
| `manifest`       | yes                     | see [Manifest](https://boring-cloud.app/docs/manifest.md)                                          |
| `worker`         | when there is a backend | one file: `{ "path": "worker.mjs", "text": "…" }`                        |
| `assets`         | yes                     | all static files, with `index.html`. At most 400                         |
| `idempotencyKey` | no                      | 8 to 100 letters, digits or `_ . : -`. Same key and content, same result |

Each file has a `path` and either `text` or `contentBase64`, never both. `size` and `sha256` are optional, and checked when you give them. The whole call can be at most 1 MiB.

Returns:

```json
{
  "status": "published",
  "published": true,
  "url": "https://a1b2c3d4e5f6g7.example-apps.net",
  "message": "Release v4 is live at …",
  "deployment": { "id": "3gqjm5hie1ewfefx", "version": 4, "status": "ready", "findings": [] }
}
```

`findings` lists risky code to fix, see [Releases](https://boring-cloud.app/docs/releases.md).

`ready_not_published` means that another release was published in the meantime. See [Releases](https://boring-cloud.app/docs/releases.md).

### `rollback_app`

`appId`, `deploymentId`. Makes an earlier release live again. Data does not go back.

## Share

Only when the person asks, with the people they name.

### `share_app`

| Argument | Required              | Rules                                                       |
| -------- | --------------------- | ----------------------------------------------------------- |
| `appId`  | yes                   |                                                             |
| `target` | yes                   | `user`, or `workspace` for every current and future member  |
| `email`  | with `target: "user"` | a person who is already a member of the workspace. People from outside are invited by a person, in the console |
| `role`   | no                    | `viewer` (default) or `manager`. Only with `target: "user"` |

### `revoke_app_access`

`appId`, and `target: "user"` with a `userId`, or `target: "workspace"`. No tool returns the ids of other people: the person removes access in the console, or you read the id with `GET /api/v1/apps/<id>/access`.

## What the tools cannot do

Open an app, read its data or files, return the code of a release, invite people, change the stack, see API keys, disable or delete an app. People do what they can of this in the console.
