Skip to content

MCP errors, audit and cleanup: generic upstream errors, three-state audit, central tool validation (0.14.0) - #32

Merged
schmunk42 merged 19 commits into
masterfrom
feature/flowable-mcp-errors-audit
Nov 26, 2026
Merged

schmunk42 merged 19 commits into
masterfrom
feature/flowable-mcp-errors-audit

Conversation

@schmunk42

Copy link
Copy Markdown
Member

Completes #18 after part A in 0.13.0 and prepares release 0.14.0. The full list for consumers, separated by HTTP, MCP, CLI and Worker, is in CHANGELOG.md.

What changes

  • Errors: a 502 or 504 carries a generic message with a correlation id and nothing from the engine; over HTTP the id is also in X-Correlation-Id; the details are logged once as flowable.upstream_error. A 422 keeps the first line of the engine message, at most 200 characters. getHealthInfo() returns the generic text as well.
  • Audit: every write leaves an attempt entry and then a success or a failure entry, with via=http|mcp|cli|worker, the MCP tool name, and on failure the status and the correlation id. The write CLI commands and ExternalWorkerRunner are audited. Deployments carry the sha256 of each file and of the archive.
  • MCP switches: a switch that is not a literal boolean at build time (env placeholder, string) fails the container build; McpResource entries follow mcp.read.
  • Central MCP argument validation: one decorator in front of the read step of the MCP provider chain validates every tool of the bundle, also when an application replaced its provider; the build fails when MCP is on and there is no place to hook in. The per-provider calls are gone.
  • Write tools: the published and the enforced input file come from one constant on the processor.
  • apiConfiguration: the read tools and flowable_dmn_deploy accept the {uuid} form; descriptions name the accepted selector forms.
  • Uploads: the full suffix is checked (.dmn.xml, .cmmn.xml); the CLI upload commands apply the file name rule.
  • History: the newest 200 activities and failed decision executions are kept.
  • Docs: tool descriptions and README corrected; new README sections on errors, audit and rate limiting.
  • Dependency: dmstr/openapi-json-schema-bundle ^0.5.0 || ^0.6.0.

Commits

One commit per step. The refactor commits come before the behaviour changes and leave the suite and the schema snapshot unchanged; the snapshot changes deliberately in two commits ({uuid} on the read tools, description texts).

Verification

Split out of #18

Closes #18

🤖 Generated with Claude Code

schmunk42 and others added 19 commits November 26, 2026 14:18
Widen the constraint to ^0.5.0 || ^0.6.0. The suite is green with
0.5.0 and with 0.6.0.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Processor, command and MCP schema factory each built the path of an
operation input file themselves. Schema\InputSchemaPath is now the one
place that knows where these files live; behaviour and the schema
snapshot are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
page, itemsPerPage, sort and order of the three list tools are now
$defs in api-configuration.json; sort keeps its description per tool.
The resolved schemas and the snapshot are unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The single upload and the bundle decoded and size-checked inline
content with the same logic. UploadRule::decodeInlineContent() does it
once; each caller keeps its own error messages.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The selector-to-id rule now lives in the trait that processors and
providers share, so the read providers can use it. No behaviour change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Service\FlowableAuditLogger knows the shape of an audit entry and takes
the actor from its caller, so processors, commands and the external
worker can share it. The processors' output is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…owable logger [*]

TestFlowableEngine can answer with an HTTP error or a transport error,
TestKernel takes options for the MCP switches, extra parameters and
use_symfony_listeners (one cache directory per configuration), and the
flowable channel is recorded instead of discarded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A 502 or 504 no longer carries the engine body, the engine URL or the
transport error text. The caller gets a generic message with a
correlation id, over HTTP also as X-Correlation-Id; the details are
logged once as flowable.upstream_error with the same id. A 422 keeps
the first line of the engine message, at most 200 characters, and the
fallback to the raw response body is gone. getHealthInfo() returns the
generic text as well. The logger argument of FlowableClient and
FlowableClientLocator is optional.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…y write [*]

