Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified images/workflows/webhook-trigger-rows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions product/embed/mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The Forest MCP server lets AI tools like Claude, Dust, and others to:
- Access collection schemas
- Securely query and browse your data
- Execute actions on records
- Start [Workflows](/product/process/workflows/overview) on a record and follow their progress

All of this while respecting the Roles & Permissions of your Forest project, and logging every activity, just like if they were performed through the UI.

Expand Down Expand Up @@ -145,6 +146,18 @@ The Forest MCP server exposes the following capabilities:
| `getActionForm` | Get form fields for a smart action |
| `executeAction` | Execute a smart action |

### Workflows

| Tool | Description |
| ----------------- | ------------------------------------------------------------ |
| `listWorkflows` | Discover the workflows enabled for MCP triggering |
| `triggerWorkflow` | Start a workflow run on a record |
| `getWorkflowRun` | Poll the status of a run started through MCP |

<Note>
Workflows are **opt-in per workflow**: only those whose **MCP** trigger is enabled are visible to these tools. See [Triggering workflows from an AI assistant](#triggering-workflows-from-an-ai-assistant).
</Note>

## Restrict tools

You can restrict which tools the MCP server exposes using `enabledTools`. Only the tools you list will be available, and **new tools added in future releases will NOT be automatically enabled**, so your configuration stays safe over time.
Expand Down Expand Up @@ -267,6 +280,135 @@ url = "<your-mcp-endpoint>"
Use the MCP transport type `"http"` (not `"sse"` or `"url"`): the Forest MCP server uses Streamable HTTP. Your URL should still use `https://`. Clients that rely on `mcp-remote` (Claude Desktop, Windsurf, JetBrains) require Node.js 18\+ (some versions need 20\+).
</Info>

## Triggering workflows from an AI assistant

Three tools let an assistant drive a [Workflow](/product/process/workflows/overview) end-to-end from its own context: pick a workflow that fits the record at hand, start it, then watch the run.

<Info>
A workflow is only reachable through MCP once an editor enables its **MCP** trigger in the workflow's [trigger settings](/product/process/workflows/triggers#the-mcp-trigger). Nothing is exposed by default.
</Info>

### Discover → trigger → poll

The three tools are meant to be chained, and the split is deliberate: MCP has no push channel, and a run is asynchronous — it can be long, or parked waiting for a person. So `triggerWorkflow` returns immediately with a `runId`, and the assistant polls `getWorkflowRun` for as long as it cares about the outcome.

```mermaid
flowchart LR
L["listWorkflows<br/>(pick a workflow)"] --> T["triggerWorkflow<br/>(→ runId)"] --> G["getWorkflowRun<br/>(poll runState)"]
G -. "not finished yet" .-> G
```

1. **Discover** — `listWorkflows` returns the MCP-enabled workflows the connected user can reach, with the collection each one operates on. Pass `collectionName` to narrow it to the collection of the record in context.
2. **Trigger** — `triggerWorkflow` starts a run on one record and returns its `runId`. The run continues server-side; nothing blocks.
3. **Poll** — `getWorkflowRun` reports the run's state, the step it is on, whether it is waiting for a human, and, once terminal, its result or error.

### `listWorkflows`

Lists workflows with the MCP trigger enabled, scoped to the connected user's rendering and permissions.

| Argument | Description |
|---|---|
| `collectionName` | Optional. Narrows the results to workflows operating on that collection — typically the collection of the record in context. |

```json Returns
[
{
"workflowId": "9f1b0c4e-2f7a-4d5b-9e31-6c0a8b7d1234",
"name": "KYC review",
"collectionName": "customers"
}
]
```

An empty array means no workflow is MCP-enabled for that user — most often because nobody has turned the toggle on yet.

### `triggerWorkflow`

Starts a run of an MCP-enabled workflow on a specific record.

| Argument | Description |
|---|---|
| `workflowId` | As returned by `listWorkflows`. Its MCP trigger must be enabled. |
| `recordId` | The record to run on. Composite primary keys use the packed form, values joined by `\|` (e.g. `"123\|456"`). |

```json Returns
{ "runId": 1234, "runState": "loading" }
```

`runId` is what every subsequent `getWorkflowRun` call needs. `runState` is only the state at that instant — it depends on the workflow's first step, and it moves on without further calls, so treat it as a starting point, not an outcome.

<Note>
The record is **not** checked when the run is created — the orchestrator has no data access at that point. An id that does not exist, or that the user cannot read, produces a run that fails at its first data step; the assistant sees it through `getWorkflowRun`'s `error`, not as a trigger-time failure.
</Note>

Only **one run per record** can be active at a time. Triggering a record that already has an ongoing run fails and does **not** resume it — the run in flight is left untouched.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium embed/mcp-server.mdx:344

The documentation states "one run per record can be active at a time," but this is stricter than the actual behavior. The webhook trigger allows one active run per workflow per record — running a different workflow on the same record does not conflict. As written, the assistant would avoid triggering a second workflow on a record that already has any run in flight, when in fact only re-triggering the same workflow conflicts.

Suggested change
Only **one run per record** can be active at a time. Triggering a record that already has an ongoing run fails and does **not** resume it — the run in flight is left untouched.
Only **one run per workflow per record** can be active at a time. Triggering a record that already has an ongoing run of the same workflow fails and does **not** resume it — the run in flight is left untouched.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @product/embed/mcp-server.mdx around line 344:

The documentation states "one run per record can be active at a time," but this is stricter than the actual behavior. The webhook trigger allows one active run **per workflow per record** — running a different workflow on the same record does not conflict. As written, the assistant would avoid triggering a second workflow on a record that already has any run in flight, when in fact only re-triggering the *same* workflow conflicts.


### `getWorkflowRun`

Reads the normalized status of a run, given the `runId` returned by `triggerWorkflow`.

| Field | Description |
|---|---|
| `runState` | `pending` or `loading` while a step is queued or executing, `started` when the run is parked, `finished` on completion, `aborted` when stopped. |
| `currentStep` | The step the run sits on — its `name` and `type` (plus a `taskType` on task steps). `null` once the run is finished. |
| `waitingForHumanInput` | `true` when the run is parked on a step a person must handle. |
| `result` | The step the run ended on, populated only once `runState` is `finished`. |
| `error` | The failure recorded on the current step, including a first-data-step failure on an unreachable record. `null` otherwise. |

<CodeGroup>

```json Parked on a human step
{
"runState": "started",
"currentStep": {
"name": "Review the KYB documents",
"type": "task",
"taskType": "guideline"
},
"waitingForHumanInput": true,
"result": null,
"error": null
}
```

```json Finished
{
"runState": "finished",
"currentStep": null,
"waitingForHumanInput": false,
"result": { "name": "Customer approved", "type": "end", "context": {} },
"error": null
}
```

</CodeGroup>

<Warning>
`getWorkflowRun` only exposes runs that were **started through MCP**. A run triggered manually or by webhook is not observable here, even by the same user — asking for its id returns a not-found error.
</Warning>

### Runs that need a human

In this first version the assistant can *observe* a parked run but not answer it. When `waitingForHumanInput` is `true`, the run is waiting in the workflow's **fallback inbox**, and someone finishes it from the Forest UI. Relaying the step's question into the chat and submitting the answer through MCP is planned, not available yet.

### Errors

Tool failures come back as tool errors with an explanatory message, so the assistant can react rather than crash:

| Situation | What the assistant gets |
|---|---|
| The workflow's MCP trigger is off, is unknown, or the user cannot reach it | Not found — with a hint to call `listWorkflows` |
| A run is already ongoing on that record | Conflict; no run is started and none is resumed |
| The `runId` is unknown, belongs to another user's rendering, or was not started through MCP | Not found |
| The project has no [Forest Runtime](/product/process/workflows/forest-runtime) installed | Conflict — automated triggering needs server-side execution |

### Identity, auditing, and limits

- **Identity** — the run executes as the Forest user of the MCP session, established by the OAuth login. Its permissions bound everything the run can read, write, or trigger.
- **Auditing** — each trigger is recorded in the run history and in your **Activity Logs**, attributed to that user and labelled *via MCP*, so MCP-started runs are distinguishable from manual and webhook ones.
- **Rate limiting** — the workflow tools have no dedicated limiter. They inherit the MCP server's authentication and limits; unlike the [webhook trigger](/reference/api/endpoints/trigger-workflow-webhook#rate-limiting), there is no anonymous surface to protect. The single-run-per-record rule also absorbs repeated triggers on the same record.
- **Turning it off** — drop `triggerWorkflow` from [`enabledTools`](#restrict-tools) to remove MCP triggering across all workflows, or disable a single workflow's MCP toggle. Either way, manual and webhook starts of that workflow keep working.

## Use cases

### AI-assisted operations
Expand All @@ -286,6 +428,8 @@ Use Claude or other AI assistants to:

> "Execute the 'Send Invoice' action on order #12345"

> "Start the KYC review workflow on customer #482 and tell me where it gets to"

## Security

The Forest MCP server:
Expand All @@ -295,6 +439,7 @@ The Forest MCP server:
- Logs all operations for audit purposes
- Never exposes sensitive data without proper access
- Lets you shorten the OAuth token lifetimes (see [Token lifetimes](#token-lifetimes))
- Exposes no workflow until an editor opts that workflow in (see [Triggering workflows](#triggering-workflows-from-an-ai-assistant))

<Warning>
Only provide MCP server access to trusted AI tools and users. The server can perform any operation that the authenticated user can perform.
Expand Down
2 changes: 1 addition & 1 deletion product/execute/workflows.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Workflows can be executed from:

The workflow opens in a guided panel. The user works through each step; the workflow context accumulates as they go.

Workflows can also be started automatically by an external system through a [webhook trigger](/product/process/workflows/triggers), without a user in the interface.
Workflows can also start without a user in the interface — from an external system through a [webhook](/product/process/workflows/triggers), or from an AI assistant through the [Forest MCP server](/product/embed/mcp-server). When such a run reaches a step that needs a human, it is routed to the workflow's **fallback inbox**, where an operator picks it up and finishes it as usual.

## AI-powered steps

Expand Down
4 changes: 2 additions & 2 deletions product/process/workflows/forest-runtime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Because it talks to your data through your own Forest agent, **the Forest orches

## Do I need Forest Runtime?

Yes — Forest Runtime is what executes your workflow steps. **[Webhook-triggered workflows](/product/process/workflows/triggers) especially**: a webhook can fire at any time, with no guarantee anyone has Forest open in a browser, so they can only run server-side.
Yes — Forest Runtime is what executes your workflow steps. **[Automatically-triggered workflows](/product/process/workflows/triggers) especially**: a webhook call or an AI assistant can fire at any time, with no guarantee anyone has Forest open in a browser, so those runs can only execute server-side. Until Forest Runtime is installed, both automated triggers stay locked in the workflow's settings.

Running on infrastructure you control also keeps the records handled by data steps out of Forest's infrastructure — decisive for compliance or data-residency requirements, or when a step needs access to systems reachable only from within your network.

## How it works

1. A workflow is triggered — by a user or a [webhook](/product/process/workflows/triggers). The Forest orchestrator queues the pending steps.
1. A workflow is [triggered](/product/process/workflows/triggers) — by a user, a webhook, or an AI assistant. The Forest orchestrator queues the pending steps.
2. Forest Runtime polls the orchestrator and pulls the steps assigned to it.
3. Each step runs locally, reaching your data and actions through your Forest agent.
4. It reports the step outcome back to the orchestrator, which advances the workflow.
Expand Down
4 changes: 2 additions & 2 deletions product/process/workflows/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ Workflows can also be made available in Summary Views and Workspaces.

### Triggering workflows

By default, workflows are started manually by users from the interface. A workflow can also be triggered automatically by an external system through a **webhook**, configured in the **Process** section of the workflow settings.
By default, workflows are started manually by users from the interface. A workflow can also be started without anyone in the interface: by an external system through a **webhook**, or by an AI assistant through the **[Forest MCP server](/product/embed/mcp-server)**. Both are opt-in per workflow, from the **Triggers** section of the workflow settings.

<Card title="Workflow triggers" icon="bolt" href="/product/process/workflows/triggers">
Enable manual and webhook triggers, and manage the webhook URL and token
Enable the manual, webhook, and MCP triggers, and manage access to each
</Card>

---
Expand Down
Loading