---
id: w2/m1/t001
title: MCP adapter over Core (list/get/restart/suspend/resume)
worker: worker2
status: done
estimate: 30m
depends_on: []
---

## Objective

Stand up an MCP server that exposes the existing bex-api lifecycle verbs as MCP tools, delegating to the same `Core` — a third thin adapter alongside REST and GraphQL, with no second implementation of any verb.

## Context

- `Core` already implements `List`/`Get`/`Restart`/`Suspend`/`Resume` in `operator/internal/api/core.go`; REST (`rest.go`) and GraphQL (`graphql.go`) are pure presentation over it (see `docs/ADR006-bex-api.md`).
- Ships in the same operator image as a mode/binary, like `/api` — the Dockerfile already builds a second binary; add a third command or a subcommand flag.
- App name is the service `id` (opaque round-trip), matching REST behavior.

## Steps

1. Add `operator/cmd/mcp/main.go` (or an `--mcp` mode) that constructs the same `Core` and registers one MCP tool per verb.
2. Map tool inputs/outputs to `Core` method signatures; return the updated service object (superset with `phase`/`revision`/`replicas`).

## Files

- `operator/cmd/mcp/main.go` · `operator/internal/api/` (reuse `Core`)

## Acceptance criteria

- [ ] An MCP client can call `list`/`get`/`restart`/`suspend`/`resume`; each hits `Core`, not a duplicate impl.

## Out of scope

- `logs` (t002), auth/transport hardening (t003), manifests/deploy (t004), `deploy` verb (w2/m2).
