# MCP: Safety, Previews & Limits

> How the Meshive MCP server previews spending and destructive changes, tracks operation IDs, audits API key activity, hides pod logins and other secrets, treats logs and other people's text as untrusted data, and enforces response limits.

Source: https://docs.meshive.ai/sdk-cli/mcp/safety/

Safety guardrails, write recovery, audit logging, credential handling, and limits for the hosted [Meshive MCP server](/sdk-cli/mcp/).

## Spending and deleting start with a preview

Tools that spend or delete return a preview unless the agent sets `confirm`, and the agent is told to ask you before going further. The [hosting tools](/sdk-cli/mcp/host/) follow the same rule. The tools that create (`create_workspace`, `create_pod`, `create_storage`, `deploy_serving`, `submit_task`), change (`update_workspace`, `update_pod`, `update_storage`, `connect_storage`), delete (`delete_pod`, `delete_storage`, `delete_workspace`, `delete_serving`, `delete_model`) or raise billing (`start_pod`, `pause_serving` with `paused: false`, which resumes billing, `scale_serving` when the change can raise the hourly cost — a larger replica range, autoscale on, a higher price cap — or turns on sharing idle capacity) take a `confirm` flag that defaults to off. Without it they only return an **estimate** — the hourly price and the hardware it resolved to, and for an edit the changes and the price before and after — or a **summary** of what would be deleted, started or connected, and change nothing. The server tells the agent to show that to you and to call again with `confirm` only after you have said yes in the conversation. Lowering a serving with `scale_serving` (a smaller replica count or max, or autoscale off) has no `confirm` step: replicas running above the new setting are removed within ~30 seconds and the requests they're handling fail, and the tool's answer says how many are being removed. A lower price cap removes nothing: it applies only to replicas started afterwards, so running replicas keep their GPU and hourly rate and the cost can stay above the new cap for a while; the answer says so. `register_model` and `import_asset` have no `confirm` step because they cost nothing — an imported asset is linked, not copied (the one exception, a copy out of a bucket folder, is below); the model downloads, and billing starts, only when `deploy_serving` is confirmed. `create_workspace` costs nothing by itself either, but it has the step too: without `confirm` it only shows the name (or says one will be generated) and creates nothing. `update_workspace` costs nothing as well and has the step because every member sees the new name: without `confirm` it only shows the old and the new name.

MCP server 1.11 adds more tools with the `confirm` step: `delete_asset`, `delete_asset_files`, `export_asset`, `add_pod_asset`, `remove_pod_asset`, `delete_template`, `delete_tasks`, `cancel_task_upload`, `remove_member`, `delete_credential`, `set_default_output_bucket`, `create_inference_key`, `roll_inference_key`, `revoke_inference_key`, `delete_webhook` and `set_fan_curve`. Two more need it only for some calls: `save_webhook` when it creates an endpoint, changes its URL, adds event types or turns it back on (renaming, removing event types, turning it off or only sending a test apply at once), and `import_asset` only when it copies files out of a linked bucket folder into Meshive storage. These have no `confirm` step because they spend and delete nothing: `update_asset` (rename or retype), `save_template` (a template costs nothing; pods made from it go through `create_pod`), `update_account` (display name), `cancel_inference_request` (its held credit is refunded) and `scale_serving` with only `output_bucket` or with sharing turned off.

Sharing a serving's idle capacity with other workspaces (`share_idle_capacity: true` on `deploy_serving` or `scale_serving`) needs a second flag: the preview lists the terms the console's consent dialog shows, and the agent sets `sharing_consent: true` only after you agreed to them; a confirmed call without it fails with `sharing_consent_required`. A model that can't share idle capacity is refused at the preview (`sharing_not_available`). Only the member who deployed a serving can change it (`not_serving_owner`). See [Shared serving](/serverless/shared-serving/).

A typical exchange:

1. *"Create an RTX 3060 pod from the VSCode template in my workspace."* — the agent looks up the workspace, template and GPU availability, calls `create_pod` without confirmation, and shows you: **$0.068/hour**, 1× RTX 3060 12 GB, 4 vCPU / 15 GiB RAM, 25 GiB disk.
2. *"Yes, go ahead."* — the agent calls `create_pod` with `confirm: true` and the preview's `operation_id`, then polls `pods` until the pod is `running` and reports the billed rate. If the pod doesn't appear, it calls `transactions` with the `transaction_id` that `create_pod` returned and tells you why the creation failed.
3. *"Delete it."* — the agent shows the pod it is about to delete and waits for your yes again.

Resource changes such as Pod creation are asynchronous. The agent polls the matching list tool for the new state rather than assuming it.

> **Caution:**
> `confirm` is an argument the agent sets. The server can't tell whether a person said yes, and nothing forces a preview first, so an agent with a write key that ignores these instructions can spend or delete directly. A key reaches every workspace you can access and has no spending limit of its own. Only a read-only key actually prevents writes. Read the estimate the agent shows you before saying yes, give write keys only to agents you trust, and keep them short-lived.

