mig: add MCP approval workflow tables - #5035
Conversation
|
There was a problem hiding this comment.
cubic analysis
All reported issues were addressed across 4 files
Linked issue analysis
Linked issue: AIS-466: mig: MCP approval workflow schema
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | PR is a migration (mig:) PR with the new MCP approval workflow schema committed | PR title uses the mig: prefix and the repo contains a new migration file and schema updates as part of this commit. |
| ✅ | Create mcp_approval_requests table with expected fields (target_kind, target_raw, target_key, current_evidence, evidence_version, artifact_ref, version_pinned, risk_policy_bypass_request_id, status, timestamps, soft-delete) | schema.sql contains CREATE TABLE IF NOT EXISTS mcp_approval_requests with the listed columns, constraints, and comments. |
| ✅ | Create mcp_approval_request_requesters table (requester rows attached to a request) | schema.sql and the migration file include mcp_approval_request_requesters with foreign key to mcp_approval_requests and required columns. |
| ✅ | Create mcp_research_reports table for agent findings (report JSONB, run metadata, timestamps) | schema.sql and migration add mcp_research_reports with report JSONB, versioning, model/prompt fields, timestamps, and FK to mcp_approval_requests. |
| ✅ | Create mcp_approval_decisions table (append-only decisions with evidence_snapshot, rationale, granted_principal_urns, decided_at) | schema.sql and migration add mcp_approval_decisions with evidence_snapshot JSONB, rationale, granted_principal_urns, decided_at, and FK relations. |
| ✅ | Regenerated committed DB models (models.go) matching the new schema | server/internal/database/models.go includes new generated types for McpApprovalRequest, McpApprovalRequestRequester, McpResearchReport, and McpApprovalDecision consistent with the schema additions. |
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
|
|
||||||||||||||||
|
|
||||||||||||||||
c9115b4 to
da1f26d
Compare
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
da1f26d to
921bed8
Compare
|
@cubic-dev-ai review this PR |
Schema foundation for the MCP approval workflow (AIS-466): a request-and-approve
flow for unverified MCP servers, where an admin decides with assembled evidence
rather than the platform issuing a verdict.
Migration only — no application code. The services that read these tables follow
in later PRs.
Tables
mcp_approval_requestsmcp_approval_request_requestersmcp_research_reportsmcp_approval_decisionsWhy these are separate from
risk_policy_bypass_requestsThe existing bypass request means "let me past this block": personal, one-off,
keyed per requester, satisfied by granting
risk_policy:bypass. An approvalrequest asks whether a server is allowed at the organization at all — durable,
carrying an evidence trail and a re-review lifecycle.
The two are linked rather than merged: a block still mints a bypass request, and
mcp_approval_requests.risk_policy_bypass_request_idrecords a promotion.Bending one record into the other would have compromised both.
Design notes
Evidence is JSONB in two places, deliberately.
mcp_approval_requests.current_evidenceis a refreshable cache of the latest signal gather.
mcp_approval_decisions.evidence_snapshotis a frozen copy taken at decision time. The duplication is the point: a decision
record has to show what the reviewer actually saw, so it must not follow a later
refresh. JSONB rather than columns because the payload is only ever read back
whole for one request, and the signal set grows as sources are added.
Decisions are append-only. A re-review adds a row rather than replacing one,
so the sequence of decisions on a server becomes the history that a chat channel
does not preserve.
granted_principal_urnsrecords the resolved blast radius —requester, team, or organization — rather than a mode, keeping the audit trail
honest about who was actually given access.
Approvals are project-scoped, matching
risk_policiesand the shadow-MCPenforcement path so a decision can reconcile into existing grants.
No enum
CHECKconstraints onstatus/decision; allowed values arevalidated in application code per the schema conventions. The
CHECKs presentare structural (
jsonb_typeof(...) = 'object'), matchingrisk_policy_bypass_requests.target_dimensions.Migration safety
All four tables are new, so no
ACCESS EXCLUSIVEscan on an existing table andno PG305/PG306 lint warnings. Applied locally and
atlas migrate diffreportsthe directory synced with
schema.sql.Summary by cubic
Add MCP approval workflow schema (AIS-466). Introduces project-scoped approval requests, requesters, research reports, and append-only decisions with frozen evidence to support admin review of unverified MCP servers.
mcp_approval_requests,mcp_approval_request_requesters,mcp_research_reports, andmcp_approval_decisions.target_kind+target_key), composite FKs(request_id, project_id)so child rows can’t cross projects, unique(report_id, request_id)so decisions only cite research for the same request, unique(request_id, user_id)to dedupe requesters, and non-partial indexes to back ON DELETE cascades.evidence_versionon decisions has no default; ships a new migration and regeneratedserver/internal/database/models.go.Written for commit 921bed8. Summary will update on new commits.