Package Exports
- n8n-nodes-claude-code-cli
- n8n-nodes-claude-code-cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (n8n-nodes-claude-code-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
_____ _ _ _____ _
/ ____| | | | / ____| | |
| | | | __ _ _ _ __| | ___ | | ___ __| | ___
| | | |/ _` | | | |/ _` |/ _ \ | | / _ \ / _` |/ _ \
| |____| | (_| | |_| | (_| | __/ | |___| (_) | (_| | __/
\_____|_|\__,_|\__,_|\__,_|\___| \_____\___/ \__,_|\___|
⚡ for n8n ⚡n8n-nodes-claude-code-cli
🤖 Bring the power of Claude Code AI directly into your n8n workflows
Automate code reviews • Generate documentation • Fix bugs • Build coding bots
✨ Features
🐳 Multiple Connection ModesExecute Claude Code locally, via SSH, or inside Docker containers 🔄 Session ManagementMaintain multi-turn conversations across workflow executions 🎯 Tool PermissionsFine-grained control over which tools Claude Code can use |
📁 Context File SupportInclude files and directories as context for code analysis 🧠 Multiple ModelsSupport for Opus, Sonnet, Haiku and specific versions 📊 Rich OutputDetailed metadata including costs, tokens, and session IDs |
⚡ Quick Start
1️⃣ Install → 2️⃣ Setup Claude Code → 3️⃣ Authenticate → 4️⃣ Create Workflow → 5️⃣ Run!📋 Step-by-step guide
1️⃣ Install the node
Install the node in n8n community nodes
Search for "n8n-nodes-claude-code-cli" in the n8n community nodes interface. Then install the node.
Install the node locally with git:
I recommend using git to install the node locally. If there is a supply chain attack, you will not be affected by the automatic updates of the community nodes of n8n. And therefore your service will not be corrupted. Supply chain attacks are very dangerous, more and more frequent and can compromise your service. It is therefore recommended to use git to install the node locally.
git clone https://github.com/n8n-io/n8n-nodes-claude-code-cli.git
cd n8n-nodes-claude-code-cli
npm install
npm run buildInstall locally with npm:
npm install n8n-nodes-claude-code-cliFor local installation you need to add the environment variable - N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom in your n8n configuration file.
2️⃣ Set up Claude Code
Choose your deployment method (see Installation)
3️⃣ Authenticate with Claude
# For Docker
docker exec -it your-container-name claude login
# For SSH or Local
claude login4️⃣ Create credentials in n8n
Go to Settings → Credentials → Add Credential and select your connection type
5️⃣ Add the node and run!
Search for "Claude Code" in the node panel, configure, and execute
🐳 Docker (Recommended)
Why Docker? Isolation, easy setup, portability, and security.
Option 1: Node.js Container (Lightweight)
Best for code analysis without system tools:
FROM node:24-slim
# Install Claude Code CLI
RUN npm install -g @anthropic-ai/claude-code
# Set up workspace
WORKDIR /workspace
# Keep container running
CMD ["tail", "-f", "/dev/null"]# docker-compose.yml
services:
claude-code-runner:
build: .
volumes:
- ./workspace:/workspaceOption 2: Debian Container (Full Tooling)
Best when Claude Code needs system tools (git, build tools, etc.):
FROM debian:bookworm-slim
# Install Node.js and common tools
RUN apt-get update && apt-get install -y \
curl git build-essential \
&& curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Claude Code CLI
RUN npm install -g @anthropic-ai/claude-code
WORKDIR /workspace
CMD ["tail", "-f", "/dev/null"]🔑 Authenticate:
docker exec -it claude-code-runner claude login⚙️ n8n Credentials:
| Parameter | Value |
|---|---|
| Container Name | claude-code-runner |
| Working Directory | /workspace |
🔐 SSH (Alternative)
Why SSH? Full system access and dedicated resource isolation.
Setup Instructions
Set up a VM (AWS EC2, GCP, DigitalOcean, etc.)
Install Claude Code:
# Install Node.js curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt-get install -y nodejs # Install Claude Code npm install -g @anthropic-ai/claude-code # Authenticate claude login
Configure SSH with key-based authentication
⚙️ n8n Credentials:
| Parameter | Value |
|---|---|
| Host | Your VM IP/hostname |
| Port | 22 |
| Auth Method | privateKey |
💻 Local (Not Recommended)
⚠️ Security concerns - Claude Code runs in the same context as n8n
Why not recommended?
- Security risks (shared execution context)
- Resource contention
- Harder to manage and update
If you must use local:
- Install Claude Code inside your n8n container
- Run
claude login - Use "Local" connection mode
🔑 Authentication
Recommended: Claude Login (Subscription)
💰 Cheaper! Claude Code subscription costs less than API usage.
# Docker
docker exec -it container_name claude login
# SSH (on remote server)
claude login
# Local
claude loginFollow the browser prompts to authenticate.
Alternative: API Key
Using ANTHROPIC_API_KEY (not recommended)
⚠️ More expensive than subscription pricing
Set via environment variable:
export ANTHROPIC_API_KEY="your-api-key"Or in Docker Compose:
environment:
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}⚙️ Node Operations
| Operation | Description | Use Case |
|---|---|---|
| Execute Prompt | Send a prompt and get a response | Direct AI interaction |
| Execute with Context | Include files as context | Code review, analysis |
| Continue Session | Continue last conversation | Multi-turn interactions |
| Resume Session | Resume specific session by ID | Continue after interruption |
📝 Detailed Parameters
Execute Prompt
- Prompt (required): Instruction for Claude Code
- Model: Claude model to use
- Options: Working directory, timeout, system prompt
Execute with Context
- Prompt (required): Instruction for Claude Code
- Context Files: File paths to include
- Additional Directories: Directory paths
Continue / Resume Session
- Prompt (required): Follow-up message
- Session ID (resume only): Previous session ID
💡 Use Cases
🔍 MR/PR Code Review Agent
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ GitLab │────▶│ Get Diff & │────▶│ Claude Code │────▶│ Post │
│ Webhook │ │ Files │ │ Review │ │ Comments │
└─────────────┘ └──────────────┘ └─────────────┘ └──────────────┘Workflow Steps
- Trigger: GitLab/GitHub webhook on new MR/PR
- Fetch: Get changed files and diff via API
- Review: Claude Code with
executeWithContext- "Review this code. Check for bugs, security issues, suggest improvements."
- Post: Send review comments back to GitLab/GitHub
- Notify: Alert team via Slack/Discord (optional)
🎧 Support Assistant
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ Support │────▶│ Analyze │────▶│ Claude Code │────▶│ Respond │
│ Ticket │ │ Issue │ │ Solution │ │ or Route │
└─────────────┘ └──────────────┘ └─────────────┘ └──────────────┘Workflow Steps
- Trigger: Webhook from support system (Zendesk, Intercom)
- Analyze: Claude Code understands the issue
- "User reports: [issue]. Analyze and suggest solution."
- Respond: Send AI response back via API
- Escalate: Route complex issues to humans
📚 Auto Documentation
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ Code │────▶│ Get Changed │────▶│ Claude Code │────▶│ Commit │
│ Push │ │ Files │ │ Gen Docs │ │ Docs │
└─────────────┘ └──────────────┘ └─────────────┘ └──────────────┘Workflow Steps
- Trigger: Webhook on code push to main
- Identify: Get list of changed files
- Generate: Claude Code generates documentation
- "Generate docs for this code. Include descriptions, params, examples."
- Commit: Create commit with updated docs
- PR: Optionally create a PR for review
🐛 Auto Bug Fixing
┌─────────────┐ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ Sentry │────▶│ Parse │────▶│ Claude Code │────▶│ Create PR │
│ Alert │ │ Stack Trace │ │ Fix Bug │ │ + Notify │
└─────────────┘ └──────────────┘ └─────────────┘ └──────────────┘Workflow Steps
- Trigger: Webhook from error monitoring (Sentry, Datadog)
- Analyze: Parse error stack trace
- Fix: Claude Code analyzes and fixes
- "Error: [stack trace]. Analyze code and provide a fix."
- Test: Run tests to validate
- PR: Create pull request with fix
- Notify: Alert team about automated fix
🤖 Cloud Coding Bots
Build AI coding assistants on any platform:
|
📱 Telegram |
💬 Slack |
🎮 Discord |
🦊 GitLab/GitHub |
Example: Telegram Bot
- Trigger: Telegram trigger on new message
- Process: Claude Code handles coding question
- Reply: Send response via Telegram node
Example: Slack Bot
- Trigger: Slack mention or slash command
- Context: Fetch relevant code from repos (optional)
- Respond: Post response to channel
Example: GitLab/GitHub Bot
- Trigger: Issue comment with keyword (e.g.,
/claude) - Analyze: Fetch issue context and code
- Comment: Post Claude's analysis
📤 Output Structure
{
"success": true,
"sessionId": "550e8400-e29b-41d4-a716-446655440000",
"output": "Here's my analysis of the code...",
"exitCode": 0,
"duration": 15234,
"cost": 0.0523,
"numTurns": 3,
"usage": {
"inputTokens": 1250,
"outputTokens": 890
}
}| Field | Description |
|---|---|
success |
✅ Execution completed successfully |
sessionId |
🔗 ID for continuing conversations |
output |
📝 Response text from Claude Code |
cost |
💰 Estimated cost in USD |
usage |
📊 Token breakdown |
🔒 Security
🛡️ Tool PermissionsControl what Claude Code can do: |
🐳 Isolation
|
🔐 Recommended Security Settings
Disallow dangerous operations:
Bash(rm:*)- Prevent file deletionBash(sudo:*)- No sudo accessWrite(.env)- Protect secretsBash(curl:*)- Block network (if not needed)
Isolation best practices:
- Always set specific working directory
- Avoid
/or home directories - Create dedicated workspace per project
🤝 Contributing
Contributions welcome!
# 1. Fork the repo
# 2. Create feature branch
git checkout -b feature/amazing-feature
# 3. Commit changes
git commit -m 'feat: add amazing feature'
# 4. Push & create PR
git push origin feature/amazing-feature📄 License
MIT License - see LICENSE for details.