From 3ecaf8632f5272ce06e17ff237e17485b9bf4e73 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Mon, 14 Jul 2025 13:37:07 +0200 Subject: [PATCH 01/40] Rename Dockerfile to __Dockerfile --- Dockerfile => __Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Dockerfile => __Dockerfile (98%) diff --git a/Dockerfile b/__Dockerfile similarity index 98% rename from Dockerfile rename to __Dockerfile index 3f3e28d..ced41c8 100644 --- a/Dockerfile +++ b/__Dockerfile @@ -75,4 +75,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ # Optimized entrypoint ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -CMD ["node", "dist/mcp/index.js"] \ No newline at end of file +CMD ["node", "dist/mcp/index.js"] From 8ff0ae964de5898022e9e7716571c8dc5b13391b Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:27:57 +0200 Subject: [PATCH 02/40] Update and rename __Dockerfile to Dockerfile --- __Dockerfile => Dockerfile | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) rename __Dockerfile => Dockerfile (59%) diff --git a/__Dockerfile b/Dockerfile similarity index 59% rename from __Dockerfile rename to Dockerfile index ced41c8..3a4aa46 100644 --- a/__Dockerfile +++ b/Dockerfile @@ -1,78 +1,67 @@ # syntax=docker/dockerfile:1.7 -# Ultra-optimized Dockerfile - minimal runtime dependencies (no n8n packages) +# Ultra-optimized Dockerfile for Railway - production, minimal dependencies -# Stage 1: Builder (TypeScript compilation only) +# Stage 1: Builder FROM node:20-alpine AS builder WORKDIR /app -# Copy tsconfig for TypeScript compilation COPY tsconfig.json ./ -# Create minimal package.json and install ONLY build dependencies RUN --mount=type=cache,target=/root/.npm \ echo '{}' > package.json && \ npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 -# Copy source and build COPY src ./src -# Note: src/n8n contains TypeScript types needed for compilation -# These will be compiled but not included in runtime RUN npx tsc -# Stage 2: Runtime (minimal dependencies) +# Stage 2: Runtime FROM node:20-alpine AS runtime WORKDIR /app -# Install only essential runtime tools RUN apk add --no-cache curl && \ rm -rf /var/cache/apk/* -# Copy runtime-only package.json COPY package.runtime.json package.json -# Install runtime dependencies with cache mount RUN --mount=type=cache,target=/root/.npm \ npm install --production --no-audit --no-fund -# Copy built application COPY --from=builder /app/dist ./dist -# Copy pre-built database and required files -# Cache bust: 2025-07-06-trigger-fix-v3 - includes is_trigger=true for webhook,cron,interval,emailReadImap COPY data/nodes.db ./data/ COPY src/database/schema-optimized.sql ./src/database/ COPY .env.example ./ -# Copy entrypoint script COPY docker/docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh -# Add container labels LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.title="n8n-mcp" -# Create non-root user RUN addgroup -g 1001 -S nodejs && \ adduser -S nodejs -u 1001 && \ chown -R nodejs:nodejs /app -# Switch to non-root user USER nodejs -# Set Docker environment flag ENV IS_DOCKER=true -# Expose HTTP port +# --- KEY Railway detail: EXPOSE 3000, but server MUST respect $PORT env var! EXPOSE 3000 -# Health check +# Healthcheck (still port 3000 as default, but Railway sets $PORT!) HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD curl -f http://127.0.0.1:3000/health || exit 1 + CMD curl -f http://127.0.0.1:${PORT:-3000}/health || exit 1 -# Optimized entrypoint ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -CMD ["node", "dist/mcp/index.js"] +# --- CMD: always run HTTP server (Railway expects an HTTP app) +CMD ["node", "dist/mcp/index.js", "--http"] + +# Optionally, if your app doesn't already do this, make sure that dist/mcp/index.js +# uses process.env.PORT for the HTTP server: +# const port = process.env.PORT || 3000; +# app.listen(port, ...) From b21642c58943f4bb654b4a369bdf311746055c36 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:29:27 +0200 Subject: [PATCH 03/40] Update Dockerfile --- Dockerfile | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3a4aa46..da7d2ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ # syntax=docker/dockerfile:1.7 -# Ultra-optimized Dockerfile for Railway - production, minimal dependencies +# Ultra-optimized Dockerfile for Railway deployment of n8n-mcp -# Stage 1: Builder +# --- Stage 1: Builder --- FROM node:20-alpine AS builder WORKDIR /app +# Install build dependencies only (no n8n runtime packages) COPY tsconfig.json ./ - RUN --mount=type=cache,target=/root/.npm \ echo '{}' > package.json && \ npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ @@ -16,52 +16,49 @@ RUN --mount=type=cache,target=/root/.npm \ COPY src ./src RUN npx tsc -# Stage 2: Runtime +# --- Stage 2: Runtime --- FROM node:20-alpine AS runtime WORKDIR /app -RUN apk add --no-cache curl && \ - rm -rf /var/cache/apk/* +RUN apk add --no-cache curl && rm -rf /var/cache/apk/* +# Use only runtime deps COPY package.runtime.json package.json - RUN --mount=type=cache,target=/root/.npm \ npm install --production --no-audit --no-fund +# Copy built app and essential files COPY --from=builder /app/dist ./dist - COPY data/nodes.db ./data/ COPY src/database/schema-optimized.sql ./src/database/ COPY .env.example ./ +# Entrypoint script for any setup (optional, if needed) COPY docker/docker-entrypoint.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/docker-entrypoint.sh +# Container labels LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.title="n8n-mcp" +# Run as non-root user for security RUN addgroup -g 1001 -S nodejs && \ adduser -S nodejs -u 1001 && \ chown -R nodejs:nodejs /app - USER nodejs ENV IS_DOCKER=true -# --- KEY Railway detail: EXPOSE 3000, but server MUST respect $PORT env var! +# Railway exposes $PORT, but default to 3000 if not set EXPOSE 3000 -# Healthcheck (still port 3000 as default, but Railway sets $PORT!) +# Healthcheck respects dynamic port HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:${PORT:-3000}/health || exit 1 ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -# --- CMD: always run HTTP server (Railway expects an HTTP app) -CMD ["node", "dist/mcp/index.js", "--http"] -# Optionally, if your app doesn't already do this, make sure that dist/mcp/index.js -# uses process.env.PORT for the HTTP server: -# const port = process.env.PORT || 3000; -# app.listen(port, ...) +# Main CMD: always run HTTP mode (so Claude etc can reach it, and Railway works) +CMD ["node", "dist/mcp/index.js", "--http"] From a9816954621774daf493460949fab1ad67a9b843 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:32:11 +0200 Subject: [PATCH 04/40] Update Dockerfile --- Dockerfile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index da7d2ff..e34264e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,10 +33,6 @@ COPY data/nodes.db ./data/ COPY src/database/schema-optimized.sql ./src/database/ COPY .env.example ./ -# Entrypoint script for any setup (optional, if needed) -COPY docker/docker-entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/docker-entrypoint.sh - # Container labels LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" @@ -58,7 +54,5 @@ EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:${PORT:-3000}/health || exit 1 -ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] - # Main CMD: always run HTTP mode (so Claude etc can reach it, and Railway works) CMD ["node", "dist/mcp/index.js", "--http"] From f2c77f14b5f0af55107fbf278980ce73dbdbee18 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:38:58 +0200 Subject: [PATCH 05/40] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e34264e..260515b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app # Install build dependencies only (no n8n runtime packages) COPY tsconfig.json ./ -RUN --mount=type=cache,target=/root/.npm \ +RUN --mount=type=cache,id=npm-cache,target=/root/.npm \ echo '{}' > package.json && \ npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ @@ -24,7 +24,7 @@ RUN apk add --no-cache curl && rm -rf /var/cache/apk/* # Use only runtime deps COPY package.runtime.json package.json -RUN --mount=type=cache,target=/root/.npm \ +RUN --mount=type=cache,id=npm-cache,target=/root/.npm \ npm install --production --no-audit --no-fund # Copy built app and essential files From c0a7b85b39ac8ce6b9f7125b04c2f4edaca00d1c Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:39:53 +0200 Subject: [PATCH 06/40] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 260515b..0096770 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app # Install build dependencies only (no n8n runtime packages) COPY tsconfig.json ./ -RUN --mount=type=cache,id=npm-cache,target=/root/.npm \ +RUN --mount=type=cache,id=builder-npm-cache,target=/root/.npm \ echo '{}' > package.json && \ npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ @@ -24,7 +24,7 @@ RUN apk add --no-cache curl && rm -rf /var/cache/apk/* # Use only runtime deps COPY package.runtime.json package.json -RUN --mount=type=cache,id=npm-cache,target=/root/.npm \ +RUN --mount=type=cache,id=runtime-npm-cache,target=/root/.npm \ npm install --production --no-audit --no-fund # Copy built app and essential files From caf0c4d675ac142beffba5c49e3155daddf671bd Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:49:29 +0200 Subject: [PATCH 07/40] Update Dockerfile --- Dockerfile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0096770..a7fdfbd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,8 @@ FROM node:20-alpine AS builder WORKDIR /app -# Install build dependencies only (no n8n runtime packages) COPY tsconfig.json ./ -RUN --mount=type=cache,id=builder-npm-cache,target=/root/.npm \ +RUN --mount=type=cache,target=/root/.npm,id=npm-cache-builder \ echo '{}' > package.json && \ npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ @@ -22,24 +21,20 @@ WORKDIR /app RUN apk add --no-cache curl && rm -rf /var/cache/apk/* -# Use only runtime deps COPY package.runtime.json package.json -RUN --mount=type=cache,id=runtime-npm-cache,target=/root/.npm \ +RUN --mount=type=cache,target=/root/.npm,id=npm-cache-runtime \ npm install --production --no-audit --no-fund -# Copy built app and essential files COPY --from=builder /app/dist ./dist COPY data/nodes.db ./data/ COPY src/database/schema-optimized.sql ./src/database/ COPY .env.example ./ -# Container labels LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.title="n8n-mcp" -# Run as non-root user for security RUN addgroup -g 1001 -S nodejs && \ adduser -S nodejs -u 1001 && \ chown -R nodejs:nodejs /app @@ -47,12 +42,9 @@ USER nodejs ENV IS_DOCKER=true -# Railway exposes $PORT, but default to 3000 if not set EXPOSE 3000 -# Healthcheck respects dynamic port HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:${PORT:-3000}/health || exit 1 -# Main CMD: always run HTTP mode (so Claude etc can reach it, and Railway works) CMD ["node", "dist/mcp/index.js", "--http"] From e6d0a2f83c39881e118877efe25427005770de7d Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:53:26 +0200 Subject: [PATCH 08/40] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a7fdfbd..6690336 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ FROM node:20-alpine AS builder WORKDIR /app COPY tsconfig.json ./ -RUN --mount=type=cache,target=/root/.npm,id=npm-cache-builder \ +RUN --mount=type=cache,id=npm-cache-builder \ echo '{}' > package.json && \ npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ @@ -22,7 +22,7 @@ WORKDIR /app RUN apk add --no-cache curl && rm -rf /var/cache/apk/* COPY package.runtime.json package.json -RUN --mount=type=cache,target=/root/.npm,id=npm-cache-runtime \ +RUN --mount=type=cache,id=npm-cache-runtime \ npm install --production --no-audit --no-fund COPY --from=builder /app/dist ./dist From cd7765664c39356a0bb6508574175fb57b498aba Mon Sep 17 00:00:00 2001 From: moonwalk Date: Tue, 15 Jul 2025 16:58:08 +0200 Subject: [PATCH 09/40] Update Dockerfile --- Dockerfile | 58 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6690336..c5313e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,78 @@ # syntax=docker/dockerfile:1.7 -# Ultra-optimized Dockerfile for Railway deployment of n8n-mcp +# Railway-compatible Dockerfile for n8n-mcp # --- Stage 1: Builder --- FROM node:20-alpine AS builder WORKDIR /app -COPY tsconfig.json ./ -RUN --mount=type=cache,id=npm-cache-builder \ - echo '{}' > package.json && \ - npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ - @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ - n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 +# Install system dependencies for native modules +RUN apk add --no-cache python3 make g++ && \ + rm -rf /var/cache/apk/* +# Copy package files +COPY package*.json tsconfig.json ./ + +# Install all dependencies (including devDependencies for build) +RUN npm ci --no-audit --no-fund + +# Copy source code COPY src ./src -RUN npx tsc + +# Build the application +RUN npm run build # --- Stage 2: Runtime --- FROM node:20-alpine AS runtime WORKDIR /app -RUN apk add --no-cache curl && rm -rf /var/cache/apk/* +# Install system dependencies +RUN apk add --no-cache curl python3 make g++ && \ + rm -rf /var/cache/apk/* -COPY package.runtime.json package.json -RUN --mount=type=cache,id=npm-cache-runtime \ - npm install --production --no-audit --no-fund +# Copy package files +COPY package*.json ./ +# Install only production dependencies +RUN npm ci --only=production --no-audit --no-fund && \ + npm cache clean --force + +# Copy built application from builder stage COPY --from=builder /app/dist ./dist -COPY data/nodes.db ./data/ -COPY src/database/schema-optimized.sql ./src/database/ + +# Copy necessary data and configuration files +COPY data/ ./data/ +COPY src/database/schema-optimized.sql ./src/database/schema-optimized.sql COPY .env.example ./ +# Create data directory if it doesn't exist and set permissions +RUN mkdir -p ./data && \ + chmod 755 ./data + +# Add metadata labels LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" -LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" +LABEL org.opencontainers.image.description="n8n MCP Server - Integration between n8n workflow automation and Model Context Protocol" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.title="n8n-mcp" +LABEL org.opencontainers.image.version="2.7.13" +# Create non-root user for security RUN addgroup -g 1001 -S nodejs && \ adduser -S nodejs -u 1001 && \ chown -R nodejs:nodejs /app USER nodejs +# Set environment variables +ENV NODE_ENV=production ENV IS_DOCKER=true +ENV MCP_MODE=http +ENV USE_FIXED_HTTP=true +# Expose port (Railway will set PORT automatically) EXPOSE 3000 +# Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:${PORT:-3000}/health || exit 1 +# Start the application in HTTP mode CMD ["node", "dist/mcp/index.js", "--http"] From 0738f4bb94399a469cc8b2dbe100f9832f0e2e77 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 09:03:47 +0200 Subject: [PATCH 10/40] Rename Dockerfile to Dockerfile.railway --- Dockerfile => Dockerfile.railway | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile => Dockerfile.railway (100%) diff --git a/Dockerfile b/Dockerfile.railway similarity index 100% rename from Dockerfile rename to Dockerfile.railway From 399636fd613b9820777796fc8c1703d7f4022f33 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 09:04:40 +0200 Subject: [PATCH 11/40] Create Docherfile --- Docherfile | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Docherfile diff --git a/Docherfile b/Docherfile new file mode 100644 index 0000000..ced41c8 --- /dev/null +++ b/Docherfile @@ -0,0 +1,78 @@ +# syntax=docker/dockerfile:1.7 +# Ultra-optimized Dockerfile - minimal runtime dependencies (no n8n packages) + +# Stage 1: Builder (TypeScript compilation only) +FROM node:20-alpine AS builder +WORKDIR /app + +# Copy tsconfig for TypeScript compilation +COPY tsconfig.json ./ + +# Create minimal package.json and install ONLY build dependencies +RUN --mount=type=cache,target=/root/.npm \ + echo '{}' > package.json && \ + npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ + @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ + n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 + +# Copy source and build +COPY src ./src +# Note: src/n8n contains TypeScript types needed for compilation +# These will be compiled but not included in runtime +RUN npx tsc + +# Stage 2: Runtime (minimal dependencies) +FROM node:20-alpine AS runtime +WORKDIR /app + +# Install only essential runtime tools +RUN apk add --no-cache curl && \ + rm -rf /var/cache/apk/* + +# Copy runtime-only package.json +COPY package.runtime.json package.json + +# Install runtime dependencies with cache mount +RUN --mount=type=cache,target=/root/.npm \ + npm install --production --no-audit --no-fund + +# Copy built application +COPY --from=builder /app/dist ./dist + +# Copy pre-built database and required files +# Cache bust: 2025-07-06-trigger-fix-v3 - includes is_trigger=true for webhook,cron,interval,emailReadImap +COPY data/nodes.db ./data/ +COPY src/database/schema-optimized.sql ./src/database/ +COPY .env.example ./ + +# Copy entrypoint script +COPY docker/docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh + +# Add container labels +LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" +LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" +LABEL org.opencontainers.image.licenses="MIT" +LABEL org.opencontainers.image.title="n8n-mcp" + +# Create non-root user +RUN addgroup -g 1001 -S nodejs && \ + adduser -S nodejs -u 1001 && \ + chown -R nodejs:nodejs /app + +# Switch to non-root user +USER nodejs + +# Set Docker environment flag +ENV IS_DOCKER=true + +# Expose HTTP port +EXPOSE 3000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD curl -f http://127.0.0.1:3000/health || exit 1 + +# Optimized entrypoint +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] +CMD ["node", "dist/mcp/index.js"] From 011db5ce7fcdc3d36988d5ce07ee6c658998580d Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 09:13:58 +0200 Subject: [PATCH 12/40] Rename Docherfile to Dockerfile --- Docherfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Docherfile => Dockerfile (100%) diff --git a/Docherfile b/Dockerfile similarity index 100% rename from Docherfile rename to Dockerfile From e01ff0faa154eab456e5149ed40d0b4bf611524b Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 09:16:49 +0200 Subject: [PATCH 13/40] Create railway.json --- railway.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 railway.json diff --git a/railway.json b/railway.json new file mode 100644 index 0000000..e9ec6bd --- /dev/null +++ b/railway.json @@ -0,0 +1,10 @@ +{ + "name": "n8n-mcp", + "services": [ + { + "name": "n8n-mcp", + "source": ".", + "dockerfilePath": "Dockerfile.railway" + } + ] +} From 08ae4845e546df82dde679ad59d577b9e4e12913 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 09:18:15 +0200 Subject: [PATCH 14/40] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 72e5718..25eb0cd 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 525+ workflow automation nodes. +[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?sourceUrl=https://github.com/czlonkowski/n8n-mcp) + + ## Overview n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to: From a5d6532c43b44e6db5cd041a1a9e80ddabe066f7 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 10:30:24 +0200 Subject: [PATCH 15/40] Update README.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 25eb0cd..7bfb28f 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,31 @@ A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 525+ workflow automation nodes. +## πŸš€ 1 Click Deploy on Railway + +Railway is a cloud deployment platform that lets you deploy this project with one click. + [![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?sourceUrl=https://github.com/czlonkowski/n8n-mcp) +### Quickstart + +1. Click the **Deploy on Railway** button above. +2. Railway will clone this repository and set up the service. +3. Configure required environment variables such as `AUTH_TOKEN`. +4. Optionally connect a database if needed. + +### Environment Variables + +- `AUTH_TOKEN` (required): Secret token used for authenticating requests. +- Any database connection string (optional): Ensure your database is accessible to Railway. + +### Notes + +- Railway automatically builds from the provided `Dockerfile.railway`. +- The service will expose port 3000 as configured. +- Make sure to keep your `AUTH_TOKEN` secure. + + ## Overview From 1b7221ccfdcab180d3abca9c9ae22d3e38350e2f Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 10:40:52 +0200 Subject: [PATCH 16/40] Update README.md Botton fixed --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7bfb28f..92dbf24 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ A Model Context Protocol (MCP) server that provides AI assistants with comprehen Railway is a cloud deployment platform that lets you deploy this project with one click. -[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template?sourceUrl=https://github.com/czlonkowski/n8n-mcp) +[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https://github.com/czlonkowski/n8n-mcp) + ### Quickstart From b1cd1f621b215b69241d8eaea3f2ad81bc6e9b54 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 10:42:36 +0200 Subject: [PATCH 17/40] Update README.md --- README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/README.md b/README.md index 92dbf24..42bac88 100644 --- a/README.md +++ b/README.md @@ -23,19 +23,6 @@ Railway is a cloud deployment platform that lets you deploy this project with on 3. Configure required environment variables such as `AUTH_TOKEN`. 4. Optionally connect a database if needed. -### Environment Variables - -- `AUTH_TOKEN` (required): Secret token used for authenticating requests. -- Any database connection string (optional): Ensure your database is accessible to Railway. - -### Notes - -- Railway automatically builds from the provided `Dockerfile.railway`. -- The service will expose port 3000 as configured. -- Make sure to keep your `AUTH_TOKEN` secure. - - - ## Overview n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to: From 4366cde5283e6ce2e7a543d32e20e45078573f97 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 11:37:32 +0200 Subject: [PATCH 18/40] Update Dockerfile --- Dockerfile | 71 +++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 41 deletions(-) diff --git a/Dockerfile b/Dockerfile index ced41c8..34c93cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,78 +1,67 @@ # syntax=docker/dockerfile:1.7 -# Ultra-optimized Dockerfile - minimal runtime dependencies (no n8n packages) -# Stage 1: Builder (TypeScript compilation only) FROM node:20-alpine AS builder WORKDIR /app -# Copy tsconfig for TypeScript compilation -COPY tsconfig.json ./ +# Install build dependencies for native modules +RUN apk add --no-cache python3 make g++ -# Create minimal package.json and install ONLY build dependencies -RUN --mount=type=cache,target=/root/.npm \ - echo '{}' > package.json && \ - npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ - @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ - n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 +# Copy package files and tsconfig +COPY package*.json tsconfig.json ./ -# Copy source and build +# Install all dependencies for building (including devDependencies) +RUN npm ci --no-audit --no-fund + +# Copy source code COPY src ./src -# Note: src/n8n contains TypeScript types needed for compilation -# These will be compiled but not included in runtime -RUN npx tsc -# Stage 2: Runtime (minimal dependencies) +# Build the app (transpile TypeScript) +RUN npm run build + +# --- Final minimal image --- FROM node:20-alpine AS runtime WORKDIR /app -# Install only essential runtime tools +# Install runtime-only OS deps RUN apk add --no-cache curl && \ rm -rf /var/cache/apk/* -# Copy runtime-only package.json -COPY package.runtime.json package.json +# Copy only the prod package.json (edit as needed for your setup) +COPY package*.json ./ -# Install runtime dependencies with cache mount -RUN --mount=type=cache,target=/root/.npm \ - npm install --production --no-audit --no-fund +# Install *production* node_modules only +RUN npm ci --only=production --no-audit --no-fund -# Copy built application +# Copy built files from builder COPY --from=builder /app/dist ./dist -# Copy pre-built database and required files -# Cache bust: 2025-07-06-trigger-fix-v3 - includes is_trigger=true for webhook,cron,interval,emailReadImap -COPY data/nodes.db ./data/ +# Copy assets, configs, and needed files +COPY data/ ./data/ COPY src/database/schema-optimized.sql ./src/database/ COPY .env.example ./ -# Copy entrypoint script -COPY docker/docker-entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/docker-entrypoint.sh +# Entrypoint script if you use one: +# COPY docker/docker-entrypoint.sh /usr/local/bin/ +# RUN chmod +x /usr/local/bin/docker-entrypoint.sh +# ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -# Add container labels +# Metadata LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" -LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" +LABEL org.opencontainers.image.description="n8n MCP Server" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.title="n8n-mcp" -# Create non-root user -RUN addgroup -g 1001 -S nodejs && \ - adduser -S nodejs -u 1001 && \ - chown -R nodejs:nodejs /app - -# Switch to non-root user +# Non-root user (optional, best practice) +RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001 && chown -R nodejs:nodejs /app USER nodejs -# Set Docker environment flag +# Env +ENV NODE_ENV=production ENV IS_DOCKER=true -# Expose HTTP port EXPOSE 3000 -# Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:3000/health || exit 1 -# Optimized entrypoint -ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["node", "dist/mcp/index.js"] From 3efd28d3fffbbb87fb58ed34311374be7459e8b6 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:03:11 +0200 Subject: [PATCH 19/40] Update Dockerfile rolled back to original --- Dockerfile | 71 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 34c93cf..ced41c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,67 +1,78 @@ # syntax=docker/dockerfile:1.7 +# Ultra-optimized Dockerfile - minimal runtime dependencies (no n8n packages) +# Stage 1: Builder (TypeScript compilation only) FROM node:20-alpine AS builder WORKDIR /app -# Install build dependencies for native modules -RUN apk add --no-cache python3 make g++ +# Copy tsconfig for TypeScript compilation +COPY tsconfig.json ./ -# Copy package files and tsconfig -COPY package*.json tsconfig.json ./ +# Create minimal package.json and install ONLY build dependencies +RUN --mount=type=cache,target=/root/.npm \ + echo '{}' > package.json && \ + npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ + @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ + n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 -# Install all dependencies for building (including devDependencies) -RUN npm ci --no-audit --no-fund - -# Copy source code +# Copy source and build COPY src ./src +# Note: src/n8n contains TypeScript types needed for compilation +# These will be compiled but not included in runtime +RUN npx tsc -# Build the app (transpile TypeScript) -RUN npm run build - -# --- Final minimal image --- +# Stage 2: Runtime (minimal dependencies) FROM node:20-alpine AS runtime WORKDIR /app -# Install runtime-only OS deps +# Install only essential runtime tools RUN apk add --no-cache curl && \ rm -rf /var/cache/apk/* -# Copy only the prod package.json (edit as needed for your setup) -COPY package*.json ./ +# Copy runtime-only package.json +COPY package.runtime.json package.json -# Install *production* node_modules only -RUN npm ci --only=production --no-audit --no-fund +# Install runtime dependencies with cache mount +RUN --mount=type=cache,target=/root/.npm \ + npm install --production --no-audit --no-fund -# Copy built files from builder +# Copy built application COPY --from=builder /app/dist ./dist -# Copy assets, configs, and needed files -COPY data/ ./data/ +# Copy pre-built database and required files +# Cache bust: 2025-07-06-trigger-fix-v3 - includes is_trigger=true for webhook,cron,interval,emailReadImap +COPY data/nodes.db ./data/ COPY src/database/schema-optimized.sql ./src/database/ COPY .env.example ./ -# Entrypoint script if you use one: -# COPY docker/docker-entrypoint.sh /usr/local/bin/ -# RUN chmod +x /usr/local/bin/docker-entrypoint.sh -# ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] +# Copy entrypoint script +COPY docker/docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh -# Metadata +# Add container labels LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" -LABEL org.opencontainers.image.description="n8n MCP Server" +LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" LABEL org.opencontainers.image.licenses="MIT" LABEL org.opencontainers.image.title="n8n-mcp" -# Non-root user (optional, best practice) -RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001 && chown -R nodejs:nodejs /app +# Create non-root user +RUN addgroup -g 1001 -S nodejs && \ + adduser -S nodejs -u 1001 && \ + chown -R nodejs:nodejs /app + +# Switch to non-root user USER nodejs -# Env -ENV NODE_ENV=production +# Set Docker environment flag ENV IS_DOCKER=true +# Expose HTTP port EXPOSE 3000 +# Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:3000/health || exit 1 +# Optimized entrypoint +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["node", "dist/mcp/index.js"] From 498e88e7ae422485cdce7bac12cde66fefe58245 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:04:03 +0200 Subject: [PATCH 20/40] Update railway.json added mount --- railway.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/railway.json b/railway.json index e9ec6bd..1347bd3 100644 --- a/railway.json +++ b/railway.json @@ -4,7 +4,13 @@ { "name": "n8n-mcp", "source": ".", - "dockerfilePath": "Dockerfile.railway" + "dockerfilePath": "Dockerfile.railway", + "volumes": [ + { + "mount": "/app/data", + "name": "n8n-mcp-data" + } + ] } ] } From 9e43836f317fdcc5776479750e62813c86565722 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:14:02 +0200 Subject: [PATCH 21/40] Update Dockerfile.railway added entrypoint --- Dockerfile.railway | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile.railway b/Dockerfile.railway index c5313e1..0e050ec 100644 --- a/Dockerfile.railway +++ b/Dockerfile.railway @@ -44,6 +44,10 @@ COPY data/ ./data/ COPY src/database/schema-optimized.sql ./src/database/schema-optimized.sql COPY .env.example ./ +# Copy entrypoint script +COPY docker/docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh + # Create data directory if it doesn't exist and set permissions RUN mkdir -p ./data && \ chmod 755 ./data @@ -74,5 +78,6 @@ EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://127.0.0.1:${PORT:-3000}/health || exit 1 -# Start the application in HTTP mode +# Optimized entrypoint (identical to main Dockerfile) +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["node", "dist/mcp/index.js", "--http"] From 55dfedd8a6712b6760c72e828de0abf18623195e Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:16:02 +0200 Subject: [PATCH 22/40] Update Dockerfile.railway updated not working file --- Dockerfile.railway | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.railway b/Dockerfile.railway index 0e050ec..ede0d2f 100644 --- a/Dockerfile.railway +++ b/Dockerfile.railway @@ -9,7 +9,7 @@ WORKDIR /app RUN apk add --no-cache python3 make g++ && \ rm -rf /var/cache/apk/* -# Copy package files +# Copy package files and tsconfig COPY package*.json tsconfig.json ./ # Install all dependencies (including devDependencies for build) From c0d65cc9f4b6b2d62c356c95a25cea415ba5ed95 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:22:24 +0200 Subject: [PATCH 23/40] Update Dockerfile.railway added echo --- Dockerfile.railway | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile.railway b/Dockerfile.railway index ede0d2f..3ee674e 100644 --- a/Dockerfile.railway +++ b/Dockerfile.railway @@ -1,3 +1,5 @@ +RUN echo "USING RAILWAY DOCKERFILE!" + # syntax=docker/dockerfile:1.7 # Railway-compatible Dockerfile for n8n-mcp From 536effacd5ca1aabaee0426b28ff53b864ca5845 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:30:20 +0200 Subject: [PATCH 24/40] Rename Dockerfile to _Dockerfile only for testing --- Dockerfile => _Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile => _Dockerfile (100%) diff --git a/Dockerfile b/_Dockerfile similarity index 100% rename from Dockerfile rename to _Dockerfile From 614cfccd4058c0d0f69002546bce399b8da43f5d Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:31:21 +0200 Subject: [PATCH 25/40] Rename _Dockerfile to Dockerfile back --- _Dockerfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename _Dockerfile => Dockerfile (100%) diff --git a/_Dockerfile b/Dockerfile similarity index 100% rename from _Dockerfile rename to Dockerfile From 1f269cf7e23e8d439453df83a84d03ff9a7ed456 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:32:17 +0200 Subject: [PATCH 26/40] Rename Dockerfile to Dockerfile.original --- Dockerfile => Dockerfile.original | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile => Dockerfile.original (100%) diff --git a/Dockerfile b/Dockerfile.original similarity index 100% rename from Dockerfile rename to Dockerfile.original From 59843c7271ebfb8fbf61f86d583607bb0861f68d Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:32:35 +0200 Subject: [PATCH 27/40] Create Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ + From 3b06ba91dd3e602347bc33c21eb6fabb8570c7bb Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:33:54 +0200 Subject: [PATCH 28/40] Delete Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8b13789..0000000 --- a/Dockerfile +++ /dev/null @@ -1 +0,0 @@ - From 2c18df5b8ded1aed6563c7e95889bf6c0a8cb2e2 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:34:04 +0200 Subject: [PATCH 29/40] Rename Dockerfile.original to Dockerfile --- Dockerfile.original => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile.original => Dockerfile (100%) diff --git a/Dockerfile.original b/Dockerfile similarity index 100% rename from Dockerfile.original rename to Dockerfile From 0bb9d8bd01a270ab55b9697b0ae1912deace1739 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:38:38 +0200 Subject: [PATCH 30/40] Rename Dockerfile to __Dockerfile --- Dockerfile => __Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Dockerfile => __Dockerfile (100%) diff --git a/Dockerfile b/__Dockerfile similarity index 100% rename from Dockerfile rename to __Dockerfile From 012a54dde2057688c35a713f76c861b4387666a6 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:41:17 +0200 Subject: [PATCH 31/40] Rename __Dockerfile to Dockerfile --- __Dockerfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename __Dockerfile => Dockerfile (100%) diff --git a/__Dockerfile b/Dockerfile similarity index 100% rename from __Dockerfile rename to Dockerfile From 45a0e755b7566cb0958baa681ade64d7543d763f Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:44:48 +0200 Subject: [PATCH 32/40] Update Dockerfile --- Dockerfile | 77 ------------------------------------------------------ 1 file changed, 77 deletions(-) diff --git a/Dockerfile b/Dockerfile index ced41c8..8b13789 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,78 +1 @@ -# syntax=docker/dockerfile:1.7 -# Ultra-optimized Dockerfile - minimal runtime dependencies (no n8n packages) -# Stage 1: Builder (TypeScript compilation only) -FROM node:20-alpine AS builder -WORKDIR /app - -# Copy tsconfig for TypeScript compilation -COPY tsconfig.json ./ - -# Create minimal package.json and install ONLY build dependencies -RUN --mount=type=cache,target=/root/.npm \ - echo '{}' > package.json && \ - npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ - @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ - n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 - -# Copy source and build -COPY src ./src -# Note: src/n8n contains TypeScript types needed for compilation -# These will be compiled but not included in runtime -RUN npx tsc - -# Stage 2: Runtime (minimal dependencies) -FROM node:20-alpine AS runtime -WORKDIR /app - -# Install only essential runtime tools -RUN apk add --no-cache curl && \ - rm -rf /var/cache/apk/* - -# Copy runtime-only package.json -COPY package.runtime.json package.json - -# Install runtime dependencies with cache mount -RUN --mount=type=cache,target=/root/.npm \ - npm install --production --no-audit --no-fund - -# Copy built application -COPY --from=builder /app/dist ./dist - -# Copy pre-built database and required files -# Cache bust: 2025-07-06-trigger-fix-v3 - includes is_trigger=true for webhook,cron,interval,emailReadImap -COPY data/nodes.db ./data/ -COPY src/database/schema-optimized.sql ./src/database/ -COPY .env.example ./ - -# Copy entrypoint script -COPY docker/docker-entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/docker-entrypoint.sh - -# Add container labels -LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" -LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" -LABEL org.opencontainers.image.licenses="MIT" -LABEL org.opencontainers.image.title="n8n-mcp" - -# Create non-root user -RUN addgroup -g 1001 -S nodejs && \ - adduser -S nodejs -u 1001 && \ - chown -R nodejs:nodejs /app - -# Switch to non-root user -USER nodejs - -# Set Docker environment flag -ENV IS_DOCKER=true - -# Expose HTTP port -EXPOSE 3000 - -# Health check -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD curl -f http://127.0.0.1:3000/health || exit 1 - -# Optimized entrypoint -ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -CMD ["node", "dist/mcp/index.js"] From 9a5a10194b2f6bbe47fc611c8443839308885210 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:47:06 +0200 Subject: [PATCH 33/40] Update Dockerfile --- Dockerfile | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8b13789..ced41c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1 +1,78 @@ +# syntax=docker/dockerfile:1.7 +# Ultra-optimized Dockerfile - minimal runtime dependencies (no n8n packages) +# Stage 1: Builder (TypeScript compilation only) +FROM node:20-alpine AS builder +WORKDIR /app + +# Copy tsconfig for TypeScript compilation +COPY tsconfig.json ./ + +# Create minimal package.json and install ONLY build dependencies +RUN --mount=type=cache,target=/root/.npm \ + echo '{}' > package.json && \ + npm install --no-save typescript@^5.8.3 @types/node@^22.15.30 @types/express@^5.0.3 \ + @modelcontextprotocol/sdk@^1.12.1 dotenv@^16.5.0 express@^5.1.0 axios@^1.10.0 \ + n8n-workflow@^1.96.0 uuid@^11.0.5 @types/uuid@^10.0.0 + +# Copy source and build +COPY src ./src +# Note: src/n8n contains TypeScript types needed for compilation +# These will be compiled but not included in runtime +RUN npx tsc + +# Stage 2: Runtime (minimal dependencies) +FROM node:20-alpine AS runtime +WORKDIR /app + +# Install only essential runtime tools +RUN apk add --no-cache curl && \ + rm -rf /var/cache/apk/* + +# Copy runtime-only package.json +COPY package.runtime.json package.json + +# Install runtime dependencies with cache mount +RUN --mount=type=cache,target=/root/.npm \ + npm install --production --no-audit --no-fund + +# Copy built application +COPY --from=builder /app/dist ./dist + +# Copy pre-built database and required files +# Cache bust: 2025-07-06-trigger-fix-v3 - includes is_trigger=true for webhook,cron,interval,emailReadImap +COPY data/nodes.db ./data/ +COPY src/database/schema-optimized.sql ./src/database/ +COPY .env.example ./ + +# Copy entrypoint script +COPY docker/docker-entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-entrypoint.sh + +# Add container labels +LABEL org.opencontainers.image.source="https://github.com/czlonkowski/n8n-mcp" +LABEL org.opencontainers.image.description="n8n MCP Server - Runtime Only" +LABEL org.opencontainers.image.licenses="MIT" +LABEL org.opencontainers.image.title="n8n-mcp" + +# Create non-root user +RUN addgroup -g 1001 -S nodejs && \ + adduser -S nodejs -u 1001 && \ + chown -R nodejs:nodejs /app + +# Switch to non-root user +USER nodejs + +# Set Docker environment flag +ENV IS_DOCKER=true + +# Expose HTTP port +EXPOSE 3000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD curl -f http://127.0.0.1:3000/health || exit 1 + +# Optimized entrypoint +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] +CMD ["node", "dist/mcp/index.js"] From 534efddedf4cb844d353e20214a1951481c27e41 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:51:38 +0200 Subject: [PATCH 34/40] Update railway.json --- railway.json | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/railway.json b/railway.json index 1347bd3..2c36162 100644 --- a/railway.json +++ b/railway.json @@ -1,16 +1,13 @@ { - "name": "n8n-mcp", - "services": [ - { - "name": "n8n-mcp", - "source": ".", - "dockerfilePath": "Dockerfile.railway", - "volumes": [ - { - "mount": "/app/data", - "name": "n8n-mcp-data" - } - ] - } - ] + "build": { + "builder": "DOCKERFILE", + "dockerfilePath": "Dockerfile.railway" + }, + "deploy": { + "runtime": "V2", + "numReplicas": 1, + "sleepApplication": false, + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + } } From a6ccdd08b60807bd8227a692937da47278ffd895 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:55:55 +0200 Subject: [PATCH 35/40] Update railway.json --- railway.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/railway.json b/railway.json index 2c36162..1e0eb02 100644 --- a/railway.json +++ b/railway.json @@ -8,6 +8,12 @@ "numReplicas": 1, "sleepApplication": false, "restartPolicyType": "ON_FAILURE", - "restartPolicyMaxRetries": 10 + "restartPolicyMaxRetries": 10, + "volumes": [ + { + "mount": "/app/data", + "name": "n8n-mcp-data" + } + ] } } From c089ee60d884193987dfbe700c483f851b22e1ed Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 13:56:14 +0200 Subject: [PATCH 36/40] Update Dockerfile.railway --- Dockerfile.railway | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile.railway b/Dockerfile.railway index 3ee674e..ede0d2f 100644 --- a/Dockerfile.railway +++ b/Dockerfile.railway @@ -1,5 +1,3 @@ -RUN echo "USING RAILWAY DOCKERFILE!" - # syntax=docker/dockerfile:1.7 # Railway-compatible Dockerfile for n8n-mcp From 50d63a883bad9a02f85ea951afd380d592a69345 Mon Sep 17 00:00:00 2001 From: moonwalk Date: Wed, 16 Jul 2025 14:10:33 +0200 Subject: [PATCH 37/40] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42bac88..9f97995 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A Model Context Protocol (MCP) server that provides AI assistants with comprehen Railway is a cloud deployment platform that lets you deploy this project with one click. -[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https://github.com/czlonkowski/n8n-mcp) +[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/AQSZuP?referralCode=xdb4OL) ### Quickstart From 0155e4555c41a72681c5f44176ce3dce377381e5 Mon Sep 17 00:00:00 2001 From: czlonkowski <56956555+czlonkowski@users.noreply.github.com> Date: Wed, 16 Jul 2025 17:41:26 +0200 Subject: [PATCH 38/40] feat: add Railway deployment with zero-config setup --- Dockerfile.railway | 7 +++- README.md | 67 ++++++++++++++++++++++++++---- data/nodes.db | Bin 25616384 -> 25616384 bytes src/http-server-single-session.ts | 24 +++++++++++ src/http-server.ts | 24 +++++++++++ 5 files changed, 114 insertions(+), 8 deletions(-) diff --git a/Dockerfile.railway b/Dockerfile.railway index ede0d2f..341fead 100644 --- a/Dockerfile.railway +++ b/Dockerfile.railway @@ -65,11 +65,16 @@ RUN addgroup -g 1001 -S nodejs && \ chown -R nodejs:nodejs /app USER nodejs -# Set environment variables +# Set Railway-optimized environment variables +ENV AUTH_TOKEN="REPLACE_THIS_AUTH_TOKEN_32_CHARS_MIN_abcdefgh" ENV NODE_ENV=production ENV IS_DOCKER=true ENV MCP_MODE=http ENV USE_FIXED_HTTP=true +ENV LOG_LEVEL=info +ENV TRUST_PROXY=1 +ENV HOST=0.0.0.0 +ENV CORS_ORIGIN="*" # Expose port (Railway will set PORT automatically) EXPOSE 3000 diff --git a/README.md b/README.md index 9f97995..b653c8e 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,72 @@ A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 525+ workflow automation nodes. -## πŸš€ 1 Click Deploy on Railway +## πŸš€ Zero-Configuration Railway Deployment -Railway is a cloud deployment platform that lets you deploy this project with one click. +Deploy n8n-MCP to Railway with **one click** - no configuration required to start! [![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/AQSZuP?referralCode=xdb4OL) +### ✨ Features +- **Works immediately** - Pre-configured with working defaults +- **Secure by design** - Prominent warnings for default AUTH_TOKEN +- **Production-ready** - Optimized environment variables included +- **No setup required** - Just click deploy! -### Quickstart +### πŸš€ Quick Deploy Steps -1. Click the **Deploy on Railway** button above. -2. Railway will clone this repository and set up the service. -3. Configure required environment variables such as `AUTH_TOKEN`. -4. Optionally connect a database if needed. +1. **Click Deploy** - Use the button above +2. **Wait ~2 minutes** - Railway builds and deploys automatically +3. **Get your URL** - Railway provides a public URL instantly +4. **Start using** - Connect to Claude Desktop immediately! + +### ⚠️ IMPORTANT: Post-Deployment Security + +**The deployment includes a default AUTH_TOKEN for instant functionality.** + +After deployment, you MUST: +1. Go to Railway dashboard β†’ Variables +2. Find `AUTH_TOKEN` variable +3. Replace with secure token: `openssl rand -base64 32` +4. Railway will automatically redeploy + +> **Security Note**: The server will display warnings every 5 minutes until you change the default token! + +### πŸ”§ Environment Variables (Auto-Configured) + +| Variable | Default Value | Description | +|----------|--------------|-------------| +| `AUTH_TOKEN` | `REPLACE_THIS...` | **⚠️ CHANGE IMMEDIATELY** | +| `MCP_MODE` | `http` | Required for cloud deployment | +| `USE_FIXED_HTTP` | `true` | Stable HTTP implementation | +| `NODE_ENV` | `production` | Production optimizations | +| `LOG_LEVEL` | `info` | Balanced logging | +| `TRUST_PROXY` | `1` | Railway runs behind proxy | +| `CORS_ORIGIN` | `*` | Allow any origin (customize later) | +| `PORT` | (Railway provides) | Don't set manually | + +### πŸ“ Optional: n8n API Integration + +To enable workflow management features, add these variables in Railway: +- `N8N_API_URL` - Your n8n instance URL +- `N8N_API_KEY` - API key from n8n settings + +### 🎯 Creating Your Own Railway Template + +Want to customize and create your own Railway deploy button? + +1. **Deploy this project** first using the button above +2. **Customize** environment variables as needed +3. **Go to Railway dashboard** β†’ Your project β†’ Settings +4. **Click "Generate Template"** at the bottom +5. **Configure template**: + - Set required variables (AUTH_TOKEN) + - Add description and icon + - Publish the template +6. **Get your template URL** and button code +7. **Update this README** with your custom button + +> **Note**: The current button deploys from kimbo128's fork. Create your own template to deploy from your repository! ## Overview diff --git a/data/nodes.db b/data/nodes.db index 96c003862337e8db6ba378571375c9765bd74ef7..7efa4be7c12343985c101cf1962832209a0aa8c1 100644 GIT binary patch delta 1341 zcmWmA)q)TN00q%q0SW0wP(tYzkx)9NyJJ97LRyrLK~Yh#6$87w1H}&PZtU*F_WE#s z;H=%Xz4Y4HTC>9Lf`aPv3ks?=FDNMJ9(%VnYg4#;9a1R!ND(P2#bjS8E+wR-l#>0V zw3LyuQclWC1*s^Nq_R|zs!~m=OAXmyYDz6RKn|4JQb+1aJvm4Ymip2_8cHK+EKQ`T zG?V7iLRv~IX)T9H8#z?k%3;z@+DixND2K}t(n&f?7wIb9q`UNxp3+NtOCRYgM@m2G zF9T$t43fbzM25;R87?Daq>Pf$GDgPAI2kV!WTH%x$&#NbGF6U}X);}A$V{0fv*l=+ zBXeb*%$H+ifh?3ovRIbLQduU)%5phQj+Yg(QdY@oStDy@ovfD)vQd;xa)O*Fo8=@q zSx%8Ha;lsrTV3;%4Kr7Tp?G=RdTgl zBiG7xa=qLjH_AGWCVS;~`9uDczvOTENB-SR;T8&G zpC}SVqgd=4#iK-&j8d^*l#Vh{Hp)f$s1OySQdEvAQ8lVX^{5g1N6n}e2gHFOw9pmsgB05Fq=n`F{ zTXc^e(KC8Q@8}bKyA<7#HJXLQITFF**MK zpAu8!sF)VhV@Ax3Sus0~jyW+m=EeLtCKklPSQLw6Ni2?tUyHm{(dYKww`f?lzAXY)3Ndp074vX2yzqEbwXO9?3{`^tV&N=i!^ zDJ$iqyi|~iQb{Vy{!&G%N;Ro2HKeB0lG<{B)RDSUPwGnpX()}Pu^cE(q^UHMgQU5% zkd|_=w30)lwX~78(oWh-2k9t>N+;3o#>zMuFB9YlIZ`IdQ8G#LGg+p{RGB8zWroa@Su$JZ$Xq#E zj*)pXUlzzhStN^Pi7b_6vRqckN?9eVWsR(rb+TSI$VS;Dn`MhATjf|ePPWPMa)O*F z+vOxVS$4=yIYmyD)8uqHL(Y`5y z*T}VUom?+B$c=K7+$^`qt#X^(E_cYCa+lmK_sG3+pWH7G$ZmO19+HRU5qVS|lgH%= z*&|QNQ}VPtBhSin^1QqtFUm{uvb-X%%4_nvydiJOTk^KNBk#(4^1gf^AIeAav3w$* z%4hPqd?8=TSMs%dBj3t*^1bYpALK{*Nq&}J&F!qTe zQ8bE0@hA}`W8c^>N=4}?6J?`Zl#dEgF)Bsn*gvX7)uT2VU=h&oX>>P7u% z5DlYIG>!wKNi>aSaZogm7SS>ej#hCHrhq|=nx&_(C8GMqf2y+ZqYq@M9=6I zy`xX`jegNT2E@P^6oX?(42@wiJPwP)V?>OMQ87Bk#Ml@Y<6}Y`5l6 { + logger.warn('⚠️ Still using default AUTH_TOKEN - security risk!'); + if (process.env.MCP_MODE === 'http') { + console.warn('⚠️ REMINDER: Still using default AUTH_TOKEN - please change it!'); + } + }, 300000); // Every 5 minutes + } }); // Handle server errors diff --git a/src/http-server.ts b/src/http-server.ts index 5c362a8..04f4fa2 100644 --- a/src/http-server.ts +++ b/src/http-server.ts @@ -68,6 +68,20 @@ function validateEnvironment() { logger.warn('AUTH_TOKEN should be at least 32 characters for security'); console.warn('WARNING: AUTH_TOKEN should be at least 32 characters for security'); } + + // Check for default token and show prominent warnings + if (authToken === 'REPLACE_THIS_AUTH_TOKEN_32_CHARS_MIN_abcdefgh') { + logger.warn('⚠️ SECURITY WARNING: Using default AUTH_TOKEN - CHANGE IMMEDIATELY!'); + logger.warn('Generate secure token with: openssl rand -base64 32'); + + // Only show console warnings in HTTP mode + if (process.env.MCP_MODE === 'http') { + console.warn('\n⚠️ SECURITY WARNING ⚠️'); + console.warn('Using default AUTH_TOKEN - CHANGE IMMEDIATELY!'); + console.warn('Generate secure token: openssl rand -base64 32'); + console.warn('Update via Railway dashboard environment variables\n'); + } + } } /** @@ -418,6 +432,16 @@ export async function startFixedHTTPServer() { console.log(`Health check: http://localhost:${port}/health`); console.log(`MCP endpoint: http://localhost:${port}/mcp`); console.log('\nPress Ctrl+C to stop the server'); + + // Start periodic warning timer if using default token + if (authToken === 'REPLACE_THIS_AUTH_TOKEN_32_CHARS_MIN_abcdefgh') { + setInterval(() => { + logger.warn('⚠️ Still using default AUTH_TOKEN - security risk!'); + if (process.env.MCP_MODE === 'http') { + console.warn('⚠️ REMINDER: Still using default AUTH_TOKEN - please change it!'); + } + }, 300000); // Every 5 minutes + } }); // Handle errors From 8a15961995aa8a9d1255e2f31088d245b7ca2660 Mon Sep 17 00:00:00 2001 From: czlonkowski <56956555+czlonkowski@users.noreply.github.com> Date: Thu, 17 Jul 2025 00:46:14 +0200 Subject: [PATCH 39/40] feat: add Railway deployment support with CI/CD integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Railway-specific Docker image build to CI/CD workflow - Builds n8n-mcp-railway image alongside standard image - Railway image optimized for AMD64 architecture - Automatically published to ghcr.io on main branch pushes - Create comprehensive Railway deployment documentation - Step-by-step deployment guide with security best practices - Claude Desktop connection instructions via mcp-remote - Troubleshooting guide for common issues - Architecture details and single-instance design explanation - Update README with Railway documentation link - Removed inline Railway content to keep README focused - Added link to dedicated Railway deployment guide This enables zero-configuration cloud deployment of n8n-mcp with automatic HTTPS, global access, and built-in monitoring. πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/docker-build.yml | 54 +++++++ README.md | 108 +++++-------- docs/RAILWAY_DEPLOYMENT.md | 247 +++++++++++++++++++++++++++++ 3 files changed, 341 insertions(+), 68 deletions(-) create mode 100644 docs/RAILWAY_DEPLOYMENT.md diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 8abc1de..7861a25 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -70,6 +70,60 @@ jobs: labels: ${{ steps.meta.outputs.labels }} provenance: false + build-railway: + name: Build Railway Docker Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Railway + id: meta-railway + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-railway + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha,prefix={{branch}}-,format=short + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Railway Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile.railway + no-cache: true + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta-railway.outputs.tags }} + labels: ${{ steps.meta-railway.outputs.labels }} + provenance: false + # Nginx build commented out until Phase 2 # build-nginx: # name: Build nginx-enhanced Docker Image diff --git a/README.md b/README.md index b653c8e..eb620cf 100644 --- a/README.md +++ b/README.md @@ -2,80 +2,13 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![GitHub stars](https://img.shields.io/github/stars/czlonkowski/n8n-mcp?style=social)](https://github.com/czlonkowski/n8n-mcp) -[![Version](https://img.shields.io/badge/version-2.7.13-blue.svg)](https://github.com/czlonkowski/n8n-mcp) +[![Version](https://img.shields.io/badge/version-2.7.15-blue.svg)](https://github.com/czlonkowski/n8n-mcp) [![npm version](https://img.shields.io/npm/v/n8n-mcp.svg)](https://www.npmjs.com/package/n8n-mcp) [![n8n version](https://img.shields.io/badge/n8n-v1.101.1-orange.svg)](https://github.com/n8n-io/n8n) [![Docker](https://img.shields.io/badge/docker-ghcr.io%2Fczlonkowski%2Fn8n--mcp-green.svg)](https://github.com/czlonkowski/n8n-mcp/pkgs/container/n8n-mcp) A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to n8n node documentation, properties, and operations. Deploy in minutes to give Claude and other AI assistants deep knowledge about n8n's 525+ workflow automation nodes. -## πŸš€ Zero-Configuration Railway Deployment - -Deploy n8n-MCP to Railway with **one click** - no configuration required to start! - -[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/AQSZuP?referralCode=xdb4OL) - -### ✨ Features -- **Works immediately** - Pre-configured with working defaults -- **Secure by design** - Prominent warnings for default AUTH_TOKEN -- **Production-ready** - Optimized environment variables included -- **No setup required** - Just click deploy! - -### πŸš€ Quick Deploy Steps - -1. **Click Deploy** - Use the button above -2. **Wait ~2 minutes** - Railway builds and deploys automatically -3. **Get your URL** - Railway provides a public URL instantly -4. **Start using** - Connect to Claude Desktop immediately! - -### ⚠️ IMPORTANT: Post-Deployment Security - -**The deployment includes a default AUTH_TOKEN for instant functionality.** - -After deployment, you MUST: -1. Go to Railway dashboard β†’ Variables -2. Find `AUTH_TOKEN` variable -3. Replace with secure token: `openssl rand -base64 32` -4. Railway will automatically redeploy - -> **Security Note**: The server will display warnings every 5 minutes until you change the default token! - -### πŸ”§ Environment Variables (Auto-Configured) - -| Variable | Default Value | Description | -|----------|--------------|-------------| -| `AUTH_TOKEN` | `REPLACE_THIS...` | **⚠️ CHANGE IMMEDIATELY** | -| `MCP_MODE` | `http` | Required for cloud deployment | -| `USE_FIXED_HTTP` | `true` | Stable HTTP implementation | -| `NODE_ENV` | `production` | Production optimizations | -| `LOG_LEVEL` | `info` | Balanced logging | -| `TRUST_PROXY` | `1` | Railway runs behind proxy | -| `CORS_ORIGIN` | `*` | Allow any origin (customize later) | -| `PORT` | (Railway provides) | Don't set manually | - -### πŸ“ Optional: n8n API Integration - -To enable workflow management features, add these variables in Railway: -- `N8N_API_URL` - Your n8n instance URL -- `N8N_API_KEY` - API key from n8n settings - -### 🎯 Creating Your Own Railway Template - -Want to customize and create your own Railway deploy button? - -1. **Deploy this project** first using the button above -2. **Customize** environment variables as needed -3. **Go to Railway dashboard** β†’ Your project β†’ Settings -4. **Click "Generate Template"** at the bottom -5. **Configure template**: - - Set required variables (AUTH_TOKEN) - - Add description and icon - - Publish the template -6. **Get your template URL** and button code -7. **Update this README** with your custom button - -> **Note**: The current button deploys from kimbo128's fork. Create your own template to deploy from your repository! - ## Overview n8n-MCP serves as a bridge between n8n's workflow automation platform and AI models, enabling them to understand and work with n8n nodes effectively. It provides structured access to: @@ -265,6 +198,8 @@ Add to Claude Desktop config: **Important:** The `-i` flag is required for MCP stdio communication. +> πŸ”§ If you encounter any issues with Docker, check our [Docker Troubleshooting Guide](./docs/DOCKER_TROUBLESHOOTING.md). + **Configuration file locations:** - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` @@ -272,6 +207,26 @@ Add to Claude Desktop config: **Restart Claude Desktop after updating configuration** - That's it! πŸŽ‰ +## πŸ’– Support This Project + + + +**n8n-mcp** started as a personal tool but now helps tens of thousands of developers automate their workflows efficiently. Maintaining and developing this project competes with my paid work. + +Your sponsorship helps me: +- πŸš€ Dedicate focused time to new features +- πŸ› Respond quickly to issues +- πŸ“š Keep documentation up-to-date +- πŸ”„ Ensure compatibility with latest n8n releases + +Every sponsorship directly translates to hours invested in making n8n-mcp better for everyone. **[Become a sponsor β†’](https://github.com/sponsors/czlonkowski)** + +--- + ### Option 3: Local Installation (For Development) **Prerequisites:** [Node.js](https://nodejs.org/) installed on your system @@ -330,6 +285,22 @@ Add to Claude Desktop config: > πŸ’‘ Tip: If you’re running n8n locally on the same machine (e.g., via Docker), use http://host.docker.internal:5678 as the N8N_API_URL. +## πŸ’» Connect your IDE + +n8n-MCP works with multiple AI-powered IDEs and tools. Choose your preferred development environment: + +### [Claude Code](./docs/CLAUDE_CODE_SETUP.md) +Quick setup for Claude Code CLI - just type "add this mcp server" and paste the config. + +### [Visual Studio Code](./docs/VS_CODE_PROJECT_SETUP.md) +Full setup guide for VS Code with GitHub Copilot integration and MCP support. + +### [Cursor](./docs/CURSOR_SETUP.md) +Step-by-step tutorial for connecting n8n-MCP to Cursor IDE with custom rules. + +### [Windsurf](./docs/WINDSURF_SETUP.md) +Complete guide for integrating n8n-MCP with Windsurf using project rules. + ## πŸ€– Claude Project Setup For the best results when using n8n-MCP with Claude Projects, use these enhanced system instructions: @@ -635,6 +606,7 @@ npm run dev:http # HTTP dev mode - [Validation System](./docs/validation-improvements-v2.4.2.md) - Smart validation profiles ### Development & Deployment +- [Railway Deployment](./docs/RAILWAY_DEPLOYMENT.md) - One-click cloud deployment guide - [HTTP Deployment](./docs/HTTP_DEPLOYMENT.md) - Remote server setup guide - [Dependency Management](./docs/DEPENDENCY_UPDATES.md) - Keeping n8n packages in sync - [Claude's Interview](./docs/CLAUDE_INTERVIEW.md) - Real-world impact of n8n-MCP diff --git a/docs/RAILWAY_DEPLOYMENT.md b/docs/RAILWAY_DEPLOYMENT.md new file mode 100644 index 0000000..b8c867a --- /dev/null +++ b/docs/RAILWAY_DEPLOYMENT.md @@ -0,0 +1,247 @@ +# Railway Deployment Guide for n8n-MCP + +Deploy n8n-MCP to Railway's cloud platform with zero configuration and connect it to Claude Desktop from anywhere. + +## πŸš€ Quick Deploy + +Deploy n8n-MCP with one click: + +[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/Ep_b-Y?referralCode=n8n-mcp) + +## πŸ“‹ Overview + +Railway deployment provides: +- ☁️ **Instant cloud hosting** - No server setup required +- πŸ”’ **Secure by default** - HTTPS included, auth token warnings +- 🌐 **Global access** - Connect from any Claude Desktop +- ⚑ **Auto-scaling** - Railway handles the infrastructure +- πŸ“Š **Built-in monitoring** - Logs and metrics included + +## 🎯 Step-by-Step Deployment + +### 1. Deploy to Railway + +1. **Click the Deploy button** above +2. **Sign in to Railway** (or create account) +3. **Configure your deployment**: + - Project name (optional) + - Environment (leave as "production") + - Region (choose closest to you) +4. **Click "Deploy"** and wait ~2-3 minutes + +### 2. Configure Security + +**IMPORTANT**: The deployment includes a default AUTH_TOKEN for instant functionality, but you MUST change it: + +1. **Go to your Railway dashboard** +2. **Click on your n8n-mcp service** +3. **Navigate to "Variables" tab** +4. **Find `AUTH_TOKEN`** +5. **Replace with secure token**: + ```bash + # Generate secure token locally: + openssl rand -base64 32 + ``` +6. **Railway will automatically redeploy** with the new token + +> ⚠️ **Security Warning**: The server displays warnings every 5 minutes until you change the default token! + +### 3. Get Your Service URL + +1. In Railway dashboard, click on your service +2. Go to **"Settings"** tab +3. Under **"Domains"**, you'll see your URL: + ``` + https://your-app-name.up.railway.app + ``` +4. Copy this URL for Claude Desktop configuration + +### 4. Connect Claude Desktop + +Add to your Claude Desktop configuration: + +```json +{ + "mcpServers": { + "n8n-railway": { + "command": "npx", + "args": [ + "-y", + "mcp-remote", + "https://your-app-name.up.railway.app/mcp", + "--header", + "Authorization: Bearer YOUR_SECURE_TOKEN_HERE" + ] + } + } +} +``` + +**Configuration file locations:** +- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` +- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` +- **Linux**: `~/.config/Claude/claude_desktop_config.json` + +**Restart Claude Desktop** after saving the configuration. + +## πŸ”§ Environment Variables + +### Default Variables (Pre-configured) + +These are automatically set by the Railway template: + +| Variable | Default Value | Description | +|----------|--------------|-------------| +| `AUTH_TOKEN` | `REPLACE_THIS...` | **⚠️ CHANGE IMMEDIATELY** | +| `MCP_MODE` | `http` | Required for cloud deployment | +| `USE_FIXED_HTTP` | `true` | Stable HTTP implementation | +| `NODE_ENV` | `production` | Production optimizations | +| `LOG_LEVEL` | `info` | Balanced logging | +| `TRUST_PROXY` | `1` | Railway runs behind proxy | +| `CORS_ORIGIN` | `*` | Allow any origin | +| `HOST` | `0.0.0.0` | Listen on all interfaces | +| `PORT` | (Railway provides) | Don't set manually | + +### Optional: n8n API Integration + +To enable workflow management features: + +1. **Go to Railway dashboard** β†’ Your service β†’ **Variables** +2. **Add these variables**: + - `N8N_API_URL`: Your n8n instance URL (e.g., `https://n8n.example.com`) + - `N8N_API_KEY`: API key from n8n Settings β†’ API +3. **Save changes** - Railway will redeploy automatically + +## πŸ—οΈ Architecture Details + +### How It Works + +``` +Claude Desktop β†’ mcp-remote β†’ Railway (HTTPS) β†’ n8n-MCP Server +``` + +1. **Claude Desktop** uses `mcp-remote` as a bridge +2. **mcp-remote** converts stdio to HTTP requests +3. **Railway** provides HTTPS endpoint and infrastructure +4. **n8n-MCP** runs in HTTP mode on Railway + +### Single-Instance Design + +**Important**: The n8n-MCP HTTP server is designed for single n8n instance deployment: +- n8n API credentials are configured server-side via environment variables +- All clients connecting to the server share the same n8n instance +- For multi-tenant usage, deploy separate Railway instances + +### Security Model + +- **Bearer Token Authentication**: All requests require the AUTH_TOKEN +- **HTTPS by Default**: Railway provides SSL certificates +- **Environment Isolation**: Each deployment is isolated +- **No State Storage**: Server is stateless (database is read-only) + +## 🚨 Troubleshooting + +### Connection Issues + +**"Invalid URL" error in Claude Desktop:** +- Ensure you're using the exact configuration format shown above +- Don't add "connect" or other arguments before the URL +- The URL should end with `/mcp` + +**"Unauthorized" error:** +- Check that your AUTH_TOKEN matches exactly (no extra spaces) +- Ensure the Authorization header format is correct: `Authorization: Bearer TOKEN` + +**"Cannot connect to server":** +- Verify your Railway deployment is running (check Railway dashboard) +- Ensure the URL is correct and includes `https://` +- Check Railway logs for any errors + +### Railway-Specific Issues + +**Build failures:** +- Railway uses AMD64 architecture - the template is configured for this +- Check build logs in Railway dashboard for specific errors + +**Environment variable issues:** +- Variables are case-sensitive +- Don't include quotes in the Railway dashboard (only in JSON config) +- Railway automatically restarts when you change variables + +**Domain not working:** +- It may take 1-2 minutes for the domain to become active +- Check the "Deployments" tab to ensure the latest deployment succeeded + +## πŸ“Š Monitoring & Logs + +### View Logs + +1. Go to Railway dashboard +2. Click on your n8n-mcp service +3. Click on **"Logs"** tab +4. You'll see real-time logs including: + - Server startup messages + - Authentication attempts + - API requests (without sensitive data) + - Any errors or warnings + +### Monitor Usage + +Railway provides metrics for: +- **Memory usage** (typically ~100-200MB) +- **CPU usage** (minimal when idle) +- **Network traffic** +- **Response times** + +## πŸ’° Pricing & Limits + +### Railway Free Tier +- **$5 free credit** monthly +- **500 hours** of runtime +- **Sufficient for personal use** of n8n-MCP + +### Estimated Costs +- **n8n-MCP typically uses**: ~0.1 GB RAM +- **Monthly cost**: ~$2-3 for 24/7 operation +- **Well within free tier** for most users + +## πŸ”„ Updates & Maintenance + +### Manual Updates + +Since the Railway template uses a specific Docker image tag, updates are manual: + +1. **Check for updates** on [GitHub](https://github.com/czlonkowski/n8n-mcp) +2. **Update image tag** in Railway: + - Go to Settings β†’ Deploy β†’ Docker Image + - Change tag from current to new version + - Click "Redeploy" + +### Automatic Updates (Not Recommended) + +You could use the `latest` tag, but this may cause unexpected breaking changes. + +## πŸ“ Best Practices + +1. **Always change the default AUTH_TOKEN immediately** +2. **Use strong, unique tokens** (32+ characters) +3. **Monitor logs** for unauthorized access attempts +4. **Keep credentials secure** - never commit them to git +5. **Use environment variables** for all sensitive data +6. **Regular updates** - check for new versions monthly + +## πŸ†˜ Getting Help + +- **Railway Documentation**: [docs.railway.app](https://docs.railway.app) +- **n8n-MCP Issues**: [GitHub Issues](https://github.com/czlonkowski/n8n-mcp/issues) +- **Railway Community**: [Discord](https://discord.gg/railway) + +## πŸŽ‰ Success! + +Once connected, you can use all n8n-MCP features from Claude Desktop: +- Search and explore 500+ n8n nodes +- Get node configurations and examples +- Validate workflows before deployment +- Manage n8n workflows (if API configured) + +The cloud deployment means you can access your n8n knowledge base from any computer with Claude Desktop installed! \ No newline at end of file From f1e287e031dbf21c81ab43787f991eb1aea0a7ef Mon Sep 17 00:00:00 2001 From: czlonkowski <56956555+czlonkowski@users.noreply.github.com> Date: Thu, 17 Jul 2025 00:57:51 +0200 Subject: [PATCH 40/40] fix: remove branch prefix from SHA tag to avoid invalid Docker tag format --- .github/workflows/docker-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 31573b9..cbecbb1 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -125,7 +125,7 @@ jobs: type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - type=sha,prefix={{branch}}-,format=short + type=sha,format=short type=raw,value=latest,enable={{is_default_branch}} - name: Build and push Railway Docker image