Skip to main content
Glama
Axonity Flow MCP Server

Axonity Flow MCP Server

Official
by AxonityAI
README.md
# @axonity-ai/mcp — Axonity Flow MCP connector

A local [Model Context Protocol](https://modelcontextprotocol.io) server that lets
an external agent (e.g. **Claude Code** on your laptop) read, draft, update, and
recoverably delete **workflows, agents (with their persona), tools, skills,
policies, reference docs, output schemas, prompt snippets and methods** in your
Axonity tenant —
the same verbs the internal Builder team has, minus direct publish.

It runs on your machine and talks to Axonity **only over the public REST API**,
authenticated with a token for one workspace. The backend re-enforces
tenant + scope on every call, so the connector is not a trust boundary for what
it may do in Axonity. One thing only the connector decides: which **local file**
leaves your machine. `upload_run_input_file` with `path` and `start_workflow_run`
with `triggerInputPath` read any file the user running the connector may read,
following symlinks, with no folder they are limited to, and the platform cannot
tell what the file is. Use them with a connector running locally for someone who
trusts it, and check the path before you approve the call — your MCP client's
approval of each call is the guard.

## Setup

1. **Have a token.** The connector sends whatever `AXONITY_TOKEN` holds as a
   bearer, and the platform decides what it may do:
   - a **personal token** (`axp_…`) acts as you, within the limits it was made
     with (see *Hosted by Axonity* below for what that means per tool);
   - an existing **service token** (`axs_…`) keeps working until it expires or
     is revoked, but no new ones are made.

   Every token expires, and there is no way for the agent to check the
   remaining lifetime in advance: an expired token fails exactly like a revoked
   one, so get a fresh one when that happens. Copy a token once; you will not
   see it again.
2. **Add the connector to Claude Code:**

   ```bash
   claude mcp add axonity \
     --env AXONITY_TOKEN=your_token_here \
     --env AXONITY_API_URL=https://app.axonity.ai \
     -- npx -y @axonity-ai/mcp
   ```

   `AXONITY_API_URL` is optional (defaults to the Axonity SaaS URL); set it if you
   self-host.

   Do **not** pass extra CLI arguments to `axonity-mcp`; startup only reads
   environment variables. If arguments are supplied, the process exits with a
   clear usage-style error.

3. Ask Claude Code things like *"list my Axonity workflows"*, *"create a workflow
   called Onboarding"*, or *"add a step to workflow X"*.

## Tools

586 tools total (28 of them the old `flow` names, see Methods below). `axonity_conventions` (read this first) covers the authoring
rules — drafts vs live, optimistic locking, per-entity fields, delete/restore,
and how to tell a retryable error from one that will never succeed.
`axonity_semantic_conventions` is its counterpart for one job only: building a
workspace's semantic layer. Both serve the platform's own rules, read live —
there is no copy of them in this repository.

What the connector does **not** state is as deliberate as what it does: the
mutation commands, the step types, the trigger types, the schedule-rule shapes
and the three value vocabularies are all read live from
`get_workflow_authoring_spec`, because every one of those lists drifted while it
was kept here. A conformance test asserts their absence.

### The generic entity family

Fifteen entities — **workflow, agent, tool, skill, policy, reference_doc,
output_schema, prompt_snippet, method, data_table, measure, query, application,
table_database, toolbox** —
share one shape,
though not every entity gets every verb (see the per-entity notes below for the
exceptions):

| Tool (per `<entity>`) | What it does |
|------|--------------|
| `list_<plural>` | List the tenant's entities. |
| `read_<entity>` | Read one by id (incl. its version — read before you update). |
| `create_<entity>` | Create a new **draft**. |
| `update_<entity>` | Update a draft (`expectedVersion` in the body; 409 on a stale write). |
| `delete_<entity>` | Soft-delete. **Recoverable** — see `restore_<entity>`. |
| `restore_<entity>` | Undo a delete. No version check. Takes an optional `name` on the ten entities whose name is unique (see *Archive and the Trash*). |
| `list_deleted_<plural>` | Restore candidates. |
| `archive_<entity>` / `unarchive_<entity>` | Archived is its own act, not a delete: out of use and out of the lists, back as it was. On a kind with versions only a draft can be archived. Sixteen entities: every one above, and the three below except `table_relationship` — see *Archive and the Trash*. |
| `discard_<entity>_draft` | Reset the draft to the last published state. |
| `request_publish_<entity>` | Ask for a draft to be published — creates a pending approval; never publishes. |

Exception: `list_data_tables` (like `list_measures`, `list_queries`,
`list_applications` and `list_table_databases`) answers **one page**, not the whole library — see Tables
below.

Three more entities use the same verbs **without** the draft ones —
**data_source, table_relationship, dashboard**. None is versioned: a change is
live when it is saved, so there is no `discard_*_draft` and no
`request_publish_*`. Their lists are paged like `list_data_tables`. See
Warehouses and dashboards below.

Some list routes narrow in the query, which is where narrowing belongs — the
backend applies it before the rows come back:
`list_workflows({ stageId?, capabilityId?, archived? })`,
`list_agents({ includeSystem?, archived?, conversational? })`,
`list_tools({ archived? })`,
`list_skills({ archived? })`,
`list_policies({ scope?, ownerId?, archived? })`,
`list_reference_docs({ scope?, ownerId?, archived? })`,
`list_output_schemas({ archived? })`,
`list_prompt_snippets({ deleted?, archived? })`,
`list_methods({ archived? })`,
`list_data_tables({ name?, archived?, isDynamic?, filledBy?, databaseId? })`,
`list_table_databases({ kind?, archived? })`,
`list_data_sources({ enabled?, archived? })`,
`list_table_relationships({ tableId? })`,
`list_measures({ tableId?, archived? })`,
`list_applications({ name?, archived? })`,
`list_queries({ dataSourceId?, archived? })`,
`list_dashboards({ archived? })`.

That table is **generated** from the pinned schema's own query parameters
(`npm run generate:filters` → `src/generated/listFilters.ts`), not hand-listed.
A filter the backend adds is exposed as soon as the snapshot is refreshed, and
a test fails if the two have parted. The argument names are camelCase; the wire
keeps whatever spelling each route declares, which is not consistent between
them and is not something a caller should have to know.

Plus:
- `get_workflow_authoring_spec` — everything **this deploy** can be built from,
  read live from the server (`GET /workflows/operations`): the mutation
  `operations`, the `triggerTypes`, the `stepTypes` (including the ones you may
  not author, each with the reason and what to write instead), the
  `scheduleRuleKinds` (each with an example the backend round-trips through its
  own parser as it serves it), and **three vocabularies for a value's type that
  are not interchangeable** — `parameterTypes` (a trigger parameter's or
  workflow constant's `type`), `outputKinds` (a step output's or input's
  `kind` — narrower, *different key*) and `schemaFieldKinds` (inside a field's
  `schema`, which wins where present), plus `decisionEvaluators` (what a
  decision may branch with) and `tableColumnKinds` (a table column's kind).
  Getting the three value vocabularies wrong is silent:
  a `kind` written on a trigger parameter is not a 422, it is a key nothing
  reads, so the value falls back to text. Every list is generated from the
  registry that *enforces* it, so the connector states none of them and a new
  value is discoverable without a release here. `operations` is an index by
  default; pass `types` for a command's live payload schema. `rulesVersion` is
  a content hash over all of them — same hash, nothing to re-fetch.
- `get_entity_authoring_contract` — the platform's **create contract per
  entity kind** (`tool` with each type's implementation, `agent` with its
  persona, `application`, `measure`, `query`, `data_table`, `output_schema`,
  `policy`, `skill`, `reference_doc`, `prompt_snippet`, `toolbox`, `secret`,
  `conditional_trigger`, `trigger_element`), read live from
  `GET /api/v1/authoring/entity-contracts` (axonity-flow#2103):
  `{ kinds, contracts, rulesVersion }`, per kind the create/update fields and
  the `publish.rules` that stop it going live. Pass `kinds` to narrow it (sent
  as `?kinds=a,b`; an unknown kind is the platform's 422). On a backend that
  does not serve it yet it says so plainly; it never falls back to a copy. The
  per-entity notes in `axonity_conventions` are marked subordinate to it.
- `apply_workflow_mutations` for structural workflow edits (add steps, connect
  edges) via mutation commands, sequenced and version-threaded for you.
- `replace_workflow_document` for one-shot full-document replacement in a single
  atomic PUT.
- Both end with the platform's **catalog-checked verdict**: the connector runs
  `validate_workflow` on the stored workflow after the write and returns it,
  verbatim, as `validation` (`catalogChecked`, `launchable`, every issue). The
  write's own `launchable` is structural only. None of the platform's checks
  asks whether the editor can draw the document (#65).
- `read_workflow_trigger_parameters` — how to start the workflow:
  `{ triggers, constants }`, every start with its own parameters and a `pinned`
  flag marking the values the author owns.
- `bulk_delete_workflows` — soft-delete several at once (each with its own
  `expectedVersion`).

### Methods (formerly flows)

A **method** is how an agent works through a workflow step: a set of steps, each
saying where it goes next. Flow renamed it from "flow" (agent-first R6), and the
connector follows: the tools are `list_methods`, `read_method`, `create_method`,
`update_method`, `delete_method`, `archive_method`, `request_publish_method` and
the rest of the generic family above, the version tools
(`list_method_versions`, `read_method_published`, …), `clone_method`
(takes an optional `name`; the route needs a body, and a bare POST was a 422),
`read_method_used_by` (the agents that run it, and the workflows, `published` or
`draft`), and the prompt tools on a method's steps (`list_method_step_prompts`,
`attach_prompt_snippet_to_method_step`, `update_method_step_prompt`,
`reorder_method_step_prompts`, `detach_prompt_snippet_from_method_step`,
`read_method_prompt_stacks`). They call `/api/v1/methods`, `/api/v1/method-steps`
and `/api/v1/method-step-prompts`, and name the kind `method` in a publish
request.

What the backend does, and what the descriptions say after it: `methodSteps`
on an update replaces the whole step list; a step's transition names its target
by step name or by the id a read gave it, and a target that is no step is
refused; a step with no transition ends the method; the start is pinned on every
save, so reordering never moves it (`firstStepName` moves it); a published
workflow that runs a method blocks `delete_method` and `archive_method`.

**The old names still work for this release.** Every tool with `flow` in its
name (28 of them, listed in `test/methods.test.ts`) stays registered beside its
new name, begins with `DEPRECATED — the old name of …`, takes its old argument
names (`flowId`, `flowStepId`) and makes the same call on the new route. Also
still read: `flowSteps` in `fields` as `methodSteps` (both in one call is an
error), and `flow` as a kind in `request_publish_bulk` and
`list_workflows_using` (sent as `method`). All of it goes in the next release;
`src/tools/aliases.ts` is where to look.

### Archive and the Trash

**Archived** is an explicit choice beside Draft and Published ("I no longer want
to see this"), made with `archive_<entity>` and undone with `unarchive_<entity>`
on workflow, agent, tool, skill, policy, reference_doc, output_schema,
prompt_snippet, method, data_table, measure, query, application, data_source and
dashboard. The routes are `POST /{entity}/{id}/archive` and `/unarchive`, with
no body and no version, and answer `{ id, archived, changed, archivedAt }`;
doing it twice is `changed: false`, not an error. What the backend refuses is
said in the tool: a published item of a kind with versions (a person unpublishes it in Axonity — no
tool does), one the platform ships, and, on the kinds whose delete has the same
guard, one that is still in use, in the words delete uses. An archived item is
out of use (no run reads it), cannot be edited until it is unarchived, and is
left out of every `list_<plural>` unless `archived` is `include` or `only`;
each row carries `archivedAt`. The `status` that used to say the same is gone
from the update of agent, tool, skill, policy, reference_doc, output_schema,
data_table, measure, query and application: the backend refuses it.

**The Trash** is where `delete_<entity>` puts an item, one list for every kind:
`list_trash({ kind?, limit?, cursor? })` is a page, newest deletion first, with
who deleted it, the item's own `restorePath` and `carriedBy` (the agents and
workflows that used it); `trash_summary` counts per kind and says the
installation's "Empty the trash after" (`retentionDays`, null is Never) and
whether the caller may delete permanently. **Deleting permanently is not a
tool**: it is admin-only and cannot be undone, and `test/denyList.ts` records
it. `restore_<entity>` takes an item out; an item that was archived when it
was deleted comes back archived. On skill, policy, reference_doc, output_schema,
application, data_table, measure, query and data_source the name is unique, so
a live item may have taken it while this one sat in the Trash: `restore_<entity>`
then takes `name` and brings it back under another one.

### Version history, rollback, and version-level delete

For the versioned entities (including `method`, `data_table`, `measure` and
`application`):

| Tool | What it does |
|------|--------------|
| `list_<entity>_versions` | List version history (checkpoints + named majors). |
| `read_<entity>_version` | Read one, by **integer checkpoint number**. |
| `restore_<entity>_version` | Roll the draft back to an old version (`expectedVersion` in body). |
| `delete_<entity>_version` | Remove one history entry. Draft and published version are protected. |
| `list_deleted_<entity>_versions` | Restore candidates for the row above. |
| `restore_deleted_<entity>_version` | Undo the delete above. No version check. |
| `read_<entity>_published` | The live snapshot, as opposed to the draft. |
| `create_<entity>_major_version` | Cut a new **named** major version — "Save As" on the current draft. |
| `ensure_<entity>_major_version` | Make sure a working draft major version exists. Idempotent. |
| `name_<entity>_major_version` | Rename an existing major version (label a release). |

`{version}` (an int) and `{versionId}` (a UUID) are two different identifiers
across these routes — the tool parameter names say which.

### Also

- **Personas**: since axonity-flow#2176 a persona is the agent's `persona` field
  (the character text every prompt of the agent opens with), set with
  `create_agent` / `update_agent` and published with the agent. There is no
  persona entity any more: no id, versions or approvals of its own.
  `read_agent_persona` reads the field (with the agent's `version`) and
  `create_agent_persona` writes it (`agentId`, `expectedVersion`, `persona`);
  `""` removes it, `null` on an update leaves it as it is.
- **An agent's team**: one capability of the company model (`capabilityId`,
  a key of `document.capabilities` in `read_company`). `create_agent` takes
  it; on an existing agent `set_agent_team` (`agentId`, `capabilityId`, null
  for none) changes it — `update_agent` refuses it. It is on the agent's
  record, not in a version: it holds at once, with no publish.
- **Connectors** (a tool of type `connector`): `create_connector`,
  `update_connector` — `authConfig` must be placeholders only; a human fills real
  secrets in Axonity. (`create_tool`/`update_tool` carry the same guard, so a
  connector authored either way is covered.) A connector **must declare
  `implementation.effect`** (`reads` | `acts`) before it can be published; a
  draft saves without it and the approval refuses it. `responseMapping:
  { type: "file", filename? }` keeps the answer as a file of the run and
  returns `{ fileId, filename, contentType, sizeBytes }`, which Digitize
  documents and a sub-workflow's file parameter take.
- **Toolboxes** (the group a tool is filed under, and what an agent can hold
  whole): `list_toolboxes`, `read_toolbox`, `create_toolbox`, `update_toolbox`,
  `delete_toolbox`, `set_toolbox_tools`, `assign_tool_toolbox`,
  `set_toolbox_auth`, `list_toolbox_dependent_tools` and `list_toolbox_agents`,
  and, since a box is versioned like a skill, `restore_toolbox`,
  `list_deleted_toolboxes`, `discard_toolbox_draft`, `archive_toolbox`,
  `unarchive_toolbox`, `request_publish_toolbox` and the `*_toolbox_version`
  tools. Read `list_toolboxes` before `create_tool` and pass `toolboxId` — a
  tool made without one is ungrouped. Four things worth knowing before you
  write: `set_toolbox_tools` **declares** the membership (anything you leave
  out is evicted — `assign_tool_toolbox` moves a single tool and takes `null`
  to ungroup); only what an agent holding the box **gets** waits for the publication
  (through an approval a person decides); the filing itself is live, so the
  count, how a tool is advertised, the name and description, and the shared
  credential a tool inherits change at once; an agent can hold a **whole
  box** (`toolboxIds` on `create_agent` / `update_agent`) and gets the tools of
  the box's published version; and deleting a box leaves its tools alive,
  ungrouped, and sends the box to the Trash (`restore_toolbox`) — it is refused
  while an agent holds it. `set_toolbox_auth` sets the credential a box's tools
  share (not versioned) and carries the same placeholder guard as a connector.
- **Secrets, read-only**: `list_secrets` and `read_secret` as before, and
  `read_secret_used_by` — which tools, toolboxes, data sources and module
  settings use a secret. A secret that something uses can still be deleted by a person in
  Axonity; no tool here deletes one. `read_tool_used_by` says who uses a tool, in counts.
- **Attach / detach memory**: `attach_skill_to_agent`,
  `attach_skill_to_workflow`, `attach_policy_to_agent`,
  `attach_reference_to_agent`, `attach_reference_to_workflow`, and a
  `detach_*_from_*` for each. Detaching removes the link only — the skill or
  policy itself is untouched. Read the links back with `list_agent_skills`,
  `list_agent_policies`, `list_agent_reference_docs`, `list_workflow_skills`
  and `list_workflow_reference_docs`. The three agent read-backs take an
  optional `workflowId` for the **composed runtime view** — what the agent's
  prompt actually assembles inside that workflow, with a `linkSource` per row
  saying why each item is there.
- **What uses this?**: `list_workflows_using({ entityKind, entityId })` names
  the workflows that reference a tool, agent, method, output schema or workflow,
  **and the steps they reference it in**, with `draft`/`published` per hit.
  `list_dependent_agents({ entityKind, entityId })` is the same question for a
  skill, policy or reference doc. Ask before editing anything shared — the
  alternative is validating every workflow in the tenant.
- **Prompt elements (placement)**: a `prompt_snippet` is a library item; it only
  takes effect once placed into a method step's prompt stack.
  `read_workflow_prompt_stacks` / `read_method_prompt_stacks` resolve a
  workflow/method to its steps and each step's `system`/`user` stacks (this is how
  you find the `methodStepId`s). Then `attach_prompt_snippet_to_method_step`
  (`target` = `system`|`user`, with an order), `update_method_step_prompt`,
  `reorder_method_step_prompts`, `detach_prompt_snippet_from_method_step`, and
  `list_method_step_prompts` / `list_wildcard_prompts`.
- **Company** (the tenant's single company document — a singleton, no id):
  `read_company`, `update_company` (whole-document save with `expectedVersion`),
  `list_company_versions`, `read_company_version`, `restore_company_version`,
  `name_company_major_version`, `create_company_major_version`,
  `ensure_company_major_version`, `read_company_published`,
  `apply_company_mutation` (one validated, version-safe command — preferred
  over the whole-document `update_company`, the same way
  `apply_workflow_mutations` is preferred for a workflow), and
  `request_publish_company` (takes no id — the
  server resolves your tenant's one company; direct company publish is closed to
  service tokens).
- **Run a workflow**. `list_callable_workflows` returns each target's published
  `ownerAgentId` (or null), `parameters`, `outcomes`, and a `blockedReason`
  for unavailable targets. Add the **Called by another agent** trigger
  (`subprocess-invocation`) to the target, declare its shared inputs with
  `set_workflow_inputs`, and publish it. For a fixed target, send an `add_step`
  payload with `type: "subprocess"` and `config: { targetWorkflowId }`.
  The child runs on the published target's owner, falling back to the caller's
  pinned owner for an older ownerless target.
- **The deploy, the tenant and its queues** (read-only): `read_deploy_contract`
  (what this backend actually mounts — read it when a call fails in a way that
  smells like a version mismatch), `list_users` (where an `ownerId` comes from),
  `list_audit_events` (pass `actorKind: "service_token"` to read back what
  external agents — including you — changed), `read_queue_overview`,
  `list_in_flight_runs`, `read_task_queue_summary`, `list_task_queue`,
  `read_task_queue_item`, `export_task_queue`, plus `read_model_tier_map` (what
  `capabilityTier` resolves to), `read_concurrency_status`,
  `read_concurrent_run_cap` and `read_for_each_rate`. Together these answer *why
  is my run not moving* without asking a human to look at a screen. Every write
  in these families — purging or replaying queue work, changing a cap or the
  tier map, importing a tenant bundle, reading someone's notifications — is
  deliberately absent and recorded in `test/denyList.ts`, the list
  `test/exclusions.test.ts` enforces.
- **Secrets** (read-only): `list_secrets`, `read_secret` — the catalogue a
  connector's `authConfig.secretId` points at. Values are never returned by any
  Axonity route; `valueKeys` says which keys a human has filled in, so you can
  tell an unfinished secret from a finished one before wiring to it. Creating or
  changing a secret is a human act in Axonity (#39).
- **Catalog & cloning**: `list_system_tools` (read-only catalog — enabling one
  for an agent is `update_agent` with the id added to `systemToolIds`),
  `clone_method`, `clone_prompt_snippet`, `list_tool_packages` (the import
  allowlist `validate_tool_code` judges against), `list_templates` /
  `read_template`.
- **Tables** (`data_table`): the tenant's own reference data — a table an
  author designs and maintains, and agents and decisions read. The whole
  lifecycle is the generic family above; three things are not, and each is a
  way to be quietly wrong:
  - `list_data_tables` is **paged** (20 by default, 200 max), like
    `list_measures`, `list_queries`, `list_applications` and
    `list_table_databases`, because a tenant's
    reference data has no ceiling. Page one
    is not the library — follow `nextCursor` while `hasMore`, or narrow with
    `name`, which is exact and unique per workspace.
  - **`rows` and `columns` are whole-collection fields.** Sending `rows`
    through `update_data_table` replaces the table's content; one row there
    deletes every other. `add_data_table_row`, `update_data_table_row` and
    `delete_data_table_row` address a single row by a `matchColumn` /
    `matchValue` pair and cannot touch the rest.
  - **A table's derived tools follow its published version.** A published table
    mints its own CRUD tools, so granting an agent access to one is ordinary
    tool granting. `list_data_table_tools` reports `offered` (what the draft
    would yield), `toolId` (whether a row exists) and `isLive` (whether a run
    can reach it) separately — an author who ticked "may add rows" and has not
    published has granted nothing yet.
- **Databases and the model** (`table_database`, axonity-flow #2444): a
  database is a named group of tables (`kind` `data_model`, `shared` or
  `workspace`), and a table says which one it is in (`update_data_table` with
  `databaseId`, or `clearDatabase: true`; `list_data_tables` takes `databaseId`):
  a database holds no list of its tables. Like the other versioned kinds it
  uses `archive_table_database` / `unarchive_table_database`, carries `archivedAt`,
  and goes to the Trash when deleted (`ENTITY-LIFECYCLE-CONTRACT.md` §4.9).
  Archived databases are excluded from the list by default; pass `archived`
  to include them or list only archived ones. Restore can take a new `name`.
  Only an empty database can be archived or deleted (a 409 names how many
  tables it still holds). `read_model_gaps` and `read_model_overview` read the
  five fixed checks over the model and what exists in each layer, counted when
  asked; they belong to the Insights module.
- **The semantic model** (`data_source`, `query`, `data_table`,
  `table_relationship`, `measure`, concepts and their links, `dashboard`): a
  workspace connects a warehouse such as BigQuery, named queries read it,
  dynamic tables are filled by those queries on a schedule, measures define
  the numbers over those tables, concepts say
  what each word and number means, and dashboards show the measures. Read
  `axonity_semantic_conventions` before building one — the platform serves
  those rules.
  - `list_data_source_drivers` first: each warehouse's `configFields` are the
    keys `create_data_source` takes in `config`, so nothing about BigQuery is
    hard-coded here and a new warehouse works without a connector release.
    The warehouse key lives in a vault secret a human fills; the source points
    at it by `secretId`.
  - `test_data_source` answers `{ ok, message }` — a failure is an answer, not
    an error. `read_data_source_schema` reads the warehouse's catalogue for
    free, dataset by dataset on a source limited to `allowedDatasets`.
    `query_data_source` runs read-only SQL with capped rows (`truncated` says
    when rows were left out); a 422 is the query being refused, a 502 is the
    warehouse.
  - **A query is its own versioned entity** (`query`): the generic family
    plus the version tools, `request_publish_query`, `test_query` (run it
    once with values; it suggests the `returns`), `read_query_usage` (the
    read tool its publication mints, and which agents hold it) and
    `list_query_live_versions`. It carries the SQL, the source, the grain,
    its typed `parameters` and its described `returns`.
  - **There is no sync object, and no `provenance`.** A table says what fills
    it in `filledBy` — `author`, `workflow`, `query` or `source` (the rows stay
    in a data source; `external` says where) — and a query-filled table names
    its query in `fillingQueryId` and when it runs in `rhythm`
    (`{ cron, timezone, keyColumns, mode, enabled }`). Whether a table is read
    live or as published follows from its `versioning` (`live` or `config`;
    only an author's table may choose), and a measure reads every table whose
    rows Flow holds. `refresh_data_table` fills a query-filled table now
    instead of at its next turn (it does not wait for the result; read the
    table's `fill` afterwards).
  - **Concept links**: a concept's `refersTo` points at one thing;
    `link_concept`, `unlink_concept` and `list_concept_links` hang the same
    word on every column, table, measure, value or query that means it. The
    links are rows of the `concept_links` table and go live when that table
    is published.
  - **A measure is its own versioned entity**: the generic family plus the
    version tools, `request_publish_measure`, and `list_measure_live_versions`.
    It names the concept it means in `concept`, and the questions it answers
    in `questions`. `read_measure_design` now returns a table's columns and
    time axis only; `list_measures({ tableId })` says which measures read it.
  - **A measure is one formula**, `definition.expression`:
    `sum(orders.amount)`, `[revenue_d2c] + [revenue_retail]`,
    `divide([cm1], [net_revenue])`. `get_measure_formula_spec` is the only
    list of its words — the platform's own, the one its editor shows — and
    with `includeWorkspace: true` also this workspace's measures, tables and
    columns. `validate_measure` checks a formula without saving it and answers
    with every problem by code. `read_measure` returns the formula as text
    beside the stored tree and the aggregations it folds down to. The fields
    from before the formula (`tableId`, `clearTable`, `aggregation`,
    `column`, `numerator`, `denominator`) are refused with `legacy_field`.
  - **Time over a date table**: `create_data_table` / `update_data_table`
    take `dateTable: true` and `calendars` (name, the column per grain, one
    default) — what `shift`, `to_date`, `rolling` and `running` are measured
    in. `read_measure_design` shows them.
  - **Explaining a number**: `query_measures` takes `explain: true` (what
    each part of the formula gave, on the total, per period and per group)
    and `useDraftChain`; a refusal carries its `code`. `read_measure` says
    what a measure rests on (`dependsOn`) and what rests on it (`usedBy`,
    `dashboards`). `delete_measure` is refused with `still_referenced`,
    publishing with `depends_on_unpublished` / `unverified_relationship`
    (the approval names what moves with it in `changesWith`), and a table or
    relationship change that would break a published measure with
    `breaks_measure`.
  - **Concepts**: `list_concepts`, `create_concept`, `update_concept`,
    `delete_concept` — kind (concept, state, metric, rule), name, meaning,
    synonyms, what it refers to, owner. They are rows of one table the
    platform keeps per workspace, so they are published with
    `request_publish_data_table` on the `tableId` every write returns.
  - **What moves a number** (influences): `list_measure_influences`,
    `link_measures`, `update_measure_influence`, `unlink_measures` — one
    measure moves another from outside its formula, with an `effect` (same
    or opposite), `why`, `owner` (a role as text) and an optional `basis`. A
    link the formula already makes, a duplicate and a loop are refused; a
    `planned` row marks a link that is still missing and may name a measure
    not built yet. The rows live in the `measure_influences` table, go live
    when it is published and travel with the deploy like the measures.
    `read_measure_tree` reads formula parts and influences as one graph
    (`{ root, nodes, edges, missing }`), published by default; `read_measure`
    shows `influencedBy` and `influences`.
  - Reading numbers: `query_measures` (up to 40 questions, each answered on
    its own, measures named by their handle), `list_measure_rows` (a list
    tile). Plus `duplicate_dashboard`. Besides the periods that run to date,
    `last_3_full_months`, `last_12_full_months` and `year_to_last_full_month`
    end at the last full month. `last_quarter` is the previous completed
    calendar quarter. Both question and row tools accept `period: null` with
    `start`/`end` dates (end inclusive) for a chosen month or quarter.
  - **Expected ranges**: choose `definition.rangeMethod` explicitly from the
    live formula spec's `rangeMethods`; no method, grain or history length
    is invented by the connector. `query_measures` with `expected: true`
    returns the server's band and historical basis, or the reason none is
    available. Series points retain `expectedBasis`, `expectedReason` and
    `partial`. `power_undefined` warnings locate the affected total, group
    or point. The formula spec and validation also carry `power` unchanged.
  - **Number cards**: query `against` names another measure; the answer keeps
    its value, gap and errors separate from the status. Report changes as
    `changeKind` says: `delta` in points for a percentage/score, `change` as
    a percentage for a relative change. A dashboard number tile accepts
    `config.against: {measure, label?}` and `config.sparkline` (none, trend,
    bullet); number and trend tiles accept `showExpected`. A dashboard's
    `periodPicker` selects free, full_periods or hidden. These settings are
    forwarded and validated by the backend; read the tool descriptions
    before changing them, and preserve the whole layout on update.
  - A reference doc has no `semanticKind` any more; the platform refuses it
    and the other retired fields and says where each one went.
- **Applications** (`application`): a program an agent operates through an
  executor — a Windows program (`win32`) or a website (`web`) — with its
  `limits`, what the agent may never do in it (processes, windows, keys,
  buttons, folders, domains, secrets by name). The generic family and the
  version tools, and `request_publish_application`: an executor receives only
  the published limits, so only a human makes them live.
  - **Executors**: `set_application_executors` / `read_application_executors`
    choose the machines an application runs on (the whole set at once);
    `list_executors`, `read_executor`, `read_executor_applications` and
    `list_executor_commands` only read. Registering or revoking an executor
    is a human's job — it mints a token, and no tool here ever returns one.
  - **What it has learned**: `list_application_knowledge` (elements,
    instructions, lessons, one page at a time) and
    `list_application_knowledge_versions`; `forget_application_knowledge`,
    `restore_application_knowledge` and `write_application_knowledge` to
    correct it. Linking executors and changing knowledge are reserved for a
    workspace administrator on the platform, and a token acts with the role
    of the person who created it, so they answer with a refusal that says so
    unless that person is an administrator.
- **Who may read what** (labels, audiences, roles): every policy, skill,
  reference doc and table carries a label — `level` (public, internal,
  confidential) and `audienceIds`, whom it is meant for. `list_audiences` /
  `read_audience` give the ids to put there, `list_roles` / `read_role` say
  what each role reads and maintains, and `read_member_roles` which roles a
  colleague holds. Leave the label out and it gets the default (internal, for
  Staff); `level: null` makes a thing readable by nobody. Narrowing a label is
  always allowed; widening it is a colleague's act, and the refusal says so.
  An agent's `clearance` is set by an administrator; a workflow's by its
  author, through the publish approval. Managing audiences and roles is not
  here yet.
- **The knowledge graph** (Cortex), read with the token's own clearance:
  `search_knowledge_graph`, `list_knowledge_topics`, `list_topic_facts`,
  `read_fact` (passages, sources, certainty, validity, which run taught it),
  `read_source`, `list_knowledge_tree`, `list_related_topics` and
  `list_archived_facts`. Maintaining one fact, as the person who made the
  token (only for audiences that person maintains, recorded in their name):
  `archive_fact`, `restore_fact`, `confirm_fact`, `reject_fact`,
  `correct_fact`, `relabel_fact`, `give_right_version`. With the module off,
  every call says so in plain words.
- `list_deleted_prompt_snippets` calls `/api/v1/prompt-snippets/deleted`; the
  backend returns it as `{ items: [... ] }`, and the tool forwards that response
  unchanged.

### Validate and run before you publish

| Tool | What it does |
|------|--------------|
| `validate_workflow` | Check a workflow against the tenant's catalog. By `document`: the document as it stands, saves nothing, read-only-token safe; skips only the checks about that workflow's own wiring (its triggers and attached knowledge). By `workflowId`: the saved workflow with those checks too; needs a token with the `author` scope. Read `catalogChecked`. |
| `analyze_workflow_reachable_outputs` | What a given step can read from upstream — bind inputs to real fields instead of guessing. Stateless and read-only-token safe. |
| `validate_tool_code` | Syntax and banned-pattern check for Python tool code. Stateless and read-only-token safe. |
| `format_tool_code` | Format tool code with Black. Stateless and read-only-token safe. |
| `execute_tool` | Actually RUN tool code (not just validate it) and see the real output. |
| `execute_stored_connector` | Test-run an already-saved connector. The backend decrypts its real secret server-side — the agent supplies only input parameters and never sees the secret. |

### Triggers — what makes a workflow run

`list_/create_/delete_` for **webhook triggers** (plus
`rotate_webhook_trigger`), **cron schedules**, and **conditional triggers**
(plus `update_conditional_trigger` and `list_tenant_conditional_triggers`).
Trigger deletes are **hard** deletes with no restore, and a webhook token is
shown **once** at create or rotate.

**A schedule is a claim you can now check.** `run_cron_schedule_now` fires one
immediately *without* moving `nextFireAt` — testing a schedule must not consume
the run it was going to make. Before it existed, "every weekday at 07:00" could
only be tested by coming back tomorrow, and what is usually wrong is not the
timing but whether it starts anything at all.

**To pause a schedule, disarm it** — `set_cron_schedule_enabled`, not
`delete_cron_schedule`. Deleting throws away the rules the author wrote and
makes "stop this for a week" indistinguishable from "we do not do this any
more". `list_all_cron_schedules` answers *what runs tonight?* across the tenant;
`reconcile_cron_schedules` answers *is that actually what runs?* — it reports
rather than tidying silently, and never arms something someone switched off.

`create_cron_schedule` takes either `cronExpr` or the richer `rules`, and the
trigger must exist in the **published** document. Rule shapes come from
`get_workflow_authoring_spec` → `scheduleRuleKinds`; this connector names none
of its own.

**A conditional start is authored in the workflow, not on its row.** The
trigger element (`typeId: "conditional-poll"`, a UUID `id`) carries
`conditionText`, `repeatIntervalMinutes` and the **check** (`checkKind` plus
that kind's settings) on its `config`, written with `apply_workflow_mutations`.
Publishing the workflow creates or updates the row from the document, and
removes the rows whose element is gone. The platform **refuses** a check sent to
`create_/update_conditional_trigger` — so those tools no longer take one, and
`create_conditional_trigger` (rarely what you want) now sends the `workflowId`
the platform's body schema requires. Without a check, every beat starts the
workflow: a mailbox on fifteen minutes makes ninety-six empty runs a day.
`"automatic"` decides with no model (a plan, its outputs, and a `startsWhen`
rule); `"agent"` makes the beat a run whose first step asks an agent.

### Runs — evaluating what you built

`start_workflow_run` (test a workflow you built — it runs the **published**
workflow and really executes), `upload_run_input_file`, `cancel_run`, `delete_run`, `list_runs`,
`list_workflow_runs`, `read_run`, `read_run_trace`, `read_run_cost`,
`read_runs_summary`, `archive_run` / `unarchive_run`, `bulk_archive_runs` /
`bulk_delete_runs`. There is no findings endpoint — evaluation means reading a
run's validator verdicts and its trace.

**Which start, and what it wants.** `read_workflow_trigger_parameters` answers
`{ triggers, constants }` — every way the workflow can be started, each with its
own parameters. Pass the one you mean to `start_workflow_run` as `triggerId`;
omitting it fires the first, which on a workflow with a button *and* a schedule
is an arbitrary choice. A parameter marked `pinned` is one the **author** owns:
it is overwritten on every run, so a caller must not send it.

**A start input too large to write out.** Give `start_workflow_run` a
`triggerInputPath` instead of `triggerInput`: an absolute path to a JSON file on
the machine the connector runs on, holding the start input as one JSON object.
The connector reads it and sends that object as `triggerInput`, unchanged, so
its content never passes through the conversation. At most one of the two. A
file that is not UTF-8 JSON holding one object is refused in words, without
quoting the file.

**A start that takes a file.** `upload_run_input_file` stores a file the way the
start form in Axonity does (`POST /api/v1/run-input-files`) and answers its
reference, `{ fileId, filename, contentType, sizeBytes, sha256 }`. Put that
reference in `triggerInput` under a parameter the start declares as a `file`,
or in a list under one declared as a list of `file`. Give the file as `path`
(an absolute path on the machine the connector runs on; the bytes never pass
through the conversation) or as `contentBase64` (when the file is not on that
machine). One upload serves one run, and only a start by hand
(`start_workflow_run` or Run in Axonity) takes it. An upload no run takes within
24 hours is deleted; a file a run took is kept as long as that run exists.

**`read_run` omits the workflow snapshot by default.** It is immutable, it is
never the answer to a question about the run, and it measured 81% of one real
response — an oversized response turns a call that succeeded into an error.
Pass `includeSnapshot: true` when you actually want to see what executed.

**Start from the outline.** `read_run_outline` is the run's table of contents —
the run, its steps, and the items a fan-out handed out, flat with parent
pointers. It carries no bodies, so its size follows the run's *shape* rather
than its content: a launch over four thousand items costs about what one over
four costs. `itemCap` bounds the items listed per fan-out step and the remainder
is counted in `counts.truncated`, never dropped silently —
`read_run_outline_items` carries on from where the outline stopped, one step at
a time, walked by `offset` (safe here: a fan-out's items are fixed once handed
out, so the ordering cannot shift under you). Then open only what
you want: `read_run_value` for one large step value (by the digest in
`stepStates`) and `read_run_invocation_messages` for one agent's transcript (by
the id in `agentInvocations`). Reading a whole run to find one message is the
habit these replace.

**A run can park rather than finish.** Where you see it depends on what it
waits on: `list_todo_steps` has every step that waits on a person (a question, a
plan, a manual or decision step); `read_run_waiting_on` has a timer and an
answer or callback result on its way; a FOR EACH batch is on
`read_run_for_each_progress`; a conversation run waits in its chat.
`answer_run_question` answers an `ask_user` step and
`send_run_message` sends a turn to a conversation run. Both record the input as
a person's, so use them on runs you started. Deciding a **plan approval** and
restarting a stuck run are deliberately absent — the first is the human review
the step exists to get, the second is `require_admin` and a service token is
always `role="member"`. Both are recorded in `test/denyList.ts`, together
with stopping runs in bulk (admin), the tenant's storage footprint (admin), an
inbound channel reply (authenticated by the email/WhatsApp adapter, not by a
service token) and the retired `workflow-memory` placeholder.

**Testing the Dashboard Analyst.** A chat about a dashboard is a run of kind
`conversation`; `list_runs` asks for workflow runs only. `list_conversations`
lists the chats (paged, newest first, only the ones opened by the person the
token belongs to) in one of two ways: for one dashboard (`dashboardId`, with `status`,
`createdAfter`/`createdBefore` and `q`, text in the opening question — the
backend's `GET /conversations`), or across every dashboard that person can see,
filtered by `status`, `createdAfter`/`createdBefore` and `includeArchived` (the
backend's `GET /runs?kind=conversation`). What one route has and the other has
not is refused instead of dropped: `includeArchived` with a dashboard, and `q` without one.
The two read a bare `createdBefore` date differently; the tool says how. Who
opened a chat cannot be filtered on at all. `start_conversation` opens a new one with an opening
question and, optionally, the tile it is about (`focus`) — the same request the
dashboard's chat window sends. A follow-up is `send_run_message`. The answer and
the tools the analyst called (`read_measure`, `show_visual`, with their
arguments) are in the transcript: `read_run`, then
`read_run_invocation_messages` on the orchestrator row. Starting a chat needs a
token with the `author` scope, a follow-up the `operate` scope. The Builder chat
and its files stay out of reach.

**`list_todo_steps`** is every step in the tenant waiting on a person: an
unanswered question, a plan awaiting approval, a manual step or a decision step.
Each item belongs to one agent or none (`agentId`) — a question or plan to the
agent that asked, a manual or decision step to the workflow's owner — and
`agentId` on the call narrows the list to that agent's items. It is paged over
the waiting **runs**, so `items` can be longer than `pageSize` — one run may
park several steps — or shorter. Follow `nextCursor` to the end before
concluding anything about how much is waiting. `read_run_waiting_on` is a
different read: a run's pending wake-tasks (a timer; an answer or a callback's
result on its way), where an open question, a FOR EACH batch and a callback
still running never appear.

**What an agent wrote to itself.** `list_run_session_memory` lists the files an
agent left during a run (metadata only, up to 200 per run) and
`read_run_session_memory_file` opens one. When the trace shows a decision but
not what it was reading, the reason is usually here. Workflow-bound reference
material is not — that lives in `reference_docs`.

**Inside a launch**: `read_run_items_summary` is the roll-up ("4,415 processed ·
12 failed"), `list_run_items({ outcome })` the paged rows — filter in the query,
because the failures are scattered and sifting page one finds none of them.
`list_run_tasks` and `read_run_for_each_progress` cover the children a run set
in motion.

`list_workflow_runs({ workflowId, status?, archivedOnly?, limit?, cursor? })` returns one
**page** — `{ items, nextCursor, pageSize, hasMore }`, 20 by default and 200 at
most — so follow `nextCursor` while `hasMore` is true rather than treating the
first page as the answer. It also lists **launches**, not runs: the per-item runs
a FOR EACH creates stay inside their launch, so a launch over 4,415 people is one
entry carrying `forEachProgress`. `list_runs` is the tenant-wide list and is now
paged the same way — `{ items, nextCursor, pageSize, hasMore }`, walked with
`cursor`. It stopped answering with a bare array when the backend converted the
route; the `offset` it used to take is no longer read.

A run row in both lists carries `ownerAgentId` (the agent that owns the run's
workflow; null when there is none) and `currentStepName` (the step the run is in,
for an active run; null otherwise).

### Approvals

`list_publish_approvals({ status?, origin?, entityType?, agentId?, view?, limit?, cursor?, offset? })`
and `get_publish_approval({ approvalId })` — how you find out whether a
`request_publish_*` was approved or rejected. Approving and rejecting are
human-only actions in Axonity.

**The list carries no readiness.** A row of the queue has `readiness` and
`readinessChanged` set to null; the queue does not compute them per row. Open the
request with `get_publish_approval` before you judge it: that read recomputes its
readiness as the entity stands now, and approving computes it fresh again.

**The queue is read a page at a time.** It can hold thousands of requests, so one
call answers one page (50 by default, 200 at most) with `total`, `hasMore` and
`nextCursor`; send `nextCursor` back as `cursor` until it is null. `offset` still
works for a caller that pages by it. Narrow the list with `status`, `origin`
(`mcp`, `agent`, `screen`), `entityType` or `agentId`; each narrows the query and
its `total`. `publish_approvals_summary({ status?, origin?, entityType?, agentId?, view? })`
counts without reading a row — `total`, `byStatus`, `byOrigin`, `byKind`,
`byAgent` — and each count keeps every filter but its own, so a number is what
choosing it would list.

**Approvals are read per person.** `view` is `mine` unless you ask for `all`:
`mine` is the requests you sent through your own tokens (a service token sees only
the ones it sent itself), `all` is every request of the workspace and is for
administrators — anyone else gets a 403; a token acts with the role of the person who created it.
`list_publish_releases` takes the same `view`. Opening one request by id works for
your own and, for an administrator, any; someone else's is a 404. Each request
says `origin` (`mcp`, `agent` or `screen`), `requestedByName`, `canDecide`
(your authority to approve), `canReject` (your authority to reject), and `version`
(the version approving it publishes; null when there is none to name).
Both authority flags are always false through a token: a token never approves
or rejects. A new decision also requires `status: "pending"`; the flags are
not status checks or a guarantee that publication will succeed.

### Admin requests (what a token only proposes)

Some administration changes — a member, a role, an audience, a mailbox in Mail's
settings, the executors of an application — are not done by a token: the call
answers 202 and the tool result starts **`NOT DONE YET`** with an approval id. A
person approves it in Axonity (Approvals → Admin requests). Poll
`get_action_approval({ approvalId })` — or `list_action_approvals({ status?, view?,
limit?, cursor? })` — which show `summary`, `status`, `statusReason`, `result` and
`check` (what approving would do now). Do not repeat the call: a second identical
request returns the same approval. A field that is wrong is a 422 naming it
(`mailboxes[0].address: …`) and no request exists. No tool approves or rejects:
a token never approves. Each module setting says what a token may do with it in
its `token` field: `allow`, `approval` (a proposal) or `deny` (a person only).

`request_publish_release({ workflowId, changeSummary? })` proposes a **release**:
a workflow *and everything its run needs* — the agents it runs (each with its
persona), their tools, the methods it pins, the memory scoped to those agents —
as ONE approval.
Prefer it over a request per entity. Taking a tenant live entity-by-entity means
a hundred-odd approvals, none of which means anything on its own, and a human
asked that many times is not reviewing. `list_publish_releases` and
`get_publish_release` read one back — the release's members, and its readiness
recomputed as of now.

Unlike `request_publish_bulk`, a release is **all-or-nothing and in dependency
order**: approving it publishes every member or none, so a workflow can never go
live calling a tool that did not. The response carries the bundle's verdict —
`ready`, `changedCount` of `totalCount` (unchanged members are already live and
ride along), `members` with why each is there, and `blockers` that name the
member in the way. Requesting is ours; deciding stays human, like everywhere
else here.

### Start a Flow App

The connector is the way into a new Flow App. Everything it offers for this
comes from routes of the installation you are connected to; none of it is a
copy kept here.

- **Server instructions** (`initialize`): the first sentence tells the agent to
  call `get_flow_app_starter` before it writes any file. Claude Code loads them
  at the start of every session (limit 4,096 characters; ours is far below).
- **`get_flow_app_starter`** (`GET /apps/starter`): build, surface and kit
  version, the contract hash and a single-use download link for the starter
  package of this installation. The agent downloads and unpacks it with its own
  shell; the connector never carries the archive.
- **`get_flow_app_authoring_contract`** (`GET /apps/authoring`): the surface,
  the manifest schema, the shape of every answer and the contract hash.
- **`check_flow_app_manifest`** (`POST /apps/manifest/check`): a manifest
  against the workspace, as the person behind the token may read it. The
  older `validate_flow_app_manifest` only checks the schema.
- **Prompt `new-flow-app`** (optional argument `slug`): a slash command in
  clients that offer prompts (Claude Code: `/mcp__axonity__new-flow-app`). It
  adds the starter answer to a short instruction; no logic of its own.
- **Three resources**, read live from `GET /apps/authoring`:
  `axonity://flow-app/contract` (all of it), `axonity://flow-app/surface/v1` and
  `axonity://flow-app/manifest-schema`. The same content is available through
  the tool, for clients that do not read resources.

Local and hosted give the same instructions, prompt and resources
(`test/hosted.prompts.test.ts`); the hosted connector replays them per request
beside its tools, as the caller. None of these tools touches `/config/` or
`/deployment`, and the archive route is on the deny list.

## Hosted by Axonity (HTTP mode)

The same tools also run inside Axonity, behind its own `/mcp` endpoint, for a
person who connects with a **personal token** (`axp_…`) instead of running the
connector locally. Axonity starts this package with
`AXONITY_MCP_TRANSPORT=http`; you do not run that mode yourself. The local
connector above (stdio, a service token) is unchanged and is still the default.

What differs in hosted mode:

- **One token per request.** The process holds no token of its own
  (`AXONITY_TOKEN` set is refused at startup). Each request brings its caller's
  personal token as a bearer, and the API is called with that token only. A
  request without an `axp_` bearer is answered 401.
- **Each tool says what a personal token needs, before the call.** A personal
  token reads what its person reads; actions need "Run actions" on the token,
  drafts and publication requests need "Build drafts and request publication",
  and every other route is closed to it. Axonity decides that per route and
  enforces it on every call; the hosted tool texts are worded from the same
  table (`src/generated/tokenRouteClasses.ts`, pinned from
  `backend/scripts/dump_token_route_classes.py` in axonity-flow). A tool on a
  closed route keeps its name and says why it is closed.
- **No local files.** `upload_run_input_file` takes `contentBase64` only, and
  `start_workflow_run` takes `triggerInput` only: the process runs on the
  Axonity server, so a `path` or `triggerInputPath` would name a file there, and
  it is refused before anything is read.
- **Stateless, with a ceiling.** Every message is its own POST (no sessions; GET
  and DELETE on `/mcp` are 405; a batch is answered 400). A request waits in
  three rooms in turn, and a caller that hangs up while it waits leaves the
  queue: its token's own (`AXONITY_MCP_MAX_IN_FLIGHT_PER_TOKEN`, default 2, and
  `AXONITY_MCP_MAX_QUEUED_PER_TOKEN`, default 4; one more is answered 429, so
  one token cannot fill what everybody shares), for a body over
  `AXONITY_MCP_LARGE_BODY_BYTES` (default 1 MiB) or one that does not say its
  size, one of `AXONITY_MCP_MAX_LARGE_BODIES` (default 1), and then one of
  `AXONITY_MCP_MAX_IN_FLIGHT` seats (default 4) with `AXONITY_MCP_MAX_QUEUED`
  (default 32) waiting, past which it is answered 503. A seat is kept until the
  work is done, also when the caller hangs up, and every API call ends after
  `AXONITY_MCP_API_TIMEOUT_MS` (default 300000). A body over
  `AXONITY_MCP_MAX_BODY_BYTES` (default 25 MB) is answered 413 before it waits
  for anything.
- **A message is bounded by what it holds, not only by its size.** The heap
  hangs on what a parse builds: 10 MB of `{},` is 3.3 million objects and ended
  the process (V8 heap limit), where a 10 MB base64 file is one string. The
  structure marks `{`, `[` and `,` outside strings (every object, array item and
  member) are counted as the body arrives; a message with more than
  `AXONITY_MCP_MAX_STRUCTURE` (default 50000) is answered 400 before it is
  parsed, with the limit in the error. A file sent as base64 has none. That
  bounds one message, not the sum, so the messages in work at once also share one
  budget, `AXONITY_MCP_MAX_STRUCTURE_IN_FLIGHT` (default 100000, never less than
  the limit per message): a message is weighed after it is read and before it is
  parsed, and one that does not fit waits its turn (first come, first served)
  while it holds its seat, so past the seats and the queue it is the same 503.
  The seat and the budget go back when the answer has left the process, not when
  the handler returns: a failed call of a big message answers with a thousand
  times its size (97 KB of numbers is 10.9 MB of validation errors through
  `apply_workflow_mutations`), and those answers piled up past the heap when the
  seats went back early. Measured with the real process and the V8 limits Axonity
  starts it with (macOS RSS, 5 runs per case): twelve and twenty messages of
  49 500 marks at once from different tokens, `numbers 49500` through
  `apply_workflow_mutations`, died in 3 of 5 and 4 of 5 runs before; they now die
  in 0 of 5 (peak 219–229 MB and 224–235 MB). Without the budget, with only the
  rule about the answer, 20 at once also lived (0 of 5, peak 245–280 MB): the rule
  about the answer is the cause that was found, the budget is the bound that does
  not depend on what the answers weigh. One message at the limit lives at 50000
  and at 100000 (slowly: 8–10 s) and ended at 200000, so the budget is kept under
  that. Not every tool was measured (3 of 473), and a tool with a still more
  expensive schema may sit closer to it. An answer that stands still for 30
  seconds without being read is cut with its connection, so a caller that does
  not read cannot keep a seat for ever.
- Measured (macOS RSS, Node 22, 473 tools, the V8 limits Axonity starts it
  with): about 85–95 MB at rest; 209–292 MB with fifty requests at once (five
  times over, measured before the structure limit and not repeated after it); four
  24 MB bodies at once 247 MB with the big-body place and 369–407 MB without it,
  which is why it stays. Not measured on Linux.
- It listens on `127.0.0.1:AXONITY_MCP_PORT` only and calls `AXONITY_API_URL`,
  which has no default in this mode.

Refresh the route table after the backend changes it:

```bash
node scripts/generate-token-route-classes.mjs --flow ../axonity-flow
```

A test fails when a tool calls a route the pinned table does not know.

## What this is for — and what it is not

**Authoring.** An agent composing an entity from intent: drafting a workflow,
writing a tool, wiring memory onto an agent, and checking its own work. That is
what these tools are built for.

**Not bulk migration.** Do not use the connector to move many entities verbatim
from one place to another. Axonity's config export/import moves bytes with no
model in the path and fails closed on secrets; content routed through an agent
can be subtly altered in transit, which is precisely the risk a fidelity
migration cannot take.

## Guardrails

These are enforced by the backend, not merely by convention:

- **The connector never publishes.** `request_publish_*` creates a **pending
  approval**; a human approves it in Axonity, and only then does the draft go
  live. A direct publish from a service token is refused with a 403, so there is
  no tool for it and no way around it.
- **A read-only token is genuinely read-only for mutations.** Any write from a token
  without the `author` scope is refused with a 403 (`write` is its older name;
  a token with only `operate` may only answer, message and recover runs).
- **The four analysis tools are the exception:** `validate_workflow({ document })`,
  `analyze_workflow_reachable_outputs`, `validate_tool_code`, and `format_tool_code`
  can be called by read-only tokens because they never mutate state;
  `validate_workflow({ workflowId })` needs the `author` scope.
- **The token is tenant-bound.** An agent cannot reach another tenant.
- **Secrets never pass through the agent.** A connector's `authConfig` accepts
  placeholders only; a write carrying something that looks like a real
  credential is rejected before it leaves the connector. Tenant secrets
  (`/api/v1/secrets`) are **readable and unwritable**: `list_secrets` /
  `read_secret` give the catalogue and `valueKeys` (which keys are filled, never
  their values) so an agent can point `authConfig.secretId` at the right entry,
  and no tool can create, change or delete one — the backend refuses a service
  token there too. A secret's `metadata` is stored unencrypted and readable
  tenant-wide (axonity-flow#908), so credential-shaped entries in it are
  withheld on read and listed under `metadataRedacted`.
- **Errors carry a machine-readable `code`, not just prose.** A 409 can mean a
  stale write (retry) or a live reference conflict (don't — see
  `axonity_conventions`); the connector tells them apart by `code`, never by
  matching the message text.
- **No tool crosses the authority boundary.** A test drives the whole registered
  surface and fails the build if any tool targets a publish / approve /
  secret-write / service-token / deploy route (`test/denyList.ts`). The
  rules are method-aware: `GET /api/v1/secrets` is allowed, every write verb on
  it is not.
- **Guidance can't silently drift from the backend.** The field/enum facts the
  connector states are pinned to a vendored snapshot of the backend OpenAPI
  schema; `test/conformance.test.ts` fails if a route or documented enum
  diverges (see `test/fixtures/README.md`).
- **Every backend route is accounted for, and the build says so.**
  `test/completeness.test.ts` partitions all 963 operations in the pinned
  snapshot using four classifiers. For tenant-API routes it checks for
  *covered by a tool* or *excluded by a rule that carries a
  written reason*, with an explicit temporary exception for the unresolved
  product decisions listed in `OPEN_FOR_DECISION_79`. Those routes, including
  Library summary, are not implemented tools or completed exclusion decisions;
  the test also checks that this pending list remains unresolved. Probes,
  login routes and other endpoints outside the tenant API are classified
  separately by `NOT_THE_API` / `isOutsideTheApi`. An operation matching none
  of these four classifiers fails the build, so an unclassified route cannot
  silently disappear from the parity check.

A method the platform provides is read-only to a tenant: the backend refuses
`update_method` and `delete_method` against one (403). `clone_method` makes a
copy of your own, which you can edit.

## Development

```bash
npm install
npm run typecheck
npm test
npm run build   # emits dist/
```

## Releasing

**Merging to `main` is the release.** Nobody runs anything.

`.github/workflows/release.yml` runs on every push to `main`:

1. CI (`ci.yml`) runs first; if it fails, nothing else happens.
2. The release job installs, typechecks, tests, builds and packs the tarball
   (`npm pack --dry-run`) *before* the version moves — anything that fails
   there leaves no version commit, no tag and nothing on npm.
3. `scripts/next-version.mjs` picks the bump from the commits since the last
   tag: **major** only for a line starting `BREAKING CHANGE:` (or
   `BREAKING-CHANGE:`), or a `!` type in the subject (`feat!:`) or as a
   `* feat!:` line in a squash-merge body — the word BREAKING in ordinary text
   does not count; **minor** if one starts with `feat:` / `feat(scope):` (also as a
   `* feat…` line inside a squash-merge body), otherwise **patch**. No commits
   since the tag means no release.
4. `github-actions[bot]` commits the version (`0.37.0 [skip ci]`) and tag
   `v0.37.0` to `main` in one atomic push.
5. Then `npm publish --provenance --access public` via **npm Trusted
   Publishing**: GitHub hands npm a short-lived OIDC token for this workflow,
   so there is no `NPM_TOKEN` and no 2FA prompt. (A stored token cannot ship
   this package: npm does not let a 2FA-bypassing token publish it. That is why
   publishing used to be manual.)

Two merges close together never publish at the same time (`concurrency:
release`); the newest waiting run takes all commits along. The bot's own push
does not start the workflow again — pushes made with `GITHUB_TOKEN` never start
workflows, and the commit also carries `[skip ci]`.

**If the publish step fails after the tag went up** (npm down, Trusted
Publishing not set up yet): fix the cause, then Actions → Release → *Run
workflow*. With no new commits it sees the tagged version missing from npm and
publishes that exact tag.

### One-time setup on npmjs.com

On <https://www.npmjs.com/package/@axonity-ai/mcp> → **Settings** → **Trusted
Publisher** → **GitHub Actions**, fill in:

| Field | Value |
| --- | --- |
| Organization or user | `AxonityAI` |
| Repository | `axonity-mcp` |
| Workflow filename | `release.yml` |
| Environment | *(leave empty)* |

Save. Optionally, under **Publishing access**, choose "Require two-factor
authentication and disallow tokens" — Trusted Publishing keeps working, and no
token can publish behind its back.

### Branch protection

`main` has no branch protection and no rulesets today, so the bot's push goes
through. If `main` is protected later, a classic rule with *Require a pull
request before merging* refuses that push. Use a **ruleset** instead and add
the GitHub Actions app to its bypass list, or the release stops at the push
(red run, nothing published).

**Check the contract before a release that matters.** Shipping with a stale
snapshot is how the connector fell nine operations behind the backend without
any test noticing:

```bash
npm run check:contract          # expects ../axonity-flow; override with AXONITY_FLOW_PATH
```

It dumps the schema from a local `axonity-flow` checkout and diffs it against
`test/fixtures/openapi.snapshot.json`, naming every operation that moved. It
needs an `axonity-flow` checkout, so it is not part of the release workflow:
run it on the branch before merging.

Keep npm 11 locally: Node 20 bundles npm 10, whose resolver writes an
incompatible lockfile tree. CI pins npm 11 for the same reason.

The package bundles its dependencies (`bundleDependencies`): the tarball carries
the tree `npm ci` installed from `package-lock.json`, so whoever installs it —
Axonity's image and Windows package included — runs the versions the tests ran
on, not whatever the ranges allow that day. The release workflow runs `npm ci`
before it publishes, which is what makes the tree the lock's;
`test/bundledDependencies.test.ts` fails if a dependency is left out or the tree
on disk is not the lock's. A tarball is about ten times larger for it (3.1 MB
packed, 15.5 MB unpacked, at 0.29.0). `npm-shrinkwrap.json` would pin the same
but npm 12 does not pack it.

## Staying level with the backend

The snapshot every drift guard reads is only as fresh as the last time someone
regenerated it — and once it wasn't: it sat nine operations behind the backend
while the whole suite stayed green, because a snapshot that has not seen a route
cannot report it missing.

**Before merging, check it** (see §Releasing): `npm run check:contract` dumps
the schema from a local `axonity-flow` checkout and names every operation that
moved. It compares the contract surface — query parameters, request body,
response shape — and not descriptions, so backend docstring churn does not cry
wolf. CI cannot run it (it needs the backend checkout), so this is the one gate
that stays by hand.

**At startup, the connector asks the deploy what it mounts, and offers only
what it can serve.** It calls `GET /api/v1/contract` once before registering
its tools. A tool that needs a route this backend does not mount is left out
whole — never offered half-working — and the server instructions say once
which tools are switched off and that the environment needs an update (the
routes are listed on stderr too). So an older backend gets fewer tools, not
tools that fail mid-task. If the contract cannot be read (a backend too old to
serve `/contract`, an unreachable or slow one), every tool is offered, with a
warning in the instructions and on stderr: an unreadable contract is far more
often a passing network or token problem than an old backend, and cutting tools
on a guess would break ones that work. The connector never fails to start over
it. Every start checks afresh: a backend hash alone cannot prove that a different
connector version or snapshot still fits.

The check also compares `routeShapes` with `src/generated/routeShapes.ts`, built
from the pinned OpenAPI snapshot. A changed request or success response form
switches off the whole affected tool. Below the backend's `minConnectorVersion`,
all tools that call the API are switched off, while local help remains. The
instructions name the minimum version and backend build. A connector ahead of
the backend loses only tools with missing routes or mismatched forms; the
backend declares no maximum version, so a newer version alone is no reason to
reject it. Missing form/version metadata on an older backend warns and keeps
the existing route-presence check. Every HTTP request carries the package version
in `X-Axonity-Connector-Version`.

Builds require Python 3 (standard library only) to reproduce the backend's exact
JSON hashing rules: `npm run build` regenerates the committed shape snapshot
before TypeScript compilation. Runtime installations need only Node.js.

CI and the release workflow run `npm run check:deployed-contracts` against public
`/api/v1/contract` endpoints. Sandbox defaults to `https://axonity.onrender.com`;
set repository variables `AXONITY_STAGING_URL` and `AXONITY_PRODUCTION_URL` to
the public base URLs when available. No token is sent and no tenant is touched.
Unset URLs, authentication, timeouts and unavailable or incomplete contracts
produce warnings, not a failed release. A readable incompatible contract blocks
release. JSON results in the Actions logs and job summary bind the verdict to
the candidate connector version, backend build and contract hash. **A warning
does not prove compatibility for a tenant version upgrade.** The release checks
its computed candidate version before committing or publishing that version.

**Not here: a scheduled job.** Watching for drift on a timer belongs in
`axonity-flow`, not in this repository. The schema lives there, its CI already
has the backend's dependencies installed, and it can read this repository's
pinned snapshot over plain HTTPS because this repository is public — where the
reverse needs a credential for a private repo, with an approval policy and an
expiry behind it. Tracked in axonity-mcp#48.

TDQS

A3.6/5.0

Scored across 242 tools

Disambiguation5/5

Every tool embeds its entity and operation in the name (list_workflows, update_agent, restore_flow_version), so selection is unambiguous even across 242 tools. Potentially confusable clusters like execute_tool vs dry_run_tool vs execute_stored_connector and restore_X vs restore_X_version vs restore_deleted_X_version are explicitly differentiated in their descriptions. No two tools appear to do the same thing.

Naming Consistency5/5

The set follows a rigid snake_case verb_noun pattern: list_/read_/create_/update_/delete_/restore_/request_publish_/discard_*_draft, with version operations consistently suffixed (_versions, _version, _published) and list tools pluralized. The single non-verb outlier, axonity_conventions, is a deliberate read-me-first marker rather than a genuine pattern break.

Tool Count2/5

At 242 tools, the surface is far beyond even the 16-25 'heavy' band and sits in the extreme-mismatch territory. The count is inflated by repeating an identical ~18-tool lifecycle template across ten-plus entity types, which could have been compressed into parameterized entity operations. The systematic repetition makes it navigable, but the selection burden on an agent is severe.

Completeness4/5

Coverage of the draft→publish lifecycle is exceptionally thorough: every entity has CRUD, soft-delete/restore, deleted-list, draft discard, publish approval, full version history (including deleted-version recovery and major-version naming), and published-read variants, plus run, trigger, prompt-stack, and wiring tools. Minor gaps remain: cron and webhook triggers have no update operation (only conditional triggers do), and there is no way to cancel or withdraw a pending publish approval.

Maintenance

ActivityNo data
ResponsivenessOutdated data