Skip to content

feat(mcp): expose the Action Center through the MCP server - #902

Merged
gkhngyk merged 1 commit into
mainfrom
feature/mcp-action-center
Oct 4, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/mcp-action-center

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Summary

An agent connected over MCP could read a brand's visibility, but not what the product thinks should be done about it, or whether past work helped. This adds the Action Center to the MCP server: four read tools and one narrowly scoped write.

Tool What it returns / does
list_actions Actions with category, kind, impact, status, outcome, assignee, due date and task progress, most recently updated first. Filter by status or category.
get_action One action in full: payload, triggering signals, tasks and event trail.
list_signals Detected signals with previous, current and change values, payload and the action they were consolidated into. Filter by status or kind.
list_action_history Completed or dismissed actions with their outcome and the before/after values the validation sweep measured.
update_task_status Moves a task to in_progress, completed, skipped (with skip_reason) or failed.

Details

  • Every tool follows the existing three-part pattern:
    • a data function in lib/mcp/data.ts that checks the brand or action belongs to the API key's org;
    • a registerTool call in lib/mcp/server.ts;
    • a REST mirror under /api/mcp/ (actions, actions/[id], signals, action-history, action-tasks/[id]/status).
  • kind is returned as an opaque string, as the issue asks.
  • update_task_status follows the same rules as the dashboard:
    • It checks ownership before any write.
    • A skip needs a reason.
    • The change is logged as a task_status event under the key's user.
    • The action's updated_at moves.
    • It records progress and never carries a task out. Approval states are not settable over MCP.
  • The list omits the action payload, which can reach 15 KB; get_action returns it. Signal payloads are small (p95 ≈ 0.5 KB), so list_signals includes them.
  • Task mode and permission are returned exactly as stored. The issue described them as manual/agent and none/approval, but the live constraints are system | agent | human | human_or_agent and read | write | execute. The get_action description uses the real values.
  • The two-level !inner ownership filter on action_tasks → actions → brands was checked read-only against the live database: it finds a task for the owning org and returns null for any other.
  • docs/guides/mcp-server.mdx lists the five new tools.

Related issue

Closes #832

Type of change

  • feat — New feature

How to test

With an ans_ API key from Settings:

curl -H "Authorization: Bearer ans_…" "http://localhost:3000/api/mcp/actions?brand_id=<id>"
curl -H "Authorization: Bearer ans_…" "http://localhost:3000/api/mcp/actions/<action_id>"
curl -H "Authorization: Bearer ans_…" "http://localhost:3000/api/mcp/signals?brand_id=<id>"
curl -H "Authorization: Bearer ans_…" "http://localhost:3000/api/mcp/action-history?brand_id=<id>"

Or connect Claude Desktop or Claude Code and ask for a brand's open actions.

lib/mcp/action-center.test.ts covers update_task_status:

  • no write for another org's task;
  • a skip without a reason is refused before any query;
  • the update and event payloads;
  • skip_reason is cleared for other statuses.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • yarn test (377 passed) and yarn build pass
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

An agent connected over MCP could read a brand's visibility but not what
the product thinks should be done about it, or whether past work helped.

Read tools:
- list_actions: actions with category, kind, impact, status, outcome,
  assignee, due date and task progress; filter by status or category.
- get_action: one action in full, with payload, triggering signals, tasks
  (including each task's mode and permission) and event trail.
- list_signals: detected signals with previous, current and change values;
  filter by status or kind.
- list_action_history: completed or dismissed actions with their outcome
  and the before/after values the validation sweep measured.

Write tool:
- update_task_status: in_progress, completed, skipped (reason required) or
  failed. It checks ownership before writing, logs a task_status event
  under the API key's user and bumps the action's updated stamp, the same
  as the dashboard. It records progress and never carries a task out.

Each tool has a REST mirror under /api/mcp/, and the docs table lists the
new tools.

Closes #832
@gkhngyk
gkhngyk merged commit 5ca4360 into main Oct 4, 2026
7 checks passed
@gkhngyk
gkhngyk deleted the feature/mcp-action-center branch October 4, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(mcp): expose the Action Center through the MCP server

1 participant