productivity
n8n CLI for Headless Automation
Use the n8n CLI for headless automation with headless JSON commands, schema discovery, credentials, and permission controls.
7 functions 6 read 1 write API key auth
n8n CLI for Headless Automation
Use KosmoKrator as a non-interactive integration runtime for local automations and wrappers.
Use headless automation when another tool needs a stable local command surface. The n8n CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# n8n CLI for Headless Automation
kosmokrator integrations:configure n8n --set api_key="$N8N_API_KEY" --enable --read allow --write ask --json
kosmo integrations:call n8n.n8n_list_workflows '{"cursor":"example_cursor","limit":1}' --json Discovery Before Execution
Agents and scripts can inspect n8n docs and schemas before choosing a function.
kosmo integrations:docs n8n --json
kosmo integrations:docs n8n.n8n_list_workflows --json
kosmo integrations:schema n8n.n8n_list_workflows --json
kosmo integrations:search "n8n" --json
kosmo integrations:list --json Useful n8n CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
n8n.n8n_list_workflows | Read | cursor, limit | List n8n workflows. Supports pagination with cursor and limit parameters. |
n8n.n8n_get_workflow | Read | workflow_id | Get detailed information about a specific n8n workflow, including its nodes, connections, and settings. |
n8n.n8n_create_workflow | Write | name, nodes, connections, settings, tags | Create a new n8n workflow. Requires a name. Optionally define nodes, connections, and settings. |
n8n.n8n_list_executions | Read | cursor, limit, status, workflow_id | List n8n workflow executions. Supports filtering by status and workflow ID, with pagination. |
n8n.n8n_get_execution | Read | execution_id | Get detailed information about a specific n8n workflow execution, including status, data, and node results. |
n8n.n8n_list_credentials | Read | cursor, limit | List n8n credentials. Supports pagination with cursor and limit parameters. |
n8n.n8n_get_current_user | Read | none | Get the authenticated n8n user's profile information, including name, email, and role. |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.