Keystone Developers
Open Keystone
Guides

MCP

The agents deployment

The in-cluster deployment of the MCP server that Ask Keystone's runs call under run tokens, and how an act is held for a person's yes.

Ask Keystone, the assistant, runs in workflow-engine. When a run works on a business it calls the same tools a person does, through a second deployment of the same MCP server. That deployment is reachable only inside the cluster, admits only workflow-engine's assistant, and takes run tokens only: a person's MCP token is a 401 there. Nothing on this page is callable from outside Keystone; it is documented because the tools, the Edits API and the console all meet it.

Run tokens

The assistant asks the Auth service for a run token once per run: POST /api/v1/internal/agent-run-tokens (Auth internal API), under a key only it holds. The token names one business, the run, the agent type (sub: agent:<type>), the actor type the run acts for (BUSINESS_USER, KEYSTONE_ADMIN, SYSTEM or CONTACT) and the tools the run may call, and lives 15 minutes.

Its tools

A run's tools are the capabilities its token lists, with the same names and parameters as a person's (tool reference). The model never names the business: each call goes to POST /api/v1/edits/agent-tools/{tool} with the run token and the deployment's own key, and SOR takes the business from the token and checks the tool's rule again.

A call's input is args (the capability's parameters) and an idempotency_key, which an act requires. Called again with the same key, after a timeout, SOR answers as the first call did.

Acts held for a yes

An act (marked "May be held in a run" in the reference) is one call. It also says the person's message the run answers (asked_in) and whether the run read text from outside the business since (context_untrusted). SOR runs it as asked when the person's own message asked for it, or the run's routine has a standing yes for it. Otherwise SOR holds it as a Needs you item about its record and answers at once {"status": "held", "why": …, "item": …}; the run does not wait.

The item's Approve button is the act itself. Whoever presses it, from Needs you or the chat, runs the act as the run that asked, with themselves as its approver; marking the item done declines it. When the item ends, SOR tells the run's thread: a routine's run carries on, and a person's chat shows it as a note.

Tools whose rule is NONE or POLICY_DRIVEN run when called.

Where to look

The contractspecs/capabilities.json in this site, a copy of sor-service contracts/capabilities.json. The server reads SOR's current one (GET /api/v1/edits/agent-tools) at boot and every 5 minutes, and falls back to its own copy.
EnforcementSOR app/modules/edits/auth.py (agent_caller: run token and the deployment's key) and the Edits API's agent-tools routes.
Token issueHeimdal POST /api/v1/internal/agent-run-tokens.
The serverkeystone-mcp packages/server/src/tools.ts (registerRunTools).