feat(mcp-server): expose workflow tools in Forest MCP server (PRD-49) - #1792
Open
christophebrun-forest wants to merge 6 commits into
Open
feat(mcp-server): expose workflow tools in Forest MCP server (PRD-49)#1792christophebrun-forest wants to merge 6 commits into
christophebrun-forest wants to merge 6 commits into
Conversation
3 new issues
|
Expose MCP-enabled workflows to LLM clients via a new listWorkflows tool, calling the Forest server MS3 endpoint (GET /api/workflow-orchestrator/workflows) over the HTTP contract with the caller's forestServerToken + renderingId. - forestadmin-client: WorkflowsService + ForestHttpApi.listMcpEnabledWorkflows - mcp-server: listWorkflows tool, http-client wiring, shared getAuthContext util Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* feat(mcp-server): add triggerWorkflow tool (PRD-738)
Expose the triggerWorkflow MCP tool so an LLM can start a run on a
specific record and get a runId back. Non-blocking by design: the run
continues server-side and status is observed via getWorkflowRun (MS8).
- tool args { workflowId, recordId }; identity from the OAuth auth
context (forestServerToken + renderingId), wrapped in withActivityLog
so MCP-triggered runs are audited locally under the caller.
- forestadmin-client: WorkflowsService.triggerMcpWorkflow calls the
MCP-dedicated start endpoint over HTTP
(POST /api/workflow-orchestrator/workflows/:workflowId/start), no
private-api internals imported.
- collectionId is derived server-side from the workflow (MS5), so the
tool contract stays { workflowId, recordId } — consistent with the
webhook trigger.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…32) (#1786) MCP-triggered runs carry triggerType='mcp', but the executor only recognized manual|webhook, so AvailableStepExecutionSchema.parse rejected every MCP run at step 0 with a DomainValidationError before executing. triggerType is informational only (logged in runner.ts, no logic branches on it), so a run was aborted purely over an unrecognized logged value. Add 'mcp' to TriggerType and ServerWorkflowTriggerType so MCP runs map to a valid AvailableStepExecution and execute. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(mcp-server): add getWorkflowRun tool (PRD-740) Expose the getWorkflowRun polling tool so the LLM can observe a run's status, closing the discover -> trigger -> poll loop. Report-only in v1: human-gated runs report waitingForHumanInput but cannot be resumed via MCP (tracked in PRD-441). Threads a getMcpWorkflowRun call through forestadmin-client (types, HTTP api, workflows service) to the MS7 read endpoint, and registers a read-only getWorkflowRun MCP tool scoped to the caller. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
christophebrun-forest
force-pushed
the
feature/prd-49-expose-workflow-tools-in-forest-mcp-server
branch
from
August 3, 2026 12:21
e87448d to
71eea4a
Compare
Member
|
WorkflowRunTriggerResult.runId was typed number while getMcpWorkflowRun expects a string runId, so the trigger result could not be fed back into the run polling without conversion. The orchestrator's numeric id is now normalized at the HTTP boundary and the contract uses string end-to-end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lows (PRD-831) (#1805) perf(mcp-server): trigger workflow by id instead of listing all workflows triggerWorkflow no longer calls listMcpWorkflows before every trigger just to resolve the name/collection for the audit label. It now starts the run directly and reads workflowName/collectionName from the (enriched) start response, falling back to the workflowId when an older server omits them. A server 404 (unknown or MCP-disabled workflow) is mapped back to the existing "is not an MCP-enabled workflow" message so the LLM-facing contract is unchanged. The audit log is recorded after the run starts and is best-effort — the run is already ongoing, so a logging hiccup no longer fails the tool. fixes PRD-831 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Integration branch for the PRD-49 epic — expose Forest workflow triggering to MCP clients. Adds a report-only (v1) toolset so an LLM can list, trigger, and observe Forest workflows through the MCP server.
The MCP tools call into
@forestadmin/forestadmin-client(WorkflowsService→ForestHttpApi), which hits the Forest orchestrator (/api/workflow-orchestrator/mcp-workflows/*) under the MCP session identity (forestServerToken,Forest-Application-Source: MCP).Included work
listWorkflowstool (feat(mcp-server): add listWorkflows tool (PRD-736) #1771)triggerWorkflowtool (feat(mcp-server): add triggerWorkflow tool (PRD-738) #1777)getWorkflowRuntool (feat(mcp-server): add getWorkflowRun tool (PRD-740) #1785)triggerType='mcp'in the run mapper (fix(workflow-executor): accept triggerType='mcp' in run mapper (PRD-832) #1786)Behavior (v1, report-only)
listWorkflows→ available MCP-enabled workflowstriggerWorkflow→{ runId, runState }getWorkflowRun→ pollrunState,currentStep,waitingForHumanInput, terminal result/errorA run parked on a human-gated step reports
waitingForHumanInput: true; resuming it via MCP is out of scope here and handled in the follow-up PRD-441 (submitWorkflowInput).Tests
New/updated unit tests across
mcp-server,forestadmin-client,workflow-executor, plus cross-package mocks inagent-testingandagent.fixes PRD-49
🤖 Generated with Claude Code
Note
Add workflow tools (listWorkflows, triggerWorkflow, getWorkflowRun) to the Forest MCP server
listWorkflows,triggerWorkflow, andgetWorkflowRun, enabled by default.WorkflowsServicein forestadmin-client that wraps the three correspondingForestHttpApiendpoints; each method throws if the transport does not implement the operation.triggerWorkflowmapsNotFoundErrorto a user-facing message directing callers to uselistWorkflows, and records an activity log entry (failures are caught and warned, not surfaced to the caller).workflowsServiceonForestAdminClientand threads it throughForestAdminClientWithCache,buildApplicationServices, and the agent'sForestServerClientImpl.TriggerType.McpandServerWorkflowTriggerType.mcpto the workflow-executor type enums.Macroscope summarized a4d3949.