## Write IDs and recovery

Resource writes that use operation history require a stable **`operation_id`** (8–128 characters: letters, digits, `.`, `_`, `:`, `-`). A write preview returns one; the agent must reuse it for confirmation and every retry. For tools without a preview, such as `stop_pod`, generate a UUID before the first call. A confirmed write without a supplied ID is refused with `operation_id_required` before mutation.

`create_inference_key` and `roll_inference_key`, like `create_access_key` and `roll_access_key`, keep no operation record: a repeated confirmed call runs again, and after an unclear answer (`inference_key_outcome_unknown`) the agent reads `inference_keys` instead of calling again (MCP server 1.11+).

An error's `next_step` advises retrying with the same `operation_id` and arguments only when a write was sent and its outcome is open — a timeout, a server error, a rate limit or an operation still pending. When nothing was sent, or the server refused the write for certain (such as `invalid_argument`), the fix is a different argument, not a retry.

Two codes concern the ID itself (MCP server 1.11+). `operation_id_reused` means the ID was already used for a request with other arguments: the agent looks the earlier operation up with `operation_status` first and doesn't change the arguments to get past it; a new ID is only for a different action you asked for. `operation_outcome_unknown` means an earlier call with the same ID is still pending or its outcome is unclear, so this call didn't run it again: the agent checks `operation_status` and the matching list tool and doesn't switch to a new ID. Writes the server keeps no record of — `run_command`, `ssh_access`, `connect_storage`, the upload steps and the like — don't point at `operation_status` after a timeout or server error.

Pod commands and local uploads use their own run or upload IDs instead of these operation IDs. A repeated command can execute again; completing an upload after success returns the same Asset.

Results and errors retain the ID. When available, `operation_lookup` supplies the original `method` and `path`. To inspect an uncertain task submission without resubmitting it, call `operation_status` with:

```json
{
  "operation_id": "the-saved-operation-id",
  "method": "POST",
  "path": "/tasks"
}
```

A result with `"replayed": true` is the earlier answer for that operation, not a newly executed action. Keep the same operation ID while resolving the original request; use a new one only for a new action.

