2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

n8nでClaude Codeを使ってみた!

Posted at

はじめに

n8nでClaude Codeを使用してメールの本文を作成してみました。
dockerを使用しています。

バージョン:

  • claude code: 1.0.111
  • n8n: 1.110.1
  • node: 24.8.0
  • npm: 11.6.0
  • docker: 27.3.1
  • Docker Compose: v2.30.3-desktop.1

プロジェクト構成

n8n
├── .docker
│   └── Dockerfile
└── compose.yml

Dockerファイルの作成

$ mkdir -p n8n/.docker
$ touch n8n/.docker/Dockerfile
$ touch n8n/compose.yml

compose.yml

services:
  n8n:
    container_name: n8n
    build:
      context: .docker
      dockerfile: Dockerfile
    restart: unless-stopped
    ports:
      - 5678:5678
    environment:
      - GENERIC_TIMEZONE=Asia/Tokyo
      - TZ=Asia/Tokyo
    volumes:
      - n8n_data:/home/node/.n8n
volumes:
  n8n_data:

Dockerfile

# ARGS
ARG NODE_VERSION=24.8.0
ARG N8N_VERSION=latest

# -----------------------------------------
# ベースイメージは、Node.jsの公式イメージを使用(Alpine版)
# https://hub.docker.com/_/node
# -----------------------------------------
FROM node:${NODE_VERSION}-alpine AS node

# -----------------------------------------
# ベースイメージは、n8nの公式イメージを使用
# https://hub.docker.com/r/n8nio/n8n
# -----------------------------------------
FROM n8nio/n8n:${N8N_VERSION}

# Switch to root user temporarily for installations
USER root

# Node.js Merge
COPY --from=node /usr/local/bin /usr/local/bin
COPY --from=node /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm

# ClaudeCode Install
RUN npm install -g @anthropic-ai/claude-code

# Switch back to node user
USER node

コンテナの起動

n8n $ docker compose up -d

Claude Code 認証

n8n $ docker compose exec n8n sh
# コンテナ内
~ $ claude
# > 認証フローに進む

ワークフローの作成

全体

20250911b-001.png

Execute Command

20250911b-002.png

Send Email

20250911b-003.png

ワークフローを実行する

通知されたメールの内容

20250911b-004.png

参考

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?