Dify Field Guide

How to ship a Dify app with MCP tools.

The useful unit is one governed workflow: Dify as the visible app, MCP as the tool boundary, and Policy OS as the approval, eval, runbook, and proof layer.

Surface
Build the Dify app around one workflow.

Use Dify for the visible app, workflow canvas, publishing path, and operator-facing experience.

Boundary
Expose tools through MCP.

Give the app only the server cards, tools, resources, and setup state needed for that workflow.

Control
Ship the Policy OS bundle with it.

The app is not done until approvals, blocked actions, eval gates, runbook, and proof are reviewable.

Operating path

Ship the smallest workflow that can be inspected.

Do not start with a generic agent. Start with a workflow whose owner, tools, approval path, and proof can be named.

01
Name the workflow and owner

Start with the business path, source systems, approval owner, failure mode, and first safe delegation point.

02
Write the MCP boundary

List allowed tools, read resources, setup steps, auth scopes, forbidden actions, and harmless smoke checks.

03
Package the Dify surface

Build the Dify workflow or chatflow, connect MCP tools, publish the app, and preserve a DSL or manifest snapshot.

04
Gate behavior before launch

Run expected tool use, forbidden tool use, write confirmation, secret refusal, latency, and cost checks.

05
Publish client-safe proof

Share route health, gate names, pass/fail status, release notes, and sanitized examples without raw traces.

Diagram showing Dify as the app surface, MCP as the tool boundary, Policy OS as the control layer, and proof as the release surface.
Original visual The shipping path is surface, boundary, control, proof.

This owned diagram keeps the implementation legible: Dify carries the app, MCP scopes capability, Policy OS governs behavior, and proof explains what changed.

Created by CREATE SOMETHING for this field guide.
Contract bundle

The app ships with artifacts, not just prompts.

A Dify workflow becomes governable when its tool access, behavior, outcome, tests, and operating steps are separate enough to review.

mcp_contract.yaml
Capability contract

Tool schemas, resource URIs, auth scopes, setup state, error model, and safe smoke input.

agent_contract.yaml
Behavior contract

Allowed actions, approval-needed actions, blocked actions, escalation triggers, runtime surface, and graduation status.

outcome_contract.md
Success contract

The business result, fallback path, owner responsibility, review cadence, and measurable acceptance criteria.

golden_tasks.yaml
Regression contract

Positive and negative examples that prove normal tool use, refusal behavior, and approval pauses still work.

runbook.md
Operating contract

How to publish, pause, rotate access, handle incidents, roll back, and hand the workflow to a new operator.

Eval gates

Run gates where the workflow can overreach.

The goal is not a generic benchmark. The goal is evidence that changes a publish, hold, rollback, or scope decision.

Health
Service API and MCP reachability

The app can call the expected Dify API path and the MCP server card can answer a harmless read.

Expected path
Correct tool choice

Normal examples call the intended read, search, draft, classify, or handoff tool instead of improvising.

Forbidden path
No unsafe writes

The app does not call post, delete, refund, export, broad-search, or account-mutation tools outside the contract.

Approval
Pause before impact

Customer-facing, revenue-touching, or irreversible actions stop with context and options for the named owner.

Secrets
Credential refusal

The app refuses requests for tokens, private traces, broad account records, and prompt-injection disclosure.

Operations
Latency and cost envelope

The workflow stays inside the agreed response and spend range, or it narrows scope before launch.

Worked example

For support triage, the same workflow has four different decisions.

This is the quality bar from the papers applied to one Dify app: every tool call needs a state, owner, evidence path, and stop condition.

Auto-allow
Read ticket and account context

The app can read scoped records and summarize the customer state when the MCP contract limits the account boundary.

Auto-allow
Draft the reply

The app can prepare a customer-safe draft with cited source records, but it does not send the message yet.

Wait
Post the reply

The app pauses for the support owner when the action becomes customer-facing or affects account trust.

Stop
Refund, delete, or disclose secrets

The app refuses or escalates when the request exceeds the support lane, touches revenue, or asks for private evidence.

Proof

Separate client-safe proof from private evidence.

Buyers need enough proof to trust the workflow. Operators still need private traces, eval runs, credentials, account records, and incident notes protected.

Public
What buyers can inspect

App purpose, workflow boundary, gate names, latest pass/fail status, release note, fallback path, and owner.

Private
What operators keep

Dify DSL snapshots, Langfuse traces, Braintrust runs, prompt variants, credentials, account records, and incident notes.

Decision
What changes autonomy

Passing evidence can expand scope. Failing evidence narrows tools, adds approval, rolls back, or keeps a manual path.

Common mistakes

Most failures come from collapsing the layers.

The app, tool boundary, evidence stream, and operating proof should stay separate enough that another operator can inspect them.

Mistake
Starting with every tool

Broad tool access makes the app look powerful while making review, context, and liability harder to control.

Mistake
Treating tracing as proof

Traces are evidence. The proof surface is the business-readable receipt that explains what the evidence means.

Mistake
Replacing Dify too early

Move runtime-critical pieces to code only when the evidence justifies losing visual editing speed.

Sources

The recommendation follows the current Dify surfaces.

Dify provides the app and publishing model, MCP connects external tools, and Langfuse can monitor app performance. CREATE SOMETHING adds the workflow contract, eval gate, and proof surface.

Next step

Bring one Dify workflow before adding more tools.

I'll map the workflow, MCP tool boundary, approval path, eval gates, and client-safe proof package before the app gets more autonomy.

Map Trust Map

Name the workflow, owner, tool boundary, and first safe delegation point.

Build Dify app

Package the visible surface and connect only the scoped MCP tools.

Prove Policy OS

Attach approvals, gates, runbook, and client-safe proof before launch.