Claude Code integration for n8n

Hello everyone,

I’m opening this issue as it might be useful to many of you. I have just published a new n8n node to integrate Claude Code directly into your workflows.

:rocket: Key Features:

  1. Flexible Execution: Run Claude Code via Local, SSH, or Docker :spouting_whale:.
  2. Context Management: Maintain context between calls thanks to persistent sessions.
  3. Security First: Full control over Claude’s permissions (e.g., block rm, sudo, etc.).

:light_bulb: Use Cases:
:magnifying_glass_tilted_left: Automated Code Review: Webhook MR → Claude review → Post comment.
:books: Auto-Documentation: Push → Claude generates documentation → Commit.
:bug: Bug Fixing: Sentry Alert → Claude fix → Pull Request.
:robot: Custom Bots: Build AI-powered bots for Slack, Telegram, Discord, GitLab, and more.

:link: Get Started:
GitHub Repository: GitHub - ThomasTartrau/n8n-nodes-claude-code-cli

If you find this node useful, feel free to drop a :star: on the repo—it’s always appreciated! I’m also very much open to your feedback, suggestions, or any ideas you might have. :slight_smile:

Happy New Year 2026 to all! :partying_face::partying_face:

2 Likes

Followed your quick start instructions (claude-code-runner using docker), successfully authenticated with Claude login, Claude Code and n8n are running on the same Linux server. Which file or directory is it referring to that doesn’t exist?

Hello @Benwhut, do you have a “workspace” folder inside your claude-code-runner’s container ?
If not, you need to create one named workspace, liked your configuration or name it as you want.

Have a great day !

I can see a “workspace” folder inside my “claude-code-runner” folder and the docker-compose.yml file has this line:

- ./workspace:/workspace

Am I running into issues because I am using docker containers for both n8n and claude-code-runner? Is this the problem?

I noticed the claude-code-runner container doesn’t appear to have a port when following your quick start guide.

Screenshot 2026-01-07 at 10.04.45 AM

So I added this to the docker-compose.yml file:

ports: [“2375:2375”]

and the container then shows the port

but after restarting the claude-code-runner container, I still get the same original error message in n8n. Any other suggestions?

Hey! The issue is that this node doesn’t use HTTP communication between n8n and claude-code-runner. Instead, it uses docker exec to run commands inside the container.

How it works:

n8n → docker exec claude-code-runner claude -p "your prompt" → response

So you don’t need to expose any ports on claude-code-runner (remove the ports: ["2375:2375"]).

What you need instead:
If your n8n is running inside a Docker container, you need to mount the Docker socket so n8n can access the Docker daemon:

# In your n8n docker-compose.yml
services:
  n8n:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Also make sure both containers are managed by the same Docker daemon (same machine/docker host).

Quick checklist:

  1. Remove the ports config from claude-code-runner (not needed)

  2. Add Docker socket mount to your n8n container

  3. Verify: docker exec -it n8n docker ps should show claude-code-runner

  4. In n8n credentials, use container name: claude-code-runner

Thanks for providing this solution. I added your steps and tried to run

sudo docker exec -it n8n-n8n-1 docker ps

but then got an error that “OCI runtime exec failed error” saying “docker” executable file is not found. Running:
sudo docker exec -it n8n-n8n-1 /bin/sh

confirms that the “docker” command is missing from my n8n container. So I’ve hit another roadblock.

I’ve already spent too many hours trying to get this to work so I’ve kept it simple and am using SSH to run Claude Code through n8n, which does everything I need. Hopefully there will be a future Claude Code node that won’t be so troublesome to get working.

Appreciate you trying to help me though!

Hey @Benwhut !

I just pushed an update to fix this exact issue. You were on the right track - the problem is that the standard n8nio/n8nDocker image doesn’t include Docker CLI. Mounting the Docker socket gives access to the Docker daemon, but without the docker binary itself, n8n can’t execute docker exec commands.

The solution:

I’ve added a complete “n8n + claude-code-runner” stack that builds a custom n8n image with Docker CLI included. You can set it up with:

mkdir -p n8n-claude-code && cd n8n-claude-code && \
curl -fsSL https://raw.githubusercontent.com/ThomasTartrau/n8n-nodes-claude-code-cli/main/docker/production/n8n-with-claude-code/docker-compose.yml -o docker-compose.yml && \
curl -fsSL https://raw.githubusercontent.com/ThomasTartrau/n8n-nodes-claude-code-cli/main/docker/production/n8n-with-claude-code/Dockerfile.n8n -o Dockerfile.n8n && \
curl -fsSL https://raw.githubusercontent.com/ThomasTartrau/n8n-nodes-claude-code-cli/main/docker/production/n8n-with-claude-code/Dockerfile.claude-code -o Dockerfile.claude-code && \
docker compose up -d --build

This deploys both n8n (with Docker CLI) and claude-code-runner together.

If you prefer to keep your existing n8n setup, you just need to build a custom image. Create a Dockerfile:

FROM docker:29-cli AS docker-cli
FROM n8nio/n8n
USER root
COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
RUN chmod +x /usr/local/bin/docker
USER node

Then use build: . instead of the n8n image in your docker-compose, add user: root, and keep the socket mount.

Updated documentation: README - n8n in Docker section

Docker files: docker/production/n8n-with-claude-code

Sorry the original docs weren’t clear enough about this requirement. Let me know if you run into any other issues!

Thanks @ThomasTartrau. Your last instructions worked much better for me. I can run Claude Code using your node now!

One issue I’ve run into though is my n8n_data volume does not persist the data using your configuration. After running:

docker compose down
docker compose up -d

I lose all my workflows and it starts as a fresh n8n install.

After testing a bunch of things, the difference between my original n8n docker-compose.yml file and yours (besides the added Dockerfile.n8n and claude-code) is this line:

user: root  # Required for Docker socket access

I don’t specify a user in my original docker-compose file. Could this be causing problems with persisting the data? Otherwise, do you know what might be causing your version you suggested above to not persist the n8n data?

I can confirm that the reason my n8n_data volume isn’t persisting is because of the following line in docker-compose.yml:

user: root

When I comment this line out, the n8n_data volume persists when I take the container down and then up again, but of course the claude-code node stops working.

Any ideas on how I can get both the claude-code node and the n8n_data volume to persist at the same time?

Ok, I managed to get the n8n_data to persist by changing your docker-compose.yml file from this:

volumes:
  - n8n_data:/home/node/.n8n

to this:

volumes:
  - n8n_data:/root/.n8n

probably not the most secure workaround, but I guess it’s a compromise if the claude-code node needs root access to work.