Loading...
Loading...
Expert MCP (Model Context Protocol) orchestration with n8n workflow automation. Master bidirectional MCP integration, expose n8n workflows as AI agent tools, consume MCP servers in workflows, build agentic systems, orchestrate multi-agent workflows, and create production-ready AI-powered automation pipelines with Claude Code integration.
npx skill4agent add manutej/crush-mcp-server n8n-mcp-orchestrator┌─────────────────────────────────────────────────────────────────┐
│ Claude Code / Claude Desktop │
│ │
│ Agent decides to use tool: │
│ "I need to create a support ticket for this bug" │
└─────────────────────────────────────────────────────────────────┘
│
↓ MCP Tool Invocation
┌─────────────────────────────────────────────────────────────────┐
│ n8n Workflow (MCP Server) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ MCP Server Trigger │ │
│ │ Tool: "create_support_ticket" │ │
│ │ Receives: {title, description, priority} │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ HTTP Request: Call Jira API │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Slack Notification: Notify team │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Respond to MCP: Return ticket ID │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
↓ MCP Response
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code │
│ │
│ Receives: {ticketId: "JIRA-12345", status: "created"} │
│ Continues conversation with user │
└─────────────────────────────────────────────────────────────────┘{
"toolName": "create_support_ticket",
"description": "Create a support ticket in Jira with automatic team notification",
"parameters": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Brief ticket title"
},
"description": {
"type": "string",
"description": "Detailed problem description"
},
"priority": {
"type": "string",
"enum": ["low", "medium", "high", "critical"],
"description": "Ticket priority level"
},
"component": {
"type": "string",
"description": "System component affected"
}
},
"required": ["title", "description"]
}
}{
"success": true,
"ticketId": "JIRA-12345",
"url": "https://company.atlassian.net/browse/JIRA-12345",
"assignee": "john.doe@company.com",
"createdAt": "2025-10-20T10:30:00Z"
}{
"authenticationType": "apiKey",
"apiKeyHeader": "X-API-Key",
"requiredScopes": ["workflows:execute"]
}{
"authenticationType": "oauth2",
"authorizationUrl": "https://auth.company.com/oauth/authorize",
"tokenUrl": "https://auth.company.com/oauth/token",
"scopes": ["workflows:read", "workflows:execute"]
}{
"authenticationType": "none"
}┌─────────────────────────────────────────────────────────────────┐
│ n8n Workflow │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Schedule Trigger: Every day at 9am │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │ │
│ ↓ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ MCP Client Tool │ │
│ │ Server: "analytics-mcp-server" │ │
│ │ Tool: "generate_daily_report" │ │
│ │ Params: {date: "today"} │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
↓ MCP Request
┌─────────────────────────────────────────────────────────────────┐
│ External MCP Server │
│ (Analytics Service) │
│ │
│ Processes request, generates report, returns data │
└─────────────────────────────────────────────────────────────────┘
│
↓ MCP Response
┌─────────────────────────────────────────────────────────────────┐
│ n8n Workflow (continued) │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ Email: Send report to stakeholders │ │
│ └──────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘{
"serverUrl": "https://mcp.analytics-service.com",
"authentication": {
"type": "apiKey",
"apiKey": "{{$credentials.analyticsApiKey}}"
},
"tool": "generate_daily_report",
"parameters": {
"date": "{{DateTime.now().toISODate()}}",
"metrics": ["revenue", "users", "engagement"],
"format": "json"
},
"timeout": 60000
}{
"tools": [
{
"name": "generate_daily_report",
"description": "Generate daily analytics report",
"parameters": {
"type": "object",
"properties": {
"date": {"type": "string"},
"metrics": {"type": "array"},
"format": {"type": "string"}
}
}
},
{
"name": "query_metrics",
"description": "Query specific metrics",
"parameters": {
"type": "object",
"properties": {
"metric": {"type": "string"},
"startDate": {"type": "string"},
"endDate": {"type": "string"}
}
}
}
]
}Workflow: "create_task"
┌──────────────────────────────────────┐
│ MCP Server Trigger │
│ Tool: create_task │
│ Params: title, description, due_date │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ HTTP Request: POST to Todoist API │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ Return: Task created confirmation │
└──────────────────────────────────────┘https://your-n8n-instance.com/mcpmcp_config.json{
"mcpServers": {
"n8n-workflows": {
"url": "https://your-n8n-instance.com/mcp",
"apiKey": "your-n8n-api-key",
"description": "n8n workflow automation tools",
"tools": [
"create_task",
"send_email",
"create_support_ticket",
"generate_report"
]
}
}
}User: "Create a task to review the PR tomorrow at 2pm"
Claude Code:
- Recognizes create_task tool from n8n
- Invokes: create_task(
title="Review PR",
description="Code review for authentication feature",
due_date="2025-10-21T14:00:00Z"
)
- n8n workflow executes
- Returns task confirmation
- Claude responds: "Task created in Todoist: Review PR (tomorrow at 2pm)"Claude Code → MCP Tool Call → n8n MCP Server → Workflow executesn8n Workflow → MCP Client Tool → Claude API → AI processing → Response1. User asks Claude to analyze sales data
2. Claude calls n8n tool: get_sales_data()
3. n8n retrieves data from database
4. Claude analyzes data
5. Claude calls n8n tool: generate_report(analysis)
6. n8n creates PDF report and emails stakeholders
7. Claude confirms completion to user┌─────────────────────────────────────────────────────────────────┐
│ User: "Customer reports login issue" │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code (Agent) │
│ 1. Calls: create_support_ticket(issue_type="login") │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ n8n Workflow 1: Create Ticket │
│ - Create Jira ticket │
│ - Notify support team in Slack │
│ - Return ticket ID │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code (Agent) │
│ 2. Calls: search_knowledge_base(query="login issues") │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ n8n Workflow 2: Knowledge Search │
│ - Query internal docs │
│ - Search past tickets │
│ - Return relevant solutions │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code (Agent) │
│ 3. Analyzes solutions │
│ 4. Calls: update_ticket(id, suggested_solution) │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ n8n Workflow 3: Update Ticket │
│ - Update Jira with solution │
│ - Auto-assign to engineer if complex │
│ - Send email to customer with workaround │
└─────────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────────┐
│ Orchestrator Agent (Claude Code) │
│ "Create a blog post about our new feature" │
└─────────────────────────────────────────────────────────────────┘
│
┌─────────────────┼─────────────────┐
↓ ↓ ↓
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Research │ │ Writing │ │ SEO │
│ Agent │ │ Agent │ │ Agent │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
↓ MCP ↓ MCP ↓ MCP
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ n8n: Gather │ │ n8n: Generate│ │ n8n: Optimize│
│ data │ │ content │ │ for search │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
└─────────────────┼─────────────────┘
↓
┌─────────────────────────────────────────────────────────────────┐
│ n8n: Publishing Workflow │
│ - Format content │
│ - Upload images to CDN │
│ - Publish to CMS │
│ - Share on social media │
│ - Notify marketing team │
└─────────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────────┐
│ n8n: Monitoring Workflow (runs every 5 minutes) │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 1. Check system health metrics │ │
│ │ 2. If anomaly detected → Trigger MCP call to Claude │ │
│ └─────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
↓ Anomaly detected
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code (Remediation Agent) │
│ 1. Analyze metrics and logs │
│ 2. Determine root cause │
│ 3. Call: execute_remediation(action) │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ n8n: Remediation Workflow │
│ - Restart service if needed │
│ - Scale resources │
│ - Clear cache │
│ - Create incident ticket │
│ - Alert on-call engineer │
│ - Return results │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code │
│ - Verify remediation successful │
│ - Document incident │
│ - Call: update_incident_log() │
└─────────────────────────────────────────────────────────────────┘// Claude Code orchestrates sequence
async function processCustomerOrder(orderId) {
// Step 1: Get order details
const order = await mcpCall('n8n', 'get_order', { orderId });
// Step 2: Validate inventory
const inventory = await mcpCall('n8n', 'check_inventory', {
items: order.items
});
if (!inventory.available) {
// Step 3a: Order out of stock items
await mcpCall('n8n', 'create_purchase_order', {
items: inventory.missing
});
// Step 3b: Notify customer of delay
await mcpCall('n8n', 'send_email', {
to: order.customerEmail,
template: 'order_delayed',
data: { estimatedDate: inventory.restockDate }
});
} else {
// Step 3: Process payment
const payment = await mcpCall('n8n', 'process_payment', {
orderId,
amount: order.total
});
// Step 4: Create shipment
await mcpCall('n8n', 'create_shipment', {
orderId,
address: order.shippingAddress
});
// Step 5: Send confirmation
await mcpCall('n8n', 'send_email', {
to: order.customerEmail,
template: 'order_confirmed',
data: { trackingNumber: payment.trackingNumber }
});
}
}// Claude Code executes in parallel
async function enrichCustomerProfile(customerId) {
const [
orders,
supportTickets,
socialData,
emailEngagement
] = await Promise.all([
mcpCall('n8n', 'get_customer_orders', { customerId }),
mcpCall('n8n', 'get_support_history', { customerId }),
mcpCall('n8n', 'get_social_data', { customerId }),
mcpCall('n8n', 'get_email_metrics', { customerId })
]);
// Combine all data
const profile = {
totalSpent: orders.reduce((sum, o) => sum + o.total, 0),
supportIssues: supportTickets.length,
sentimentScore: socialData.sentiment,
emailEngagement: emailEngagement.averageClickRate
};
// Update CRM
await mcpCall('n8n', 'update_crm', {
customerId,
profile
});
}{
"resources": [
{
"uri": "resource://api-docs/authentication",
"name": "Authentication API Docs",
"description": "Complete authentication API documentation",
"mimeType": "text/markdown",
"content": "# Authentication API\n\n## Endpoints\n\n### POST /auth/login..."
},
{
"uri": "resource://api-docs/users",
"name": "Users API Docs",
"description": "User management API documentation",
"mimeType": "text/markdown",
"content": "# Users API\n\n## Endpoints\n\n### GET /users..."
}
]
}┌──────────────────────────────────────┐
│ MCP Server Trigger │
│ Resource: api-docs/* │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ Switch: Route by resource URI │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ HTTP Request: Fetch from docs repo │
└──────────────────────────────────────┘
↓
┌──────────────────────────────────────┐
│ Format and return markdown │
└──────────────────────────────────────┘User: "How do I authenticate with the API?"
Claude Code:
1. Reads resource: resource://api-docs/authentication
2. Analyzes documentation
3. Provides answer with code examples# docker-compose.yml
version: '3.8'
services:
n8n:
image: n8nio/n8n:latest
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=${N8N_PASSWORD}
- N8N_MCP_ENABLED=true
- N8N_MCP_PORT=8080
volumes:
- n8n_data:/home/node/.n8n
restart: unless-stopped
volumes:
n8n_data:# n8n-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: n8n-mcp-server
spec:
replicas: 3
selector:
matchLabels:
app: n8n
template:
metadata:
labels:
app: n8n
spec:
containers:
- name: n8n
image: n8nio/n8n:latest
ports:
- containerPort: 5678
name: http
- containerPort: 8080
name: mcp
env:
- name: N8N_MCP_ENABLED
value: "true"
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "1Gi"
cpu: "1000m"{
"mcp": {
"authentication": {
"type": "oauth2",
"provider": "okta",
"clientId": "${OAUTH_CLIENT_ID}",
"clientSecret": "${OAUTH_CLIENT_SECRET}",
"authorizationUrl": "https://company.okta.com/oauth2/v1/authorize",
"tokenUrl": "https://company.okta.com/oauth2/v1/token"
}
}
}{
"mcp": {
"rateLimiting": {
"enabled": true,
"maxRequests": 100,
"windowMs": 60000,
"message": "Too many requests, please try again later"
}
}
}{
"mcp": {
"ipWhitelist": [
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.1.100"
]
}
}# nginx.conf
server {
listen 443 ssl http2;
server_name mcp.company.com;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
location / {
proxy_pass http://n8n:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}// Add to n8n workflow
{
"nodes": [
{
"name": "Log MCP Request",
"type": "n8n-nodes-base.function",
"parameters": {
"functionCode": `
const mcpRequest = $input.item.json;
console.log('MCP Tool Invoked:', {
tool: mcpRequest.tool,
parameters: mcpRequest.parameters,
timestamp: new Date().toISOString(),
clientId: mcpRequest.clientId
});
return { json: mcpRequest };
`
}
}
]
}// MCP error response format
{
"error": {
"code": "INVALID_PARAMETERS",
"message": "Missing required parameter: customerId",
"details": {
"parameter": "customerId",
"expected": "string",
"received": "undefined"
}
}
}# Prometheus metrics for n8n MCP
metrics:
- mcp_tool_invocations_total
- mcp_tool_execution_duration_seconds
- mcp_tool_errors_total
- mcp_active_connections
- mcp_requests_per_second┌─────────────────────────────────────────────────────────────────┐
│ External System (e.g., Stripe) │
│ Event: payment_succeeded │
└─────────────────────────────────────────────────────────────────┘
│
↓ Webhook
┌─────────────────────────────────────────────────────────────────┐
│ n8n: Webhook Trigger │
│ 1. Receive payment event │
│ 2. Call MCP: analyze_payment_risk() │
└─────────────────────────────────────────────────────────────────┘
│
↓ MCP Call
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code (Risk Analysis Agent) │
│ - Analyze transaction pattern │
│ - Check customer history │
│ - Assess fraud risk │
│ - Return risk score │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ n8n: Risk-Based Routing │
│ IF risk_score > 0.7: │
│ - Flag for manual review │
│ - Notify fraud team │
│ ELSE: │
│ - Auto-approve │
│ - Trigger fulfillment │
└─────────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────────┐
│ Claude Code: Draft email response │
└─────────────────────────────────────────────────────────────────┘
│
↓ Call MCP tool
┌─────────────────────────────────────────────────────────────────┐
│ n8n: request_human_approval(draft) │
│ 1. Send draft to manager via Slack │
│ 2. Wait for approval (webhook) │
│ 3. Return approval status │
└─────────────────────────────────────────────────────────────────┘
│
↓ Approval received
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code: Send approved email │
│ Call: send_email(approved_draft) │
└─────────────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────────────┐
│ User uploads image to chat │
└─────────────────────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────┐
│ Claude Code: Analyze image │
│ - Extract text (OCR) │
│ - Detect objects │
│ - Identify action items │
└─────────────────────────────────────────────────────────────────┘
│
↓ For each action item
┌─────────────────────────────────────────────────────────────────┐
│ n8n MCP Tools: │
│ - create_task(item) │
│ - send_notification(team) │
│ - update_dashboard(metrics) │
└─────────────────────────────────────────────────────────────────┘{
"tool": "create_resource",
"parameters": {
"type": "string",
"data": "object"
},
"returns": {
"id": "string",
"status": "string"
}
}{
"tool": "update_resource",
"parameters": {
"id": "string",
"updates": "object"
},
"returns": {
"success": "boolean",
"resource": "object"
}
}{
"tool": "query_data",
"parameters": {
"filters": "object",
"limit": "number"
},
"returns": {
"data": "array",
"total": "number"
}
}