Overview
This node implements an AI programming assistant powered by Claude Code, designed to help users with a wide range of software development tasks. It can write clean, tested, and well-documented code, assist with debugging, perform code reviews, suggest project architecture improvements, and solve technical problems across all programming languages.
Common scenarios where this node is beneficial include:
- Generating new code snippets or functions based on user prompts.
- Debugging existing code by analyzing error messages or unexpected behavior.
- Reviewing code for best practices and suggesting improvements.
- Planning or restructuring project architecture.
- Providing explanations and documentation for complex code.
For example, a developer could input a request to generate a function that sorts data efficiently, ask for help debugging a failing unit test, or request a review of a newly written module to ensure it follows best practices.
Properties
| Name | Meaning |
|---|---|
| Authentication Method | How to authenticate with Claude Code: either using n8n credentials (an API key) or using an existing Claude Code CLI authentication. |
| Model | The Claude model to use for code assistance. Options are: "Claude 3.5 Sonnet" (latest recommended), "Claude 3.5 Haiku" (fast and efficient), and "Claude 3 Opus" (most capable). |
| Tool Description | A textual description of what the AI tool does, shown to the AI agent to guide its behavior. Defaults to an advanced AI programming assistant description. |
| Additional Options | A collection of optional settings: ⢠System Prompt: Custom system prompt to guide Claude Code's behavior. ⢠Enable Debug Output: Whether to enable detailed debug logging. ⢠Timeout (Seconds): Max wait time for response. ⢠Enable MCP Servers: Whether to enable Model Context Protocol servers for enhanced capabilities. |
Output
The node outputs an AI tool type object with a response field containing the AI-generated text result. This text is the answer or solution generated by Claude Code based on the user's programming prompt, operation type, and context.
The response JSON structure includes:
prompt: The original programming request or question.operation: The type of operation requested (query,continue, ordebug).context: Additional context about the project or previous conversation.- The actual AI-generated text response, which may include code snippets, explanations, debugging advice, or architectural suggestions.
No binary data output is produced by this node.
Dependencies
- Requires either:
- An API key credential for Claude Code API authentication, or
- Access to a locally running Claude Code CLI server at
http://127.0.0.1:3456/claude-code.
- Uses the official Anthropic SDK for API communication when using credentials.
- Network access to the Claude Code API or local CLI server must be configured.
- Optional environment setup for enabling Model Context Protocol (MCP) servers for enhanced capabilities.
Troubleshooting
Common issues:
- Failure to authenticate due to missing or invalid API key credentials.
- Local Claude Code CLI server not running or unreachable at the expected address.
- Timeout errors if the AI response takes longer than the configured timeout period.
- Unexpected empty or no response from the Claude Code service.
Error messages and resolutions:
"Credentials method failed": Indicates failure using API key authentication; check that the API key is correctly set up in n8n credentials."No response from Claude Code server": The local CLI server did not respond; verify that the CLI server is running and accessible.- General error fallback message suggests ensuring either the Claude Code CLI is properly installed and running or that API credentials are configured correctly.
- Enabling debug output can provide detailed logs to diagnose issues.
Links and References
- Anthropic Claude API Documentation
- Claude Code CLI Setup Guide
- Model Context Protocol (MCP) Specification (for advanced users enabling MCP servers)