KosmoKrator

productivity

n8n CLI for AI Agents

Use the n8n CLI from KosmoKrator to call n8n tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

n8n CLI Setup

n8n can be configured headlessly with `kosmokrator integrations:configure n8n`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure n8n --set api_key="$N8N_API_KEY" --enable --read allow --write ask --json
kosmokrator integrations:doctor n8n --json
kosmokrator integrations:status --json

Credentials

Authentication type: API key api_key. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
api_key N8N_API_KEY Secret secret yes API Key

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call n8n.n8n_list_workflows '{"cursor":"example_cursor","limit":1}' --json
Provider shortcut
kosmo integrations:n8n n8n_list_workflows '{"cursor":"example_cursor","limit":1}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
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

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

n8n.n8n_list_workflows

List n8n workflows. Supports pagination with cursor and limit parameters.

Read read
Parameters
cursor, limit
Generic call
kosmo integrations:call n8n.n8n_list_workflows '{"cursor":"example_cursor","limit":1}' --json
Shortcut
kosmo integrations:n8n n8n_list_workflows '{"cursor":"example_cursor","limit":1}' --json

n8n.n8n_get_workflow

Get detailed information about a specific n8n workflow, including its nodes, connections, and settings.

Read read
Parameters
workflow_id
Generic call
kosmo integrations:call n8n.n8n_get_workflow '{"workflow_id":"example_workflow_id"}' --json
Shortcut
kosmo integrations:n8n n8n_get_workflow '{"workflow_id":"example_workflow_id"}' --json

n8n.n8n_create_workflow

Create a new n8n workflow. Requires a name. Optionally define nodes, connections, and settings.

Write write
Parameters
name, nodes, connections, settings, tags
Generic call
kosmo integrations:call n8n.n8n_create_workflow '{"name":"example_name","nodes":"example_nodes","connections":"example_connections","settings":"example_settings","tags":"example_tags"}' --json
Shortcut
kosmo integrations:n8n n8n_create_workflow '{"name":"example_name","nodes":"example_nodes","connections":"example_connections","settings":"example_settings","tags":"example_tags"}' --json

n8n.n8n_list_executions

List n8n workflow executions. Supports filtering by status and workflow ID, with pagination.

Read read
Parameters
cursor, limit, status, workflow_id
Generic call
kosmo integrations:call n8n.n8n_list_executions '{"cursor":"example_cursor","limit":1,"status":"example_status","workflow_id":"example_workflow_id"}' --json
Shortcut
kosmo integrations:n8n n8n_list_executions '{"cursor":"example_cursor","limit":1,"status":"example_status","workflow_id":"example_workflow_id"}' --json

n8n.n8n_get_execution

Get detailed information about a specific n8n workflow execution, including status, data, and node results.

Read read
Parameters
execution_id
Generic call
kosmo integrations:call n8n.n8n_get_execution '{"execution_id":"example_execution_id"}' --json
Shortcut
kosmo integrations:n8n n8n_get_execution '{"execution_id":"example_execution_id"}' --json

n8n.n8n_list_credentials

List n8n credentials. Supports pagination with cursor and limit parameters.

Read read
Parameters
cursor, limit
Generic call
kosmo integrations:call n8n.n8n_list_credentials '{"cursor":"example_cursor","limit":1}' --json
Shortcut
kosmo integrations:n8n n8n_list_credentials '{"cursor":"example_cursor","limit":1}' --json

n8n.n8n_get_current_user

Get the authenticated n8n user's profile information, including name, email, and role.

Read read
Parameters
none
Generic call
kosmo integrations:call n8n.n8n_get_current_user '{}' --json
Shortcut
kosmo integrations:n8n n8n_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

n8n.n8n_list_workflows 2 parameters
Schema command
kosmo integrations:schema n8n.n8n_list_workflows --json
ParameterTypeRequiredDescription
cursor string no Pagination cursor from a previous response.
limit integer no Maximum number of workflows to return. Default: 100.
n8n.n8n_get_workflow 1 parameters
Schema command
kosmo integrations:schema n8n.n8n_get_workflow --json
ParameterTypeRequiredDescription
workflow_id string yes The ID of the workflow to retrieve.
n8n.n8n_create_workflow 5 parameters
Schema command
kosmo integrations:schema n8n.n8n_create_workflow --json
ParameterTypeRequiredDescription
name string yes The name of the workflow.
nodes array no Array of node objects defining the workflow steps.
connections array no Connection mappings between nodes.
settings array no Workflow settings (e.g. executionOrder, saveManualExecutions, callerPolicy).
tags array no Array of tag objects with id and/or name to associate with the workflow.
n8n.n8n_list_executions 4 parameters
Schema command
kosmo integrations:schema n8n.n8n_list_executions --json
ParameterTypeRequiredDescription
cursor string no Pagination cursor from a previous response.
limit integer no Maximum number of executions to return. Default: 100.
status string no Filter by execution status: error, success, waiting.
workflow_id string no Filter executions by workflow ID.
n8n.n8n_get_execution 1 parameters
Schema command
kosmo integrations:schema n8n.n8n_get_execution --json
ParameterTypeRequiredDescription
execution_id string yes The ID of the execution to retrieve.
n8n.n8n_list_credentials 2 parameters
Schema command
kosmo integrations:schema n8n.n8n_list_credentials --json
ParameterTypeRequiredDescription
cursor string no Pagination cursor from a previous response.
limit integer no Maximum number of credentials to return. Default: 100.
n8n.n8n_get_current_user 0 parameters
Schema command
kosmo integrations:schema n8n.n8n_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.