nby n8n
Create a workflow
Creates an n8n workflow from its nodes and connections and returns the new workflow with its ID.
Description
The API and `n8n-cli workflow create --stdin` take workflow JSON. The MCP tool takes TypeScript or JavaScript written with the n8n Workflow SDK, validated first with `validate_workflow`; it assigns available credentials to nodes and makes the workflow available to MCP. A workflow runs in production only once it is published (`publish_workflow` on the MCP server).
create-workflow.md
Create a workflow
Creates an n8n workflow from its nodes and connections and returns the new workflow with its ID.
The API and n8n-cli workflow create --stdin take workflow JSON. The MCP tool
takes TypeScript or JavaScript written with the n8n Workflow SDK, validated
first with validate_workflow; it assigns available credentials to nodes and
makes the workflow available to MCP. A workflow runs in production only once
it is published (publish_workflow on the MCP server).
Set up
Use the first option your agent supports.
MCP (official, remote)
Add this server to your agent's MCP settings, then sign in when asked.
{ "mcpServers": { "n8n": { "url": "https://{your-n8n-domain}/mcp-server/http" } } }
Call the MCP tool create_workflow_from_code.
Server URL: https://{your-n8n-domain}/mcp-server/http
CLI (official)
Install the command, then confirm it runs.
npm install -g @n8n/cli
n8n-cli --version
Run n8n-cli workflow create.
Set $N8N_API_KEY in your environment first.
API (official)
- Base URL: https://{your-domain}/api/v1
- Endpoint:
POST /workflows - Auth: send the header
X-N8N-API-KEY: $N8N_API_KEY - Docs: https://docs.n8n.io/connect/n8n-api
Before doing anything else, make one read-only call to confirm access.
Rules
- Ask the user before anything that sends messages, costs money, or changes data.
- Never print API keys.
Built from these files in the repository
The layout and the rules come from lib/catalog/render-markdown.ts, the set-up wording from lib/catalog/render-access.ts.