Repository navigation
Description
The MCP server exposes 23 tools covering visibility, prompts, topics, content
opportunities, citations, site audits and AI traffic. None of them covers the
Action Center.
That matters more than it used to. The Action Center now holds the engine's
whole output: detected signals, the actions consolidated from them, the task
plan each action carries, the outcome measured after an action closes, and
the queue of findings waiting for a free slot. An agent connected to Ansvisor
over MCP can read what the brand's visibility is, but not what the product
thinks should be done about it — or what has already been tried and whether
it worked.
There is an irony worth naming: the engine plans tasks and marks which of
them an agent could carry out, and an agent cannot currently see those tasks
at all.
Tools to add
Read tools first — they are the useful half and carry no risk.
-
list_actions— open and recent actions for a brand, with category, kind, impact, status, outcome, assignee, due date, and task progress. Filters for status and category. -
get_action— one action in full: its payload, the signals that triggered it, its task list, and its event trail. -
list_signals— detected signals for a brand, filterable by status and kind, with the measured before/after values each carries. -
list_action_history— closed actions with their measured result, so an agent can answer "did what we did last month work".
Then the one write tool that is clearly safe, because a human already owns
the decision it records:
-
update_task_status— move a task to in_progress, completed, skipped or failed, with the skip reason where one applies.
Where the code goes
Each tool is three small pieces, and there are 23 worked examples of all
three:
- A data function in
web/src/lib/mcp/data.ts, taking theMcpAuthContextand scoping every query to what that user may see. - A
server.registerTool(...)call inweb/src/lib/mcp/server.tswith a zod input schema. Read the existing descriptions before writing new ones — they are written for a model to act on, not for a human to skim, and they say which metric is the headline and which are deprecated. - A REST route under
web/src/app/api/mcp/, mirroring the tool so the same data is reachable without an MCP client.
Add the new tools to the table in
docs/guides/mcp-server.mdx
as well.
Worth knowing before starting
- The Action Center's shapes are already modelled for the web in
web/src/lib/actions/action-center.ts
and
web/src/lib/actions/action-history.ts.
Those read as the signed-in user through RLS; the MCP data layer takes an
auth context instead. Reuse the field naming, not the functions. - An action's
kindis a server-side definition id and the set grows on its
own release cycle, so treat it as an opaque string rather than an enum. - Task rows carry
mode(manualoragent) andpermission(noneor
approval). Return both — an agent deciding what it may attempt needs
them, and the second one exists precisely so that nothing external is
attempted without a human saying yes.
Out of scope
Anything that would let an agent execute a task rather than report on it.
The execution layer, its approval flow and its audit trail are being designed
separately; this issue is about making the Action Center readable.
Activity
feat(mcp): expose the Action Center through the MCP server (ansvisor#902