mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
Relates to #25381 `chat_mcp_servers.headers_key_id` has a foreign key to `dbcrypt_keys(active_key_digest)`, but `dbcrypt rotate`, `decrypt` and `delete` didn't know about the table. `rotate` finishes by revoking every old key, so an encrypted header row would fail that revoke with an FK violation, which is the same class of bug as #25381. This PR adds `chat_mcp_servers` to all three commands. `rotate` re-encrypts under the new key (and encrypts plaintext rows with no key ID, like `gitsshkeys`), `decrypt` writes the plaintext back and clears the key ID, and `delete` removes the encrypted rows outright, like `user_secrets`, since a server without its headers can't authenticate anyway. Rows with `{}` headers are never encrypted, so they're left alone. The org-level `mcp_server_configs` gap is still tracked at #25381. I've stacked this on the `mcpclient` PR, though it only depends on the `chat_mcp_servers` table PR, as `gh stack` is linear. Part of CODAGT-1131