---
id: w2/m7/t006
title: MCP tools — `create_key_value` / `list_key_value_instances` / `get_key_value`
worker: worker2
status: done
estimate: 30m
depends_on: [w2/m7/t002]
---

## Objective

Ship Render's official MCP tool set for Key Value with schemas matching `render-oss/render-mcp-server` (per t001): `create_key_value`, `list_key_value_instances`, `get_key_value` — thin wrappers over the t002 core, following `internal/postgres/mcp.go`. Agents managing a bex workspace get the identical tool vocabulary they'd have against Render.

## Context

- `lego/backend/internal/postgres/mcp.go` — tool registration, input schema style, text-output shape.
- Render's MCP server has no delete/suspend KV tools (verify in t001) — match their set exactly; extras would be drift, note any deliberate addition in the ledger instead.
- Connection info exposure via MCP per capture (Render's `get_key_value` output may include or omit the connection string — follow the capture).

## Steps

1. Register the three tools with captured names/schemas; delegate to the core.
2. Ensure the tools appear over both MCP transports (HTTP + `BEX_MCP_STDIO`).
3. Tool-level tests per the postgres MCP test pattern.

## Files

- `lego/backend/internal/keyvalue/mcp.go` (new)
- MCP server registration point

## Acceptance criteria

- [ ] Tool list shows the three Render names with matching input schemas.
- [ ] `create_key_value` → CR created → `get_key_value` reflects Ready state end to end.
- [ ] Backend tests green.

## Out of scope

- Additional bespoke KV tools beyond Render's set.