Every write now leaves an attempt entry and then a success or a failure
entry, with via=mcp|http|cli|worker, the MCP tool name, and on failure
the status and the correlation id of the upstream error. The write CLI
commands audit with via=cli, ExternalWorkerRunner with via=worker and
the worker id as actor. Deployments carry the sha256 of each file and
of the archive that is sent. The worker's outcome and shutdown
unacquire lines are replaced by the audit entries of the same message;
flowable.external_worker.bpmnError becomes .bpmn_error.

Also fixes flowable:external-worker:bpmn-error, which looked for a
schema file that does not exist and failed on every call.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ows mcp.read [*]

The switches filter resource metadata inside API Platform's metadata
cache, so an env placeholder would be frozen there. A compiler pass now
fails the container build when mcp.read, mcp.write or mcp.deploy is not
a literal boolean, also when the application overrides the parameter or
the decorator's arguments. McpResource entries of the bundle are kept
only with mcp.read on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A provider decorator in front of the read step of the MCP provider
chain validates the arguments of every tool call of the bundle's
resources against the published input schema, also when an application
replaced the tool's provider. Tools of other bundles pass through. A
compiler pass hooks it into api_platform.mcp.state_provider.read or,
without use_symfony_listeners, api_platform.state_provider.read, and
fails the build when MCP is on and neither exists. URI variables of
write tools are now validated as well.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e covers it [*]

The six read providers and the DMN upload processor no longer validate
MCP arguments themselves; McpToolInputValidationProvider does it for
every bundle tool in front of the provider. Results over the MCP
transport are unchanged. Removed for subclasses: the $mcpInput
constructor argument and property of AbstractFlowableProvider,
FlowTaskFormProvider and AbstractFlowableProcessor, and
AbstractFlowableProvider::validateMcpInput(). The tests of the removed
calls moved to the MCP transport or are covered by the decorator's
unit tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…le of a write tool [*]

A processor names its input file once, in INPUT_SCHEMA; validatedBody()
enforces it over HTTP and MCP, and the tool attribute publishes the same
constant. A test discovers every write tool from the metadata and
proves that both sides resolve to the same file.
AbstractFlowableProcessor::schemaPath() is replaced by INPUT_SCHEMA,
inputSchemaPath() and validatedBody().

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… as {uuid} [*]

The six read tools and flowable_dmn_deploy now publish the selector as
a string or {uuid}, like the write tools. The read providers resolve it
with configurationId(), so a value that is neither is rejected with a
400 instead of falling back to the default connection. The unused
definition apiConfigurationString is removed. The schema snapshot
changes only in the apiConfiguration property of these seven inputs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ule on the CLI [*]

A name ending in .dmn.xml or .cmmn.xml passed as .xml where DMN or
CMMN is not accepted: in flowable_deploy_bundle, and .cmmn.xml in the
process deployment upload. UploadRule now checks the full suffix. The
three CLI upload commands apply the same file name rule and the same
extension list as their HTTP and MCP counterparts; the lists live on
the processors.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…utions [*]

flowable_history_get asked for the first 200 rows in ascending order,
so a long-running instance lost its newest activities. The rows are now
fetched newest first and returned oldest first, as before. Tests pin
how failedDecisionExecutionsTotal comes about when the engine ignores
the failed filter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ur with tests [*]

Tool failures are JSON-RPC errors, not tool errors; flowable_dmn_evaluate
returns the engine's rows of result variables and adds a history row;
the timer tool only moves the job and needs an active async executor;
executions have no total. The README gains sections on errors and the
correlation id, the audit entries and rate limiting, and is corrected
on oneOf, structuredContent, the selector forms and the upload rules.
New tests pin the timer call, the DMN result shape, the DMN and event
uploads and the input schema endpoints. No runtime change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The descriptions said "full or partial UUID", but the selector is the
first 8 characters of the UUID or the full UUID, lowercase. The 21
attribute descriptions now share FlowableClientLocator::SELECTOR_DESCRIPTION,
and the files[].name description of flowable_deploy_bundle names the
accepted extensions. The schema snapshot changes in descriptions only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@schmunk42 schmunk42 self-assigned this Nov 26, 2026
@schmunk42
schmunk42 merged commit 7e6d79e into master Nov 26, 2026
2 checks passed
@schmunk42
schmunk42 deleted the feature/flowable-mcp-errors-audit branch November 26, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP tools: security hardening and cleanup after review

1 participant