Repository navigation
Description
What
Add a new MCP tool update_opportunity_status (plus a parallel
REST endpoint at /api/mcp/content-opportunities/[id]/status) that
moves a content opportunity between workflow states (new, sent,
in_progress, done, dismissed) so MCP-driven flows can close the
loop on the content backlog.
Fourth of four small issues that expose the content-opportunity layer
to MCP/skills (after #64, #65, #66).
Why
The other three tools (list / get / generate brief) are all read
or read-derived. Without a way to update status from MCP, the user
ends up doing the analysis in Claude and then has to manually click
through the dashboard to mark an opportunity as in_progress or
done. This tool makes the AEO Coach skill a real content-workflow
companion: "I'm working on this brief now" → status flips
automatically.
Signature
update_opportunity_status(
opportunity_id: string (uuid, required),
status: 'new' | 'sent' | 'in_progress' | 'done' | 'dismissed'
) →
{ id, status, updated_at }
Where to change
1. Shared data layer
web/src/lib/mcp/data.ts — add
updateOpportunityStatusFor(auth, opportunityId, status):
- Ownership check via
auth.organizationId(join through brand) - Validate
statusis one of the allowed values - Update
content_opportunities.status+updated_at - Return the new row id + status + updated_at
- Return
null(→ 404) if the opportunity doesn't belong to the
caller's org
2. MCP tool registration
web/src/lib/mcp/server.ts — register update_opportunity_status
with a zod schema requiring opportunity_id (UUID) and status
(enum). The description should explicitly include all five status
values so the model knows what's valid without guessing.
3. REST endpoint
web/src/app/api/mcp/content-opportunities/[id]/status/route.ts —
PATCH handler. Authenticate, parse JSON body for status, call data
function, return the updated row.
How to verify
-
curl -X PATCH /api/mcp/content-opportunities/<UUID>/status -d '{"status":"in_progress"}'with a valid API key updates the
row and returns the new status - An invalid status value returns 400 with a clear error
- An opportunity ID belonging to a different organization returns
404 (no update should happen) - MCP tool call from Claude Desktop: "Mark that opportunity as
done" → tool fires with status='done', dashboard reflects the
change after refresh - The dashboard's Content Opportunities page picks up the status
change on its next data load
Out of scope
- Bulk status updates (single-row only — matches the simple flow
most MCP users want) - Webhook firing on status changes — the dashboard
/bulk/send-webhook
flow stays separate; this tool only flips the status field - Adding a free-form
noteor audit-log entry on the status change
(could be a later enhancement)
Contribution guide
See CONTRIBUTING.md for branch
naming, commit conventions, and PR workflow.
Activity
feat(mcp): expose update_opportunity_status tool for workflow transit…
feat(mcp): expose update_opportunity_status tool for workflow transit…