레퍼런스HTTP APIAgents

Save the agent's MCP settings

PUT
/v1/agents/{id}/mcp/settings

Replaces the agent's whole settings row in one transaction and makes no release: a new session reads it at once, a change that narrows reaches running sessions too, and a change that widens only sessions that start after it. expected_revision is settings_revision as read (null when there was no row); another value answers 409 REVISION_CONFLICT. updated_by is always the caller, so the first person's save of an agent also fixes the rollback floor at the snapshot-reading image. A server the save adds must be in the catalog (400 server_unknown; server_builtin for the built-in one); every allowed_tools name must be mcp__<server>__<tool> of the chosen server (tool_outside_server; the name has no spaces or control characters and is at most 128 characters), a tool the save adds that the active release's profile blocks is refused (mcp_tool_denied; a tool the row already holds can still be narrowed away), with no server there are none (server_required), and the server's credential name must be in credential_refs (server_credential_missing). A repeated tool or credential name is refused (duplicate). Binding the credentials is not required to save. Writes a set_agent_mcp receipt with result.change = "settings" and the names before and after; receipt_id is null when a person's row already held them. Agent managers with a web session only; API keys are refused.

Auth: cookie session only; no scope. Idempotency-Key: ignored.

Authorization

cookieSession
cookie__Host-werft_session<token>

For the web console: the browser session cookie set by POST /v1/auth/login. It holds the scopes of the user's workspace role (owner: all; admin and member: all but sessions:recover). Requests other than GET must also send X-Requested-With: werft-web.

Path Parameters

id*string

The agent's id.

Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Header Parameters

X-Requested-With?"werft-web"

Required with a cookie session: the literal werft-web.

Value in"werft-web"

Request Body

application/json
  1. body
expected_revision*|null
settings*

Response Body

Saved.

application/json
  1. response
settings_revision*integer
Range0 < value <= 9007199254740991
receipt_id*|null
Example Request
curl -X PUT 'https://example.com/v1/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08/mcp/settings' \  -H 'Content-Type: application/json' \  -d '{  "expected_revision": 2,  "settings": {    "server": "docs",    "allowed_tools": [      "mcp__docs__read"    ],    "credential_refs": [      "docs-key"    ]  }}'
Example Response
{  "settings_revision": 3,  "receipt_id": "c4a1e9d2-7b3f-4e8a-a6c5-1d2e3f4a5b6c"}