Back to Videos

N8N with Claude Code

YouTube

This video introduces a powerful integration between n8n, a workflow automation tool, and AI terminal agents like Claude Code. The creator, NetworkChuck, demonstrates how this combination unlocks advanced AI capabilities, transforming n8n from an automation platform into a sophisticated orchestrator for AI agents. The core concept revolves around using n8n's SSH node to remotely execute commands on a server where Claude Code is installed, enabling contextual, conversational AI interactions and the deployment of multiple AI agents for complex tasks. The video details the technical requirements, including setting up an n8n instance (preferably self-hosted on a Hostinger VPS) and an AI terminal tool like Claude Code or Gemini CLI on a Linux-based machine. It showcases practical applications such as running basic commands, leveraging local file context for AI responses, and deploying multiple AI agents via custom 'skills' to perform intricate network diagnostics. A key innovation demonstrated is the ability to maintain and resume conversational sessions with the AI, allowing for continuous, context-aware interaction. Furthermore, the video illustrates how n8n can act as an external interface, using Slack on a mobile device to communicate with Claude Code, extending the power of AI beyond the desktop. This architectural shift positions n8n as a high-level manager, directing complex AI operations while maintaining local control over data and processes. The creator emphasizes the simplicity of the SSH-based connection and the profound impact this integration has on automating IT tasks and enhancing productivity.

Introduction to n8n and AI Terminal Integration

  • The video highlights a significant change in how n8n is used by integrating it with AI terminal tools like Claude Code.
  • This combination allows n8n to execute Claude agents, workflows, and skills, greatly enhancing its automation capabilities.

Requirements for the Setup

  • n8n Instance: An active n8n instance is required. The creator strongly recommends self-hosting on a Hostinger VPS due to current sales and a quick 5-minute setup process.
  • AI Terminal Tool: Options include:
    • Claude Code: Recommended by the creator. Requires a Pro subscription.
    • Gemini CLI: Free with certain usage limits.
    • Codex: Mentioned as a potential but "janky" alternative.
  • Installation Location: AI terminal tools can be installed on any Linux-based machine, including macOS, Windows (via WSL), Raspberry Pi, or a Hostinger VPS. The creator prefers an Ubuntu server in his local server room for "easy access."

The Core Connection: SSH Node

  • The primary method for n8n to interact with the AI terminal tool is through its SSH node.
  • This node allows n8n to log into a remote server and execute shell commands.
  • Setting up SSH: Users need to create SSH credentials within n8n, providing the host IP address, port (default 22), username, and password/private key.

Demonstrations of Functionality

1. Basic Execution

  • A simple hostname command is executed via SSH to verify server connectivity.
  • The claude --version command is used to confirm Claude Code is installed and accessible.

2. Basic Execution with Headless Mode

  • The command claude -p "Why do pugs look so weird?" demonstrates Claude Code in "headless mode" (-p for print).
  • Claude provides a detailed textual response, showcasing its ability to answer queries without direct terminal interaction.

3. Leveraging Context and Local Files

  • The creator changes directory (cd) to a local project folder before running a Claude command.
  • Claude is asked: "Hey, is this video going to be any good?" The AI analyzes local files (scripts, notes) related to the video and provides a contextual review.
  • Key Insight: Giving n8n access to Claude Code effectively grants n8n access to a "super powerful context-filled agent" capable of understanding local files and project context.

4. Advanced Skills and Multi-Agent Deployment

  • A custom "Unifi skill" (a Python script) is used to interact with a Unifi network environment.
  • Claude is prompted: "Use your Unifi skill to do 3 things: First, rate the wifi. Second, rate the overall network performance. Third, rate security config. Deploy three agents, one for each task."
  • The demonstration uses a custom Claude Code Monitor dashboard (built with Twingate) to visualize Claude deploying and managing three agents simultaneously.
  • These agents execute Python scripts, perform network checks, and provide a comprehensive analysis of the Unifi setup, even identifying memory usage issues on network devices.
  • Architectural Shift: n8n acts as the orchestrator, simplifying complex tasks. The detailed logic and execution of AI agents and skills reside within Claude Code, which can be seen as the "actual IT department."

