# Author workflows through MCP

Build disabled typed graphs with discovered identities, exact pins and guarded saves.

Canonical URL: https://opennodeflow.dev/wiki/mcp-workflow-authoring/
JSON reference: https://opennodeflow.dev/wiki/mcp-workflow-authoring/index.json
Source snapshot: 2026-10-23

An agent should construct a workflow from discovered contracts rather than generating plausible node names. A graph node instance, reusable definition and socket are distinct identities. The node owns position and literals; its definition pin selects immutable code and ports; each edge names exact socket IDs.

## Discover existing capabilities

Read `onf_overview`, list workspaces and read the selected workspace's notes. Discover definitions with `onf_list_definitions`, using `workspaceId` and focused kind, pack or text filters. Fetch the chosen exact version through `onf_get_definition`. Check input/output IDs, required/default rules, configuration schema, effects and transitive type/executor dependencies.

Packed integrations normally appear after installation in the workspace's authoring scope. Inspect [library packs](/wiki/library-packs/) before deciding an asset is absent. Publish a new definition only when a suitable reusable one does not exist.

## Create a manual draft

`onf_create_workflow` requires `workspaceId` and `name`. Defaults are an empty graph, disabled automation and a manual trigger. Supply node/edge arrays once contracts are known. A node requires `id`, `definitionId`, positive `definitionVersion`, finite `position:{x,y}`, and object-valued `config` and `inputs`.

An edge needs its own ID, `source`, `sourceHandle`, `target` and `targetHandle`. Handles are socket IDs, not labels. Only node and trigger definitions belong on the canvas; types and executors are dependencies. Custom socket connections require matching type identity and exact version. Similar-looking JSON is not automatically compatible. See [types](/wiki/types/) and [versioning](/wiki/versioning/).

## Save and validate

For an existing workflow, fetch `onf_get_workflow` or `onf_get_graph` and retain its revision. Prefer [targeted patches](/wiki/agent-graph-patching/) with `expectedRevision`. Run `onf_validate_workflow` after saving. Validation checks sockets, pins, required values, schemas, configuration and acyclic dependencies without executing node code.

A valid graph is not a provider check. Credentials, permissions and real payloads may still fail during execution. An incomplete disabled draft is useful while assembling a workflow; keep unresolved issues explicit rather than enabling automation to bypass validation.

Use `onf_arrange_workflow` with a current revision for layout. It preserves execution identities and respects frames with `lockAutoArrange:true`. A dry-run layout can be reviewed before saving.

## Return inspectable evidence

Report the saved workflow ID, workspace, revision, validation result, chosen pins and outstanding setup. Update concise workflow/frame notes after changes to purpose, wiring or operating constraints. When execution is authorized, retain the accepted run ID and inspect its final status. A successful save is different from a successful run. [Agent recipes](/wiki/agent-recipes/) offer bounded starting requests.

---

## Documentation provenance

- `docs/MCP.md`
- `server/mcp-tools.ts`
- `server/mcp-graph.ts`

This page describes maintained source, not a live inventory or an authorization to perform actions.
