Bring the power of Claude Code directly into your n8n automation workflows!
Imagine having an AI coding assistant that can analyze your codebase, fix bugs, write new features, manage databases, interact with APIs, and automate your entire development workflow - all within n8n. That's exactly what this node enables.
Create workflows that automatically review pull requests, suggest improvements, and even fix issues before merging.
Connect error monitoring tools to Claude Code - automatically diagnose and fix production issues in real-time.
Let Claude Code write complex SQL queries, optimize database schemas, and generate migration scripts based on your requirements.
Build n8n workflows that can modify and improve themselves using Claude Code's capabilities.
Automatically generate and update documentation for your entire codebase, APIs, or databases.
Automate the migration of legacy codebases to modern frameworks with intelligent refactoring.
Transform support tickets into code fixes automatically:
- Analyze customer bug reports and reproduce issues
- Generate fixes for reported problems
- Create test cases to prevent regression
- Update documentation based on common questions
- Auto-respond with workarounds while fixes are deployed
- Claude Code Runtime
This node uses @anthropic-ai/claude-agent-sdk, which bundles a Node-based Claude Code entrypoint. You do not need a global claude binary in $PATH for the node to run.
- Authentication
Create an Anthropic API credential in n8n and select it on the Claude Code node. The API key is injected only into the spawned Claude Code process environment for that execution. The node intentionally strips any Claude/Anthropic auth environment variables from the container environment to ensure auth comes only from n8n credentials.
This node implements multiple layers of security to prevent secret leakage:
-
System Prompt Policy: A mandatory security policy is always appended to the system prompt, instructing Claude to never output secrets or run dangerous commands.
-
Command Blocking: Dangerous Bash commands are blocked before execution, including:
- Environment variable dumps (
env,printenv,set,export) - Reading sensitive files (
.env,.netrc,credentials,/etc/shadow) - Output encoding pipes (
| base64,| xxd,| gzip, etc.) - Data exfiltration attempts via
curl/wgetwith env vars
- Environment variable dumps (
-
File Access Control: Reading sensitive files is blocked (
.env,.netrc,credentials,id_rsa,.pem,.key). -
Output Redaction: All output is scanned for secrets and redacted:
- Known API key patterns (OpenAI, GitHub, Slack, Google, AWS)
- JWT tokens and PEM private keys
- Large encoded blocks (base64, hex) that could contain exfiltrated data
If you configure the built-in GitLab API credential (gitlabApi) on the node, the token is injected only into the spawned Claude Code process for the duration of the execution:
- A temporary
HOMEdirectory is created - A temporary
~/.netrcis written sogit clone https://...can authenticate - The temp directory is removed after the node finishes
- Open your n8n instance
- Go to Settings β Community Nodes
- Click Install a community node
- Enter:
@sureliving/n8n-nodes-claudecode - Click Install
- Restart n8n when prompted
cd ~/.n8n/nodes
npm install @sureliving/n8n-nodes-claudecode
# Restart n8ndocker run -it --rm \
-p 5678:5678 \
-e N8N_COMMUNITY_NODE_PACKAGES=@sureliving/n8n-nodes-claudecode \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8nπ¦ NPM Package: @sureliving/n8n-nodes-claudecode
Webhook (GitHub Issue) β Claude Code β Create PR β Notify Slack
Automatically implement features or fix bugs when issues are created.
Form Trigger β Claude Code β Execute Query β Send Results
Natural language to SQL - let non-technical users query databases safely.
Git Push β Claude Code β Analyze Code β Block/Approve β Notify
Enforce coding standards and catch issues before they reach production.
HTTP Request β Claude Code β Generate Integration β Test β Deploy
Automatically create integrations with third-party APIs.
Error Logs β Claude Code β Diagnose β Create Fix β Open PR
Turn error logs into actionable fixes automatically.
Support Ticket β Claude Code β Reproduce Issue β Generate Fix β Test β Deploy β Auto-Reply
Transform customer complaints into deployed fixes in minutes, not days.
Set a project path and Claude Code understands your entire codebase context:
- Analyzes existing code patterns
- Follows your coding standards
- Understands your architecture
- Respects your dependencies
Claude Code comes equipped with powerful built-in tools:
- π File Operations:
Read,Write,Edit,MultiEdit,LS,Glob - π» Bash Commands: Execute shell commands (with security restrictions)
- π Smart Search:
Grepfor pattern matching across your codebase - π Notebooks:
NotebookRead,NotebookEditfor Jupyter notebooks - π Web Access:
WebFetch,WebSearchfor documentation and resources - π€ Agents:
Taskfor launching sub-agents,TodoWritefor task management - π Database Access: Via MCP servers
- π API Integration: GitHub, Slack, and more via MCP
Fine-tune Claude Code's behavior with these powerful options:
- π« Disallowed Tools: Explicitly block specific tools for security
- π Fallback Model: Automatically switch models when primary is overloaded
- π§ Max Thinking Tokens: Control Claude's internal reasoning depth
- π Permission Modes: Choose from
default,acceptEdits,bypassPermissions, orplan
Extend Claude Code with specialized capabilities:
- PostgreSQL/MySQL database access
- GitHub repository management
- Slack workspace integration
- Custom tool development
{
"operation": "query",
"prompt": "Analyze this codebase and suggest performance improvements",
"projectPath": "/path/to/your/project",
"model": "sonnet"
}{
"operation": "query",
"prompt": "Create an optimized query to find users who haven't logged in for 30 days",
"projectPath": "/path/to/project",
"model": "opus"
}{
"operation": "query",
"prompt": "Customer reports: 'Login button not working on mobile devices'\n\nAnalyze this issue, find the root cause, and create a fix",
"projectPath": "/path/to/web-app",
"model": "opus",
"allowedTools": ["Read", "Write", "Edit", "Bash", "Grep"],
"additionalOptions": {
"systemPrompt": "Focus on mobile compatibility issues. Check responsive CSS and JavaScript event handlers."
}
}{
"operation": "query",
"prompt": "Refactor this legacy code to use modern patterns",
"projectPath": "/path/to/legacy-app",
"model": "opus",
"allowedTools": ["Read", "Write", "Edit", "MultiEdit", "Grep"],
"disallowedTools": ["Bash"], // Prevent command execution for safety
"additionalOptions": {
"permissionMode": "plan", // Claude will plan before executing
"fallbackModel": "sonnet", // Auto-switch if Opus is overloaded
"maxThinkingTokens": 50000, // Allow deep reasoning for complex refactoring
"systemPrompt": "Preserve all existing functionality while modernizing the code"
}
}With MCP configuration (.mcp.json):
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "${DATABASE_URL}"]
}
}
}Schedule Trigger (Daily)
β
Claude Code (Analyze codebase for improvements)
β
Create GitHub Issues
β
Assign to Team
Slack Command
β
Claude Code (Generate code from description)
β
Create Pull Request
β
Run Tests
β
Notify Results
Error Webhook
β
Claude Code (Diagnose issue)
β
If (Can fix automatically)
ββ Yes: Create Fix PR
ββ No: Create Detailed Issue
- In n8n, go to Settings β Credentials
- Create a new Anthropic API credential
- Enter your Anthropic API key
- In n8n, create a new workflow
- Add a Manual Trigger node (for testing)
- Add the Claude Code (Credentials) node
- Configure:
- Operation: Query
- Prompt: "Analyze the code in this directory and suggest improvements"
- Project Path:
/path/to/your/project - Model: Sonnet (faster) or Opus (more powerful)
- Click Execute Workflow
- Watch Claude Code analyze your project!
- Check out the workflow templates for ready-to-use examples
- See the examples directory for configuration options
- Read about MCP servers for database and API access
Always set a project path for better context and results:
/home/user/projects/my-app
Use the Allowed Tools and Disallowed Tools parameters in the node to control what Claude Code can do. For example, to prevent command execution, add Bash to Disallowed Tools.
You can also create a .claude/settings.json file in your project directory for additional permission rules:
{
"permissions": {
"allow": ["Read(*)", "Write(*)"],
"deny": ["Bash(rm -rf *)"]
}
}Use "Continue" operation to build complex multi-step workflows while maintaining context.
- Structured: Full details with metrics
- Messages: For debugging
- Text: Simple results for chaining
- π Documentation
- π Report Issues
- π¬ Discussions
- π Star on GitHub
We're constantly improving! Upcoming features:
- Visual workflow builder for Claude Code operations
- Pre-built workflow templates
- Enhanced debugging tools
- More MCP server integrations
This project uses Conventional Commits and automated semantic versioning:
feat:New features (minor version bump)fix:Bug fixes (patch version bump)docs:Documentation changeschore:Maintenance taskstest:Adding or updating tests
Use npm run commit for an interactive commit message builder.
Releases are fully automated using semantic-release:
- Push commits to
mainbranch - CI analyzes commit messages
- Version is automatically bumped based on commit types
- Package is published to npm
- GitHub release is created with changelog
No manual version management required!
MIT - Build amazing things!
Ready to revolutionize your development workflow? Install Claude Code for n8n today and join the future of automated software development!
Originally created by Adam Holt - Original Repository
Maintained by sureliving