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.

7 functions 6 read 1 write API key auth

n8n CLI Setup

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

# 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 use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_key N8N_API_KEY Secret secret yes API Key

Call n8n Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

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

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:n8n n8n_list_workflows '{
  "cursor": "example_cursor",
  "limit": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities 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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to n8n.

n8n.n8n_list_workflows

Read read

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

Parameters
cursor, limit

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

n8n.n8n_get_workflow

Read read

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

Parameters
workflow_id

Generic CLI call

kosmo integrations:call n8n.n8n_get_workflow '{"workflow_id":"example_workflow_id"}' --json

Provider shortcut

kosmo integrations:n8n n8n_get_workflow '{"workflow_id":"example_workflow_id"}' --json

n8n.n8n_create_workflow

Write write

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

Parameters
name, nodes, connections, settings, tags

Generic CLI call

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

Provider 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

Read read

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

Parameters
cursor, limit, status, workflow_id

Generic CLI call

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

Provider 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

Read read

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

Parameters
execution_id

Generic CLI call

kosmo integrations:call n8n.n8n_get_execution '{"execution_id":"example_execution_id"}' --json

Provider shortcut

kosmo integrations:n8n n8n_get_execution '{"execution_id":"example_execution_id"}' --json

n8n.n8n_list_credentials

Read read

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

Parameters
cursor, limit

Generic CLI call

kosmo integrations:call n8n.n8n_list_credentials '{"cursor":"example_cursor","limit":1}' --json

Provider shortcut

kosmo integrations:n8n n8n_list_credentials '{"cursor":"example_cursor","limit":1}' --json

n8n.n8n_get_current_user

Read read

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

Parameters
none

Generic CLI call

kosmo integrations:call n8n.n8n_get_current_user '{}' --json

Provider 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

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

Operation
Read read
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

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

Operation
Read read
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

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

Operation
Write write
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

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

Operation
Read read
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

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

Operation
Read read
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

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

Operation
Read read
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

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

Operation
Read read
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.