-
Change to the automation directory. All commands below run from apps/automation/.
-
Ensure .env exists:
test -f apps/automation/.env || cp apps/automation/.env.example apps/automation/.env
If it was just created, tell the user and point them at apps/automation/.env.example.
-
Decide on MCP. If the user's request didn't specify, ask whether to include n8n-mcp. Default is no.
-
If starting with MCP, pre-check required env vars:
grep -E '^(N8N_API_KEY|MCP_AUTH_TOKEN)=.+' apps/automation/.env
Both must be non-empty. If either is missing, stop and explain:
MCP_AUTH_TOKEN — generate with openssl rand -hex 32.
N8N_API_KEY — chicken-and-egg: start n8n first (without --mcp), create the key in the UI at http://localhost:5678/settings/api, paste it into .env, then run n8n-start --mcp.
-
Start the stack:
pnpm --filter automation n8n:up
pnpm --filter automation n8n:up:mcp
-
Tail startup logs briefly to confirm health:
pnpm --filter automation n8n:logs --tail=20 &
Or run pnpm --filter automation n8n:ps to confirm the containers are running / healthy.
-
Report URLs to the user:
-
If the mcp profile was started, also remind the user that Claude Code must be registered against the MCP server to actually use it. Point them at the "Connecting Claude Code to the local n8n-mcp" section of apps/automation/README.md. The one-line summary:
- Project-scoped:
claude mcp add --scope project --transport http n8n-mcp http://localhost:3100/mcp --header "Authorization: Bearer \${MCP_AUTH_TOKEN}" (writes .mcp.json; export MCP_AUTH_TOKEN before launching claude).
- User-scoped: same command without
--scope project and with the literal token inlined.
Skip this reminder if the user has clearly registered it already (e.g. they're invoking an n8n-* tool and it's responding).