# MCP delegation

**Last updated:** 2026-11-15T01:35:00-03:00 (UTC-3)

Two delegated workflows let teams take part in MCP administration without gaining trust or grants: team administrators propose MCP servers for review, and each team sees and ends the [MCP ingress](/docs/features/mcp-ingress/) sessions its keys hold.

| Flag | Default | What it turns on | Requires |
| --- | --- | --- | --- |
| `mcp_submissions` | `false` | Team proposals of MCP servers | `mcp_connect` |
| `mcp_session_management` | `false` | Session listing and audited termination | `mcp_ingress` |

Both are operator controls under plan entitlements.

## Team submissions

A team administrator proposes a remote MCP server for one team they administer (console **Team MCP → Propose a server**, or the API below). The proposal uses the same ID and endpoint rules as a reviewer's own draft: an `https` URL (plain `http` only on loopback, and only with `mcp_execution.allow_loopback_http`), without credentials, query or fragment. It never carries a credential: its auth is `none`.

The proposal enters the [review queue](/docs/features/mcp-execution/) as `pending_review`, marked with `source: submission` and `submitted_team`. Nothing contacts the server until a global reviewer (`mcp_connect:manage`) runs **Test**; nothing runs until the reviewer approves tools of a recorded snapshot. Delegation changes neither of those rules:

- approvals of a submission can grant **only the submitting team**; any other team is refused with `400 submission_grant_forbidden`, enforced in the approval transaction;
- network trust stays the boot egress policy, limited to the server's own origin, with private and loopback addresses refused unless the boot policy allows them;
- a team administrator cannot test, approve or read the review queue.

The submitting team sees its proposals with their status, the reviewer's notes and the approved tools granted to it, never other teams' grants. A proposal can be withdrawn while it is a draft, waiting for review or rejected; once approved or disabled it stays with the reviewer. The submitter's notes are kept apart from the reviewer's notes. A withdrawal of a server with a grant history closes it with a `delete` revision ([discovery history](/docs/features/mcp-discovery-history/)). An ID declared in YAML always belongs to the YAML entry: it cannot be submitted, and a managed server registered under it before YAML declared it never becomes its trust.

| Route | Permission | Behavior |
| --- | --- | --- |
| `GET /api/v1/admin/mcp/submissions` | `mcp_submissions:submit` | Proposals of administered teams (a global administrator sees all) |
| `POST /api/v1/admin/mcp/submissions` | same | `{"id","name","endpoint_url","team_id","notes"}`; 403 `team_forbidden` for a team the caller does not administer |
| `DELETE /api/v1/admin/mcp/submissions/{id}` | same | `{"version"}`; withdraws a non-active proposal |

`mcp_submissions:submit` belongs to `team_admin` (and `admin`). Every write is in the identity audit as `mcp_server.submit` or `mcp_server.withdraw`.

## Sessions

Every MCP ingress session has an owner: the key that opened it, that key's team and, for a user-owned key, its user; and a scope: one server, or the composed endpoint. `GET /api/v1/admin/mcp/sessions` lists them newest first (filters `key_id`, `team_id`, `server_id`, `open=true`, `limit` 1-200, `cursor`); an expired open session is reported with `termination_reason: expired`. Session tokens are never returned, only the public `mcs_…` ID that the [execution trail](/docs/features/mcp-execution-audit/) also records.

`POST /api/v1/admin/mcp/sessions/{id}/terminate` ends an open session. The next message of that session answers 404 on every replica, so the client must initialize again with its key; calls of the session running on the replica that receives the request are cancelled, and a call already sent is recorded `uncertain`. The audit row `mcp_session.terminate` is written in the same statement as the termination, with reason `administrator` (admin, operator) or `team_administrator`.

| Role | Lists | Ends |
| --- | --- | --- |
| `admin`, `operator` | every team | every team |
| `viewer` | every team | no |
| `team_admin` | its teams | administered teams |
| `team_viewer`, `user` | its teams | no |

The team scope is applied before filters and paging, so a `team_id` filter never widens it. Ending a session revokes nothing else: the key, its grants and other sessions are unchanged; to stop a key, revoke the key.

## Console

**Team MCP** (developer menu) shows the proposal form and table to team administrators and the open sessions, with **End** where the role allows it.

## Upgrade

Migration 153 adds `submitted_team` and the `submission` source to `gateway_mcp_managed_servers` with a NOT VALID shape check. Sessions need no migration beyond the ingress (152). Upgrade every replica before turning either flag on.