5. Conversational Sessions

  • The video introduces the concept of maintaining conversational sessions with AI agents using --session-id <UUID> and -r (resume) flags in Claude commands.
  • A JavaScript node in n8n is used to generate a unique session ID (UUID).
  • Subsequent SSH commands utilize this session ID and the -r flag to maintain context across multiple interactions, allowing for a flowing conversation with the AI.

6. External Interfaces (Slack Integration)

  • An n8n workflow is built to integrate Slack with Claude Code, enabling mobile interaction.
  • Users can tag the n8n bot in Slack and ask questions, receiving responses from Claude Code via n8n.
  • The workflow manages the session ID and a "done?" true/false dropdown in Slack to continue or end the conversation.
  • Demonstrations:
    • Comparing "nano vs. neovim" text editors.
    • Generating YouTube video ideas related to hacking and n8n.
    • Checking the health of a NAS (Network-Attached Storage) server and diagnosing Ceph storage issues. Claude identifies critical issues and suggests actions.

Conclusion: Overpowered Automation

  • The combination of n8n and AI terminal tools like Claude Code creates an "overpowered" automation system.
  • n8n acts as the orchestrator, managing workflows and external interfaces, while Claude Code provides the advanced AI capabilities, context management, and multi-agent deployment.
  • This approach allows for local control over files and processes, appealing to those who prefer on-premises solutions.
  • The creator encourages viewers to experiment with this setup and share their ideas.

Timestamps

00:00
Introduction: n8n + Claude CodeOverview of the new powerful integration between n8n and Claude Code for automation.
00:24
Requirements & SetupDetails on what is needed: n8n instance (Hostinger VPS recommended), AI terminal tool (Claude Code, Gemini CLI, Codex).
01:08
Hostinger VPS Quick SetupBrief demo of setting up an n8n instance on a Hostinger VPS quickly.
01:36
Where to Install AI Terminal ToolsDiscussion on deployment options for AI terminal tools like Claude Code (local server, VPS, etc.).
02:09
The Secret: SSH Node ConnectionReveals that the SSH node is the simple yet powerful method for n8n to interact with AI terminal tools.
02:50
SSH Node Setup & Basic ExecutionStep-by-step guide to configuring the SSH node in n8n and testing basic commands like 'hostname' and 'claude --version'.
04:35
Basic Execution: Headless ModeDemonstration of running Claude Code in headless mode to get direct answers to questions.
05:10
Context and Local FilesShows how Claude Code uses local file context to provide relevant answers, enhancing n8n's capabilities.
06:07
Skills and AgentsDemonstration of Claude Code deploying multiple AI agents and using custom 'Unifi skills' for complex network diagnostics, monitored via a custom dashboard.
07:55
Sessions: Conversational AIExplains how to maintain and resume conversational sessions with Claude Code using session IDs, allowing for multi-turn interactions.
09:50
External Interfaces: Slack IntegrationDemonstrates a full workflow integrating n8n with Slack to enable mobile, conversational interaction with Claude Code for various tasks like comparisons, idea generation, and system health checks.
12:50
Architecture Shift SummaryRecap of how n8n acts as the orchestrator for powerful, context-aware AI agents, shifting the paradigm of automation and IT management.
14:34
Outro & Call to ActionFinal thoughts, encouragement to try the setup, and mention of NetworkChuck Academy courses.

Target Audience

Software developers, IT professionals, automation enthusiasts, homelabbers, and anyone interested in integrating powerful AI capabilities into their workflows and personal IT infrastructure.

Use Cases

  • -Automated IT infrastructure monitoring and diagnostics with AI-driven insights.
  • -Developing conversational AI assistants that interact with local files and system commands.
  • -Streamlining content creation processes by leveraging AI for research, comparison, and idea generation based on local project context.
  • -Building mobile-accessible AI tools for on-the-go system management and querying via platforms like Slack.
  • -Orchestrating complex multi-agent AI tasks for enhanced efficiency in various domains like network management or data analysis.

Key Topics

AI workflow orchestrationIntegrating AI with automation toolsConversational AI sessionsAI-powered IT management