@lexinet/n8n-mcp-modern
v5.1.3
Published
Modern n8n MCP server with Phase 2 orchestration - intelligent agent coordination, session management, and advanced workflow automation
Maintainers
Readme
n8n-MCP Modern 🚀
Modern n8n MCP server built from the ground up with zero legacy dependencies and maximum performance.
🎯 What's New in v5.0.4
Community Node Discovery (CRITICAL):
- ✅ npm Registry Validation - Community packages now validated via npm registry when n8n API unavailable
- ✅ Built-in Node Detection - Correctly identifies
n8n-nodes-base.*nodes as always available - ✅ Package Information - Returns version, description, npm URLs, and installation status
- ✅ TypeScript Safety - All npm API responses properly typed with comprehensive error handling
Previous Release (v5.0.2) - Authentication Fix:
- ✅ X-N8N-API-KEY Authentication - Fixed 401 errors by using correct X-N8N-API-KEY header format
- ✅ n8n Compatibility - Now works with all n8n hosting providers (cloud, self-hosted, Docker)
- ✅ API Standards Compliance - Uses proper
X-N8N-API-KEYheader as per n8n API documentation - ✅ Comprehensive Fix - Updated API client, health checks, and all tests for consistency
Previous Release (v5.0.1):
Modern Dependencies & Security:
- ✅ Up-to-Date Dependencies - TypeScript ESLint 8.40.0, dotenv 17.2.1
- ✅ Header Validation Fix - Resolved JWT token handling for undici 7.0.0 compatibility
- ✅ TypeScript Validator Tested - Comprehensive security-first validation agent
- ✅ Zero Security Vulnerabilities - Clean audit with modern dependency stack
- ✅ Production Hardened - 175+ tests passing with comprehensive validation
Previous Features:
Dynamic Version Management (v4.7.4):
- ✅ Automatic Version Detection - Version now dynamically read from package.json
- ✅ No More Version Mismatches - Ensures displayed version always matches package
ZERO TECHNICAL DEBT ACHIEVED (v4.7.3):
- ✅ Complete Technical Debt Elimination - Comprehensive cleanup with TypeScript validation
- ✅ Encryption Module Tested - Production-ready encryption with 9 comprehensive test cases
- ✅ n8n API Compliance - Validated workflow creation follows n8n API constraints
- ✅ Modern ESM Patterns - Full ES2024 compatibility with Node.js 22+ optimization
Previous Features (v4.6.11):
Smart Installation & Optimization:
- ✅ 75% Smaller Package - Reduced from 5.4MB to 1.3MB for lightning-fast installs
- ✅ Smart Agent Updates - Only install/update when needed, not every server start
- ✅ Upgrade Safety - Automatic cleanup of legacy files during updates
- ✅ Content Hash Tracking - Detects actual agent changes for precise updates
- ✅ Production Ready - 175 tests passing with comprehensive E2E validation
Enhanced Stability & Production Readiness:
- ✅ Production Stability - Enhanced error handling and graceful shutdown
- ✅ Complete Test Coverage - 175/176 tests passing with full E2E validation
- ✅ Zero Security Issues - Clean dependency tree with minimal attack surface
- ✅ TypeScript Excellence - Strict mode compliance with comprehensive type safety
- ✅ Performance Optimized - Advanced caching and connection pooling
- ✅ Modern Architecture - ESM-first with Node.js 22+ optimization
Complete Tool & Agent Ecosystem:
- ✅ 100 Total Tools - Comprehensive n8n automation coverage
- ✅ 7-Agent Hierarchy - Optimized for Claude Code workflows
- ✅ Code Generation - AI-powered workflow creation (12 tools)
- ✅ DevOps Integration - CI/CD & deployment automation (10 tools)
- ✅ Performance Monitoring - Advanced observability & optimization (12 tools)
- ✅ Comprehensive n8n - Complete ecosystem management (58 tools)
- ✅ Configuration Management - MCP setup validation & auto-fix
- ✅ Claude MCP Integration - One-command install with agent deployment
Architecture & Performance:
- 🚀 95% Smaller Bundle: 1.1GB → 15MB
- ⚡ 10x Faster Install: 3+ minutes → <30 seconds
- 🔒 Zero Vulnerabilities: 16 critical issues → 0
- 💨 2x Faster Runtime: Modern V8 optimizations
- 🎯 100% Test Coverage: All 29 agent tests passing
🏗️ Architecture
Ultra-Minimal Dependencies
{
"dependencies": {
"@modelcontextprotocol/sdk": "^1.17.3", // Official MCP SDK
"better-sqlite3": "^12.2.0", // Database
"undici": "^7.0.0", // HTTP client
"dotenv": "^17.2.1", // Config
"zod": "^3.25.76" // Validation
}
}Core Components
src/
├── server/ # MCP server implementation
├── database/ # SQLite with clean schemas
├── tools/ # 100 MCP tools (modern patterns)
├── agents/ # 7-agent hierarchical system
├── validation/ # Zod-based validation engine
├── n8n/ # Minimal n8n integration layer
└── types/ # Full TypeScript definitions🛠️ MCP Configuration Management
New in v4.3! Validate and fix your .mcp.json configuration:
# Check your MCP configuration
validate_mcp_config
# Auto-fix common issues
validate_mcp_config {"fix_issues": true}Features:
- ✅ Validates
.mcp.jsonstructure and syntax - ✅ Checks Node.js version requirements (22+)
- ✅ Verifies build artifacts exist (
dist/index.js) - ✅ Auto-generates missing configuration files
- ✅ Provides clear recommendations for fixes
🚀 Quick Start
Prerequisites for Full Agent Functionality
Recommended MCP Dependencies:
For optimal agent performance with real-time documentation and enhanced reasoning capabilities, we recommend installing these companion MCP servers:
# 1. Context7 MCP - Real-time documentation access (HIGHLY RECOMMENDED)
claude mcp add context7 -s user -- npx -y @upstash/context7-mcp
# 2. Sequential Thinking MCP - Enhanced reasoning for complex tasks
claude mcp add sequential-thinking -s user -- npx -y @modelcontextprotocol/server-sequential-thinkingWhy These Are Important:
- Context7: Provides agents with up-to-date API documentation, current best practices, and real-time library information instead of relying on training cutoffs
- Sequential Thinking: Enables agents to break down complex problems systematically for better analysis and implementation
Note: n8n-MCP Modern works without these dependencies, but agent capabilities will be limited to training knowledge cutoffs.
Installation
🐳 Self-Hosted n8n with Docker: If you're running n8n via docker-compose, you MUST add this environment variable to your n8n service BEFORE creating your API key:
environment: - N8N_API_ENDPOINT_REST=api/v1Run
docker-compose up -d --buildto rebuild your container, then create your API key. This enables the REST API endpoints required by the MCP server.
Method 1: Smart Installation (Recommended)
# Direct installation with smart auto-detection
N8N_API_URL="https://your-n8n-instance.com" \
N8N_API_KEY="your-api-key" \
npx @lexinet/n8n-mcp-modern install
# Alternative: Install globally first, then configure
npm install -g @lexinet/n8n-mcp-modern
N8N_API_URL="https://your-n8n-instance.com" \
N8N_API_KEY="your-api-key" \
n8n-mcp installThe smart installer automatically:
- ✅ Project Detection: Uses
--scope projectwhen in a project directory with.mcp.jsonorpackage.json - ✅ Global Fallback: Uses
--scope localwhen no project context detected - ✅ Team Sharing: Creates
.mcp.jsonfor version control when project-scoped
📚 Enhanced Agent Capabilities
Agents with MCP Integration:
The 7-agent system leverages Context7 and Sequential Thinking MCPs when available:
n8n-workflow-architect- Master coordinator with sequential thinking for complex orchestrationn8n-developer-specialist- Current API/library docs for code generationn8n-integration-specialist- Up-to-date auth docs across 525+ platformsn8n-guidance-specialist- Current documentation and tutorialsn8n-node-specialist- AI/ML library docs and community packagesn8n-javascript-specialist- Current Node.js and JavaScript library documentationn8n-performance-specialist- Real-time metrics and optimization patterns
What Enhanced MCPs Enable:
- ✅ Real-time API Documentation - Current docs instead of outdated knowledge
- ✅ Enhanced Code Generation - Better templates with current API patterns
- ✅ Up-to-Date Auth Patterns - Live documentation for 525+ integrations
- ✅ Current Best Practices - Always-current Node.js and library standards
- ✅ Sequential Problem Solving - Break down complex tasks systematically
Method 2: Manual Installation
# Project-scoped (recommended for development projects)
claude mcp add n8n-mcp-modern --scope project \
--env N8N_API_URL="https://your-n8n-instance.com" \
--env N8N_API_KEY="your-api-key" \
-- npx -y @lexinet/n8n-mcp-modern
# Global installation
claude mcp add n8n-mcp-modern --scope local \
--env N8N_API_URL="https://your-n8n-instance.com" \
--env N8N_API_KEY="your-api-key" \
-- npx -y @lexinet/n8n-mcp-modern⚠️ Important: For full n8n workflow automation capabilities, you MUST provide your n8n API credentials via environment variables as shown above.
🔄 Upgrading
Smart Install/Upgrade (Recommended)
# Same command for both fresh installs and upgrades!
N8N_API_URL="https://your-n8n-instance.com" \
N8N_API_KEY="your-api-key" \
npx @lexinet/n8n-mcp-modern install✅ Auto-detects existing installations and preserves configuration
✅ Updates all 7 agents to latest capabilities
✅ Preserves your environment variables and settings
✅ Smart routing for all 100 tools
Manual Upgrade (Fallback)
claude mcp remove n8n-mcp-modern
claude mcp add n8n-mcp-modern \
--env N8N_API_URL="https://your-n8n-instance.com" \
--env N8N_API_KEY="your-api-key" \
-- npx -y @lexinet/n8n-mcp-modernAlternative: Direct Claude MCP Integration
# For immediate use without smart installer
claud mcp add n8n-mcp-modern \
--env N8N_API_URL="https://your-n8n-instance.com" \
--env N8N_API_KEY="your-api-key" \
-- npx -y @lexinet/n8n-mcp-modernDevelopment
# Setup
git clone https://github.com/eekfonky/n8n-mcp-modern.git
cd n8n-mcp-modern
npm install
# Development
npm run dev # Watch mode
npm run build # Production build
npm run test # Run tests
npm run lint # Type checking
npm run rebuild-db # Rebuild node database🤖 Claude Code Agent System
7 Specialized Claude Code Agents for n8n Automation:
This package includes Claude Code agents that work with the MCP server:
TIER 1: MASTER ORCHESTRATOR
├─ n8n-workflow-architect - Strategic planning & coordination
TIER 2: CORE DOMAIN SPECIALISTS
├─ n8n-developer-specialist - Code generation, templates, DevOps workflows
├─ n8n-integration-specialist - Authentication & connectivity
├─ n8n-node-specialist - 525+ node expertise + AI/ML patterns
├─ n8n-javascript-specialist - Code node validation & optimization
└─ n8n-performance-specialist - Monitoring, optimization, analytics
TIER 3: SUPPORT SPECIALIST
└─ n8n-guidance-specialist - Documentation, support & admin (merged)Installation: Agents automatically install to .claude/agents/ in your project for Claude Code integration.
🏗️ Architecture
Clean Separation of Concerns:
- 🔧 MCP Server (
@lexinet/n8n-mcp-modern): Provides 100 n8n-specific tools - 🤖 Claude Code Agents (
agents/*.md): 7 specialized agents using MCP tools - ⚡ User Experience: Claude Code Task tool → Agent → MCP tools → n8n API
This architecture leverages Claude Code's built-in agent system while providing deep n8n integration through MCP tools.
🛠️ 100 MCP Tools
🔧 Code Generation (12 tools):
generate_workflow_from_description- Natural language → n8n workflowcreate_api_integration_template- API integration scaffoldingbuild_data_processing_pipeline- Data transformation workflowsgenerate_notification_workflow- Alert & notification systemscreate_webhook_handler- Webhook processing automation- Plus 7 more advanced code generation tools
🛠️ DevOps Integration (10 tools):
integrate_with_git- Git repository integrationsetup_cicd_pipeline- CI/CD automationcreate_deployment_automation- Multi-environment deploymentgenerate_code_quality_checks- Quality assurance automationsetup_environment_management- Configuration management- Plus 5 more DevOps workflow tools
📊 Performance & Observability (12 tools):
analyze_workflow_performance- Deep performance analysismonitor_system_metrics- Real-time system monitoringgenerate_optimization_recommendations- AI-powered optimizationsetup_alert_configuration- Intelligent alertingperform_capacity_planning- Scaling & resource forecasting- Plus 7 more monitoring & analytics tools
📚 Comprehensive n8n (58 tools):
- Core Discovery (8): Node search, documentation, database stats
- Validation Engine (6): Schema validation, workflow verification
- Credential Management (14): OAuth, API keys, authentication
- User Management (8): Permissions, admin functions
- System Management (10): Health checks, status monitoring
- Workflow Management (12): Advanced workflow operations
🎯 Original Tools (11):
- Basic workflow CRUD, execution monitoring, agent routing
🔧 Configuration
Environment Variables
# Core MCP Settings
MCP_MODE=stdio # Optimized for Claude Code
LOG_LEVEL=info # Minimal logging
DISABLE_CONSOLE_OUTPUT=false
# n8n API Integration (Optional)
N8N_API_URL=https://your-n8n-instance.com
N8N_API_KEY=your-api-key
# Performance Optimization
ENABLE_CACHE=true
CACHE_TTL=3600
MAX_CONCURRENT_REQUESTS=10Getting n8n API Credentials
To use the full functionality, you need to obtain API credentials from your n8n instance:
n8n Cloud Users:
- Go to your n8n dashboard → Settings → API
- Generate a new API key
- Use your cloud URL:
https://your-workspace.app.n8n.cloud
Self-hosted n8n:
- Enable API in your n8n settings
- Generate an API key in Settings → API
- Use your instance URL:
https://your-domain.com
Add to Claude MCP:
claude mcp add n8n-mcp-modern \ --env N8N_API_URL="https://your-n8n-instance.com" \ --env N8N_API_KEY="your-api-key" \ -- npx -y @lexinet/n8n-mcp-modern
URL Auto-Normalization
The package automatically handles URL formatting:
- ✅
https://n8n.example.com→https://n8n.example.com/api/v1 - ✅
https://n8n.example.com/→https://n8n.example.com/api/v1 - ✅
https://n8n.example.com/api→https://n8n.example.com/api/v1
📊 Migration from Legacy
From n8n-mcp-enhanced v3.x:
- Same MCP Interface - All 100 tools work identically
- Agent System Preserved - Same hierarchical structure
- Performance Gains - 10x faster, 95% smaller
- Zero Breaking Changes - Drop-in replacement
Migration Command:
# Remove old version
claude mcp remove n8n-mcp-enhanced
# Add modern version
claude mcp add n8n-mcp-modern -- npx -y @lexinet/n8n-mcp-modern🧪 Testing
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report
npm run typecheck # Type validation🤝 Contributing
Modern Development Standards:
- TypeScript-first with strict mode
- ESM-only architecture
- Zod validation schemas
- Comprehensive test coverage
- Security-first approach
🎯 Claude Code Hooks System
Project-Specific Quality Enforcement:
- Agent Routing Validation - Ensures queries go to appropriate n8n specialists
- File Protection - Prevents accidental modification of critical files (package.json, .env, .git/)
- Bash Command Security - Validates commands for security and performance best practices
- Auto Code Formatting - Prettier + comprehensive validation for TS/JS/JSON/MD/YAML
- Context Injection - Automatically provides relevant n8n project context
- Completion Validation - Ensures TypeScript compiles, tests pass, linting passes before task completion
File Type Coverage:
- TypeScript/JavaScript - Type safety, security patterns, performance optimization
- JSON - n8n node validation (displayName, properties, inputs/outputs)
- Markdown - Agent frontmatter validation, code block language tags
- YAML - Docker Compose, configuration validation, syntax checking
All hooks stored in .claude/hooks/ for project isolation. See .claude/hooks/README.md for details.
🔧 Troubleshooting
Common Installation Issues
Issue: MCP server hangs during installation
# v4.6.11 includes 30-second timeout protection
# If hanging occurs, use diagnostic tools:
validate_mcp_config {"fix_issues": true}Issue: "Connection refused" or API errors
# Validate your n8n configuration:
validate_mcp_config
# Check Node.js version (requires 22+):
node --version
# Verify n8n API endpoint is accessible:
curl -H "Authorization: Bearer YOUR_KEY" YOUR_N8N_URL/api/v1/workflowsIssue: Tools not working properly
# List all available tools and their status:
list_available_tools
# Check specific category:
list_available_tools {"category": "core"}Issue: TypeScript compilation errors
# All TypeScript issues were fixed in v4.6.11
npm run typecheck # Should show zero errors
npm run lint # Should show zero warningsEnvironment Variable Setup
# Required for full functionality:
export N8N_API_URL="https://your-n8n-instance.com"
export N8N_API_KEY="your-api-key"
# Optional performance tuning:
export LOG_LEVEL="info" # debug, info, warn, error
export ENABLE_CACHE="true" # Caches API responses
export MAX_CONCURRENT_REQUESTS="10" # API rate limitingDocker Users (Self-Hosted n8n)
Complete Production Docker Compose Setup:
For production self-hosted n8n with full community node support and MCP compatibility, use this complete docker-compose.yml configuration:
services:
traefik:
image: "traefik"
restart: always
command:
- "--api=true"
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
volumes:
- traefik_data:/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "127.0.0.1:5678:5678"
labels:
- traefik.enable=true
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
- traefik.http.routers.n8n.tls=true
- traefik.http.routers.n8n.entrypoints=web,websecure
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
- traefik.http.middlewares.n8n.headers.STSPreload=true
- traefik.http.routers.n8n.middlewares=n8n@docker
environment:
# Core n8n Settings
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
# API Configuration (REQUIRED for MCP)
- N8N_API_ENDPOINT_REST=api/v1
- N8N_PUBLIC_API_ENABLED=true
- N8N_PUBLIC_API_SWAGGERUI_DISABLED=false
# Community Nodes (REQUIRED for community node discovery)
- N8N_COMMUNITY_PACKAGES_ENABLED=true
- N8N_VERIFIED_PACKAGES_ENABLED=true
- N8N_UNVERIFIED_PACKAGES_ENABLED=true
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
# Additional API Features
- N8N_METRICS=true
volumes:
- n8n_data:/home/node/.n8n
- /local-files:/files
watchtower:
image: containrrr/watchtower
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
volumes:
traefik_data:
external: true
n8n_data:
external: trueEnvironment File (.env):
Create a .env file in the same directory as your docker-compose.yml:
# Domain Configuration
DOMAIN_NAME=yourdomain.com
SUBDOMAIN=n8n
[email protected]
# Timezone
GENERIC_TIMEZONE=Europe/BerlinCritical Environment Variables Explained:
- ✅
N8N_PUBLIC_API_ENABLED=true- Enables the REST API required by MCP - ✅
N8N_COMMUNITY_PACKAGES_ENABLED=true- Enables community node functionality - ✅
N8N_VERIFIED_PACKAGES_ENABLED=true- Allows verified community packages - ✅
N8N_UNVERIFIED_PACKAGES_ENABLED=true- Allows unverified community packages - ✅
N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true- Enables community package tools - ✅
N8N_METRICS=true- Enables metrics endpoint for monitoring - ✅
N8N_PUBLIC_API_SWAGGERUI_DISABLED=false- Enables API documentation UI
Deployment Steps:
- Save the docker-compose.yml and .env files
- Create external volumes:
docker volume create traefik_data && docker volume create n8n_data - Deploy:
docker-compose up -d - Wait for services to start and SSL certificates to generate
- Access n8n at
https://your-subdomain.your-domain.com - Create your API key in Settings → API
- Configure the MCP with your API credentials
Without Traefik (Simple Setup):
For development or simple setups without SSL, use this minimal configuration:
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_HOST=localhost
- N8N_PORT=5678
- N8N_PROTOCOL=http
- N8N_API_ENDPOINT_REST=api/v1
- N8N_PUBLIC_API_ENABLED=true
- N8N_COMMUNITY_PACKAGES_ENABLED=true
- N8N_VERIFIED_PACKAGES_ENABLED=true
- N8N_UNVERIFIED_PACKAGES_ENABLED=true
- N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
- N8N_METRICS=true
volumes:
- n8n_data:/home/node/.n8n
volumes:
n8n_data:Then rebuild: docker-compose up -d --build
📄 License
MIT License - see LICENSE file for details.
🏆 Credits
Modern TypeScript rebuild by eekfonky.
Evolution: From legacy prototype → Modern, secure, performant MCP server.
Built for Claude Code users who demand modern, secure, high-performance n8n automation. 🎯