Use the SDK-relative path without `/v1/sdk` or a query string. `done` means the acceptance response was recorded, so the agent must still check the resource. `pending` and `unknown` require reconciliation; the ID does not expire automatically. `not_found` alone is not permission to replace the ID and resubmit. See the [SDK recovery states](/sdk-cli/sdk/workspaces/#recovering-an-uncertain-write).

## Activity log

Every change an API key makes is recorded with its result: which key, which client it says it came from (SDK & CLI or an MCP client — the client reports this itself, so only the key is a reliable identifier), what it did, which resource, and whether it was accepted, refused or failed. This includes writes that a known key is refused, such as a read-only key trying to delete a machine (a key refused many times in a row has only the first few refusals of each minute recorded); requests with an invalid or expired key aren't recorded. Reads are recorded only as hourly counts per resource type. Request contents, secrets and IP addresses are never stored, and the console's own actions aren't part of this log. The agent can read it with the `activity` tool (`kind: "actions"` or `"reads"`, optionally filtered by key, dates, outcome and action), and it includes the agent's own calls.

You can see the same log in the console under **Account → API keys**, in the **Actions** and **Reads** tabs, and revoke a key from there if something looks wrong. Entries are kept for 180 days in the console, then archived and deleted after about a year.

## Amounts match the console

Money fields come with a ready-made display string — for example, a pod's `price_per_hour_display: "$0.068"` next to `price_per_hour: "0.06770833"` — formatted the way the console formats them: hourly rates to three decimals, everything else to two. The agent is told to show that string and to use the raw number only for its own arithmetic, so the price it quotes you is the price you see in the console.

## Pod logins stay hidden

A pod's `connect_credentials` are the logins the console shows on Connect, such as the `ACCESS_PASSWORD` a ComfyUI pod generates. Secret values come back as `null` in every response, including the previews of `start_pod`, `stop_pod` and `delete_pod`. The agent gets a value only by asking `pods` for one pod with `show_secrets: true`, which it is told to do only when you ask for the login, and that response reminds it to give the value to you and nowhere else. With a read-only API key the value comes back as `***`, and the response says a key with write scope is needed. `ssh_access` works the same way for a one-time SSH password: the agent is told to call it only when you want to connect, it leaves out the browser-terminal link (the password is in it), and the password expires in a few minutes.

`connect_storage` gives the same kind of login to a storage volume's files, like the console's Connect. Its preview says what will happen — for [encrypted storage](/storage/encryption/), that the volume is unlocked and locks again by itself after a while — and only the confirmed call returns a password. That call waits up to `wait` seconds (0–90, default 60) for the volume to be ready; if it isn't yet, the agent is told to call again shortly. Neither `ssh_access` nor `connect_storage` keeps a replayable copy of the response, so the password can't be fetched again from an operation record.

## Other secrets

MCP server 1.11 adds more places where a secret is kept back or shown only once:

| Where | What the agent sees |
| --- | --- |
| `create_inference_key`, `roll_inference_key` | The key's value, in the confirmed answer only (`inference_key`), once. `inference_keys` never lists values. The agent is told to give it to you alone and never to use it itself or put it in files, commits, commands or other tools |
| `webhooks` | Masked URLs: a Slack or Discord URL's path is shown as `…`, and no URL's query string or user name is shown (`url_masked`). `save_webhook` refuses such secret URLs as arguments — you add them in the console || `tasks` | `env` values that aren't secret only; `secret_env_keys` names the secret ones, whose values are never returned. A secret value the API hid (`"***"`) is refused as an argument (`masked_secret_value`). The full script and requirements only with `include_code`, with a note that scripts can hold secrets |
| `templates`, `save_template` | A secret variable's value is never shown (`value_set` says one is stored), and `save_template` refuses one (`secret_value_not_accepted`) |
| `buckets`, `source_credentials` | Labels and IDs, never keys, tokens, passwords or endpoints |

## Logs are treated as data

`logs` returns whatever your container printed — and `transactions` returns the end of a failed asset download's log as `init_logs` — so anything running inside it — including third-party code you did not write — can put text in front of the agent. The tool's description, its response and the server instructions all tell the agent that log lines are untrusted data: never to follow instructions found in them, and never to call a write tool because a log line asked. The `confirm` step above is the second line: the agent is also told to get your explicit yes in the conversation before a write tool spends or deletes. Both are instructions to the agent, so use a read-only key when the agent will read logs you don't trust.

The same rule covers other text that comes from programs or other people: `logs` of a serving's replicas and a task's input download, a serving's `failure`, a pod's asset `failure_reason`, `pod_history` messages, inference requests' `error_message`, webhook deliveries' `last_error` and `request_body`, task scripts and env, a template's or image's declared env, file paths and bucket object keys, host maintenance reasons and messages, and a machine's setup log, network events and fan errors. The descriptions and server instructions mark each of them as untrusted.

## Limits

- The server exposes what the [SDK](/sdk-cli/sdk/) exposes. Creating and revoking Meshive API keys, saving Hugging Face tokens, CivitAI keys, registry logins and bucket connections, adding Slack or Discord webhooks and managing the webhook signing secret, inviting members and changing roles, changing email preferences, payout onboarding and the Stripe dashboard (under **Earnings**), and deleting a workspace that still holds things stay in the console.
- Log tools return a snapshot of the last lines (up to 1000, 64 KiB), not a live stream. For a serving, `logs` with `serving` reads the first running replica, or the one named by `replica`; a failed or stopped replica's last run is in `previous` (`replica_not_found`, `replica_logs_unavailable` and `replica_logs_expired` otherwise). For a task, `container: "fetch"` reads the download of its input assets.
- Task scripts should `print(..., flush=True)`; buffered output that is never flushed does not reach the logs.
- `submit_task` and `estimate_task` take `project` (run an uploaded folder with an `entrypoint` instead of `script`; pass exactly one), `registry_login_id` (a private `image`), `output_bucket` (a `bucket_id`, or `"managed"` for Meshive storage; left out, the workspace's default) and `paths`/`strip_prefix` on `input_assets` items (MCP server 1.11+). See [Projects](/serverless/tasks/projects/).
- `delete_tasks` deletes up to 20 finished tasks: the preview says what will happen to each one, output assets and billing history stay, and the task's script, requirements, env and args are erased. Running tasks and tasks still saving outputs are skipped. `cancel_task_upload` stops saving the rest of a finished task's outputs; files already uploaded stay and become an asset, and a task with nothing uploading is `nothing_to_cancel`.
- `submit_task` and `estimate_task` take `output_include` — glob patterns such as `["*.safetensors"]` — to upload only the matching files in `/outputs`, like the console's [Files to save](/serverless/tasks/outputs/#choosing-which-files-to-save).
- When provided, a task's `outputs` status says where saving its output files stands: its `phase` is `running` until the task ends, `preparing`, `uploading`, `retrying` or `registering` while they're being saved, then `saved`, `partially_saved`, `not_saved`, `discarded` or `empty`. A task saves a limited number of output files, usually 2,000 — see [Over the file limit](/serverless/tasks/outputs/#over-the-file-limit).
- The final tool response, including text and structured content, is limited to **1 MiB**. On `response_too_large`, request fewer items or log lines. If it followed a write, check the operation/resource before retrying: a response error does not undo an accepted write.
- For external task logs, pass the previous `next_cursor` as `cursor`; pod logs remain snapshots. Check the response `note` for freshness warnings.
