### Local Development Setup Commands Source: https://github.com/czlonkowski/n8n-mcp/blob/main/CONTRIBUTING.md Commands to clone the repository, set up n8n docs, install dependencies, build the project, initialize the database, and start the server. ```bash git clone https://github.com/czlonkowski/n8n-mcp.git cd n8n-mcp git clone https://github.com/n8n-io/n8n-docs.git ../n8n-docs npm install npm run build npm run rebuild npm start # stdio mode for Claude Desktop npm run start:http # HTTP mode for remote access ``` -------------------------------- ### Test MCP tool for node essentials with includeExamples=true Source: https://github.com/czlonkowski/n8n-mcp/blob/main/P0-R3-TEST-PLAN.md Example of using the MCP tool to get node essentials, including examples. ```javascript get_node_essentials({nodeType: "nodes-base.webhook", includeExamples: true}) ``` -------------------------------- ### Local Development Setup for n8n-MCP Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/HTTP_DEPLOYMENT.md For local development without Docker. This involves cloning the repository, installing dependencies, building the project, configuring environment variables, and starting the HTTP server. ```bash # 1. Clone and setup git clone https://github.com/czlonkowski/n8n-mcp.git cd n8n-mcp npm install npm run build npm run rebuild # 2. Configure environment export MCP_MODE=http export AUTH_TOKEN=$(openssl rand -base64 32) export PORT=3000 # 3. Start server npm run start:http ``` -------------------------------- ### Get Documentation for n8n-MCP Tools Source: https://context7.com/czlonkowski/n8n-mcp/llms.txt Call the `tools_documentation` tool to get quick-start guides or detailed reference documentation for specific n8n-MCP tools. Omit the `topic` argument for an overview, or specify a `topic` for targeted information. Use `depth='full'` for exhaustive details. ```json { "name": "tools_documentation", "arguments": { "topic": "search_nodes", "depth": "full" } } ``` -------------------------------- ### Manual Local Setup for n8n-MCP Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md Configure and start n8n-MCP locally by setting environment variables for n8n integration, API URLs, and authentication tokens. Ensure n8n is running and an API key is available. ```bash # Set environment variables export N8N_MODE=true export MCP_MODE=http # Required for HTTP mode export N8N_API_URL=http://localhost:5678 # Your n8n instance URL export N8N_API_KEY=your-api-key-here # Your n8n API key export WEBHOOK_SECURITY_MODE=moderate # Required when N8N_API_URL is localhost or RFC1918 export MCP_AUTH_TOKEN=test-token-minimum-32-chars-long export AUTH_TOKEN=test-token-minimum-32-chars-long # Same value as MCP_AUTH_TOKEN export PORT=3001 # Start the server npm start ``` -------------------------------- ### Test MCP tool with includeExamples=true Source: https://github.com/czlonkowski/n8n-mcp/blob/main/P0-R3-TEST-PLAN.md Example of using the MCP tool to search nodes, including examples. ```javascript search_nodes({query: "webhook", includeExamples: true}) ``` -------------------------------- ### Search n8n Nodes with Examples Source: https://github.com/czlonkowski/n8n-mcp/blob/main/README.md Use this to find nodes matching a query and include example configurations. Set 'includeExamples' to true. ```javascript search_nodes({query: 'keyword', includeExamples: true}) ``` -------------------------------- ### Get Node Essentials with Examples Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/P0_IMPLEMENTATION_PLAN.md Tests the `getNodeEssentials` function to ensure it returns examples when requested. Verifies that the returned examples contain expected properties like 'url'. ```typescript describe('Enhanced Tools with Examples', () => { it('get_node_essentials should return examples when requested', async () => { const result = await getNodeEssentials('n8n-nodes-base.httpRequest', { includeExamples: true }); expect(result.examples).toBeDefined(); expect(result.examples.length).toBeGreaterThan(0); expect(result.examples[0].config).toHaveProperty('url'); }); it('search_nodes should return examples when requested', async () => { const result = await searchNodes('webhook', { includeExamples: true }); expect(result.length).toBeGreaterThan(0); expect(result[0].examples).toBeDefined(); }); it('get_node_for_task should not exist', async () => { expect(toolRegistry.has('get_node_for_task')).toBe(false); }); }); ``` -------------------------------- ### tools_documentation Source: https://context7.com/czlonkowski/n8n-mcp/llms.txt Get usage documentation for n8n-MCP tools. Returns a quick-start guide or per-tool reference documentation. Call without arguments for an overview, or supply `topic` to target a specific tool. Use `depth='full'` for exhaustive details. ```APIDOC ## tools_documentation ### Description Get usage documentation for n8n-MCP tools. Returns a quick-start guide or per-tool reference documentation. Call without arguments for an overview, or supply `topic` to target a specific tool. Use `depth='full'` for exhaustive details. ### Method MCP Tool Call ### Parameters #### Arguments - **topic** (string) - Optional - The specific tool to get documentation for. If omitted, an overview is returned. - **depth** (string) - Optional - Specifies the level of detail for the documentation. Use 'full' for exhaustive details. ### Request Example ```json { "name": "tools_documentation", "arguments": { "topic": "search_nodes", "depth": "full" } } ``` ### Response #### Success Response - **documentation** (string) - Markdown formatted documentation for the requested tool or an overview. ``` -------------------------------- ### Explicit Parameter Configuration Example Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/ANTIGRAVITY_SETUP.md Demonstrates the importance of explicitly setting all parameters, as relying on defaults can lead to runtime failures. The 'WORKS' example shows the correct explicit configuration. ```json // ❌ FAILS at runtime { "resource": "message", "operation": "post", "text": "Hello" } // ✅ WORKS - all parameters explicit { "resource": "message", "operation": "post", "select": "channel", "channelId": "C123", "text": "Hello" } ``` -------------------------------- ### Example CHANGELOG Entry for get_node_for_task Removal Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/P0_IMPLEMENTATION_PLAN.md Demonstrates how to document the removal of a tool and its replacement, including migration examples and benefits. ```markdown ## [2.15.0] - 2025-10-09 ### BREAKING CHANGES - **Removed:** `get_node_for_task` tool - **Replacement:** Use `search_nodes` with `includeExamples: true` - **Migration:** `get_node_for_task({task: "webhook"})` → `search_nodes({query: "webhook", includeExamples: true})` - **Benefit:** Access to 2,646 real templates vs 31 hardcoded tasks ``` -------------------------------- ### Install and Build n8n-MCP Locally Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/README_CLAUDE_SETUP.md Use these commands to clone the n8n-MCP repository, install dependencies, and build the project for local use. Ensure Node.js is installed. ```bash git clone https://github.com/czlonkowski/n8n-mcp.git cd n8n-mcp npm install npm run build npm run rebuild ``` -------------------------------- ### Tool Node with $fromAI Example Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/N8N_AI_WORKFLOW_BUILDER_ANALYSIS.md Example demonstrating how to set parameters for a Tool node using values dynamically retrieved by $fromAI. ```typescript { nodeId: "gmail-tool-789", changes: [ "Set sendTo to {{ $fromAI('to') }}", "Set subject to {{ $fromAI('subject') }}", "Set message to {{ $fromAI('message_html') }}" ] } ``` -------------------------------- ### Get Standard Node Details Source: https://github.com/czlonkowski/n8n-mcp/blob/main/README.md Retrieve essential node properties and examples. Set 'detail' to 'standard' and 'includeExamples' to true. ```javascript get_node({nodeType, detail: 'standard', includeExamples: true}) ``` -------------------------------- ### Install Claude Skills via Marketplace (Method 2) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/CLAUDE_CODE_SETUP.md Add the n8n-skills repository as a marketplace and then install the 'n8n-mcp-skills' plugin. This method allows browsing and selecting from available plugins. ```bash # Add as marketplace, then browse and install /plugin marketplace add czlonkowski/n8n-skills # Then browse available plugins /plugin install # Select "n8n-mcp-skills" from the list ``` -------------------------------- ### Systemd Service Setup Script Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/HTTP_DEPLOYMENT.md Shell commands to set up the n8n-mcp systemd service on Linux. This includes creating users, directories, generating secure tokens, deploying the application, and starting the service. ```bash # Create user and directories sudo useradd -r -s /bin/false n8n-mcp sudo mkdir -p /opt/n8n-mcp /etc/n8n-mcp sudo chown n8n-mcp:n8n-mcp /opt/n8n-mcp # Create secure token sudo sh -c 'openssl rand -base64 32 > /etc/n8n-mcp/auth_token' sudo chmod 600 /etc/n8n-mcp/auth_token sudo chown n8n-mcp:n8n-mcp /etc/n8n-mcp/auth_token # Deploy application sudo -u n8n-mcp git clone https://github.com/czlonkowski/n8n-mcp.git /opt/n8n-mcp cd /opt/n8n-mcp sudo -u n8n-mcp npm install --production sudo -u n8n-mcp npm run build sudo -u n8n-mcp npm run rebuild # Start service sudo systemctl daemon-reload sudo systemctl enable n8n-mcp sudo systemctl start n8n-mcp ``` -------------------------------- ### Print Webhook Setup Instructions Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/integration-testing-plan.md Prints setup instructions for the required webhook workflows to the console. It iterates through webhook configurations and displays the method, name, path, and the corresponding .env variable name. ```typescript export function printSetupInstructions(): void { console.log(` ╔════════════════════════════════════════════════════════════════╗ ║ WEBHOOK WORKFLOW SETUP REQUIRED ║ ╠════════════════════════════════════════════════════════════════╣ ║ ║ ║ Integration tests require 4 pre-activated webhook workflows: ║ ║ ║ ║ 1. Create workflows manually in n8n UI ║ ║ 2. Use the configurations shown below ║ ║ 3. ACTIVATE each workflow in n8n UI ║ ║ 4. Copy workflow IDs to .env file ║ ║ ║ ╚════════════════════════════════════════════════════════════════╝ Required workflows: `); Object.entries(WEBHOOK_WORKFLOW_CONFIGS).forEach(([method, config]) => { console.log(` ${method} Method: Name: ${config.name} Path: ${config.nodes[0].parameters.path} .env variable: N8N_TEST_WEBHOOK_${method}_ID `); }); } ``` -------------------------------- ### Enhance getNodeEssentials with Examples (TypeScript) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/P0_IMPLEMENTATION_PLAN.md Updates the `getNodeEssentials` handler to optionally include real-world configuration examples from popular templates. Requires a database query to fetch example data. ```typescript async function getNodeEssentials( nodeType: string, options?: { includeExamples?: boolean }): Promise { const node = repository.getNode(nodeType); if (!node) { return { success: false, error: `Node type "${nodeType}" not found. Use search_nodes to find available nodes.` }; } const result = { nodeType, displayName: node.displayName, description: node.description, category: node.category, // ... existing essentials fields ... }; // NEW: Add real-world examples if requested if (options?.includeExamples) { const examples = db.prepare(` SELECT parameters_json, template_name, template_views, complexity, use_cases, has_credentials, has_expressions FROM template_node_configs WHERE node_type = ? ORDER BY rank LIMIT 3 `).all(nodeType); result.examples = examples.map(ex => ({ config: JSON.parse(ex.parameters_json), source: `${ex.template_name} (${(ex.template_views / 1000).toFixed(0)}k views)`, complexity: ex.complexity, useCases: JSON.parse(ex.use_cases).slice(0, 2), hasAuth: ex.has_credentials === 1, hasExpressions: ex.has_expressions === 1 })); } return result; } ``` -------------------------------- ### Building Workflow from Scratch Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/ANTIGRAVITY_SETUP.md Example of building a workflow from scratch, involving parallel discovery, configuration, and validation steps. ```javascript // STEP 1: Discovery (parallel execution) [Silent execution] search_nodes({query: 'slack', includeExamples: true}) search_nodes({query: 'communication trigger'}) // STEP 2: Configuration (parallel execution) [Silent execution] get_node({nodeType: 'n8n-nodes-base.slack', detail: 'standard', includeExamples: true}) get_node({nodeType: 'n8n-nodes-base.webhook', detail: 'standard', includeExamples: true}) // STEP 3: Validation (parallel execution) [Silent execution] validate_node({nodeType: 'n8n-nodes-base.slack', config, mode: 'minimal'}) validate_node({nodeType: 'n8n-nodes-base.slack', config: fullConfig, mode: 'full', profile: 'runtime'}) // STEP 4: Build // Construct workflow with validated configs // ⚠️ Set ALL parameters explicitly // STEP 5: Validate [Silent execution] validate_workflow(workflowJson) // Response after all tools complete: "Created workflow: Webhook → Slack Validation: ✅ Passed" ``` -------------------------------- ### Start Services with Docker Compose Source: https://github.com/czlonkowski/n8n-mcp/blob/main/N8N_HTTP_STREAMABLE_SETUP.md Starts n8n and n8n-mcp services using docker-compose.yml. Ensure services are stopped and removed before starting to avoid conflicts. ```bash # Stop any existing containers docker stop n8n n8n-mcp && docker rm n8n n8n-mcp # Start with HTTP Streamable configuration docker-compose -f docker-compose.n8n.yml up -d # Services will be available at: # - n8n: http://localhost:5678 # - n8n-mcp: http://localhost:3000 ``` -------------------------------- ### Get Node Parameter Examples Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/N8N_AI_WORKFLOW_BUILDER_ANALYSIS.md Demonstrates how to retrieve specific parameter values from a node using different path syntaxes. Useful when workflow JSON has been trimmed. ```typescript { nodeId: "http-node-123", path: "url" } ``` ```typescript { nodeId: "http-node-123", path: "headerParameters.parameters[0].value" } ``` ```typescript { nodeId: "set-node-456", path: "options.includeOtherFields" } ``` -------------------------------- ### HTTP Request Node Configuration Example Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/N8N_AI_WORKFLOW_BUILDER_ANALYSIS.md Example of how to configure an HTTP Request node using natural language instructions for URL, method, headers, and body. ```typescript { nodeId: "http-node-123", changes: [ "Set the URL to https://api.weather.com/v1/forecast", "Set method to POST", "Add header Content-Type with value application/json", "Set body to { city: {{ $json.city }} }" ] } ``` -------------------------------- ### Example: Add Slack Notification and Connection Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/workflow-diff-examples.md This example demonstrates adding a Slack notification node and connecting it to an existing 'Process Data' node. ```json { "id": "workflow-123", "operations": [ { "type": "addNode", "node": { "name": "Send Slack Alert", "type": "n8n-nodes-base.slack", "position": [1000, 300], "parameters": { "resource": "message", "operation": "post", "channel": "#alerts", "text": "Workflow completed successfully!" } } }, { "type": "addConnection", "source": "Process Data", "target": "Send Slack Alert" } ] } ``` -------------------------------- ### Enable and Start Systemd Service Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/HTTP_DEPLOYMENT.md Commands to enable the n8n-mcp service to start on boot and to manually start it. ```bash sudo systemctl enable n8n-mcp sudo systemctl start n8n-mcp ``` -------------------------------- ### Set Node Configuration Example Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/N8N_AI_WORKFLOW_BUILDER_ANALYSIS.md Example of configuring a Set node by adding or modifying fields with static values or data from previous nodes. ```typescript { nodeId: "set-node-456", changes: [ "Add field 'status' with value 'processed'", "Add field 'timestamp' with current date", "Add field 'userId' from previous HTTP Request node" ] } ``` -------------------------------- ### Starting Docker Services Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md Command to start the n8n-MCP and Caddy services defined in your docker-compose.yml file. Ensure you have created the Caddyfile and .env file beforehand. ```bash docker compose up -d ``` -------------------------------- ### Manual Installation of Claude Skills (Method 3) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/CLAUDE_CODE_SETUP.md Manually install n8n-skills by cloning the repository, copying the skills to your Claude Code skills directory, and then reloading Claude Code. ```bash # 1. Clone the repository git clone https://github.com/czlonkowski/n8n-skills.git # 2. Copy skills to your Claude Code skills directory cp -r n8n-skills/skills/* ~/.claude/skills/ # 3. Reload Claude Code # Skills will activate automatically ``` -------------------------------- ### Install Claude Skills Plugin (Method 1) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/CLAUDE_CODE_SETUP.md Install the n8n-skills plugin directly using the provided command. This is the recommended method for adding specialized skills to Claude Code. ```bash /plugin install czlonkowski/n8n-skills ``` -------------------------------- ### Install Node.js and npx Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/HTTP_DEPLOYMENT.md If 'npx' command is not found, install Node.js version 18 or later, which includes npx. Alternatively, find the npx location and use its full path. ```bash # Install Node.js 18+ which includes npx # Or use full path: which npx # Find npx location # Use that path in Claude config ``` -------------------------------- ### Run MCP Server Commands Source: https://github.com/czlonkowski/n8n-mcp/blob/main/CLAUDE.md Commands to start the MCP server in different modes. Use 'npm start' for stdio mode and 'npm run start:http' for HTTP mode. 'npm run dev' rebuilds the database and validates, while 'npm run dev:http' runs the HTTP server with auto-reload. ```bash # Running the Server npm start # Start MCP server in stdio mode npm run start:http # Start MCP server in HTTP mode npm run dev # Build, rebuild database, and validate npm run dev:http # Run HTTP server with auto-reload ``` -------------------------------- ### Enhance get_node_essentials with Examples Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/P0_IMPLEMENTATION_PLAN.md Updates the `getNodeEssentials` function to optionally include real-world examples from popular templates. The tool definition is also updated to reflect the new `includeExamples` option. ```APIDOC ## Function: getNodeEssentials ### Description Retrieves essential information about a specific n8n node type, with an option to include real-world configuration examples. ### Parameters #### Optional Parameters - **includeExamples** (boolean) - Optional - If true, includes 2-3 real configuration examples from popular templates. Defaults to false. ### Request Example ```json { "nodeType": "n8n-nodes-base.httpRequest" } ``` ### Response #### Success Response - **nodeType** (string) - The type of the node. - **displayName** (string) - The display name of the node. - **description** (string) - The description of the node. - **category** (string) - The category the node belongs to. - **examples** (array) - An array of example configurations if `includeExamples` is true. - **config** (object) - The configuration of the example. - **source** (string) - The source template name and views. - **complexity** (number) - The complexity of the example. - **useCases** (array) - An array of use cases for the example. - **hasAuth** (boolean) - Indicates if the example requires authentication. - **hasExpressions** (boolean) - Indicates if the example uses expressions. #### Response Example (with includeExamples: true) ```json { "nodeType": "n8n-nodes-base.httpRequest", "displayName": "HTTP Request", "description": "Make requests to any HTTP(S) endpoint.", "category": "network", "examples": [ { "config": { "url": "https://example.com" }, "source": "Example GET Request (100k views)", "complexity": 1, "useCases": ["Making GET requests"], "hasAuth": false, "hasExpressions": false } ] } ``` ``` -------------------------------- ### n8n Message Post - Working Example (Explicit Parameters) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/README.md This configuration works because all necessary parameters, such as 'select' and 'channelId', are explicitly provided. ```json { "resource": "message", "operation": "post", "select": "channel", "channelId": "C123", "text": "Hello" } ``` -------------------------------- ### Basic Test Setup with Database Utilities Source: https://github.com/czlonkowski/n8n-mcp/blob/main/tests/utils/README.md Demonstrates setting up an in-memory test database, seeding nodes, and performing a basic assertion. Ensure to cleanup the database after each test. ```typescript import { createTestDatabase, seedTestNodes, dbHelpers } from '../utils/database-utils'; describe('My Test', () => { let testDb; afterEach(async () => { if (testDb) await testDb.cleanup(); }); it('should test something', async () => { // Create in-memory database testDb = await createTestDatabase(); // Seed test data await seedTestNodes(testDb.nodeRepository); // Run your tests const node = testDb.nodeRepository.getNode('nodes-base.httpRequest'); expect(node).toBeDefined(); }); }); ``` -------------------------------- ### Copying Example Environment File Source: https://github.com/czlonkowski/n8n-mcp/blob/main/tests/setup/TEST_ENV_DOCUMENTATION.md Use this command to create a `.env.test` file from a template if you encounter 'Missing required test environment variables' errors. ```bash cp .env.test.example .env.test ``` -------------------------------- ### Get Full Node Details Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/ANTIGRAVITY_SETUP.md Retrieve comprehensive information about a node, including essential properties and examples. This is the default detail level. ```javascript get_node({nodeType, detail: 'full', includeExamples: true}) ``` -------------------------------- ### Run n8n-MCP with npx Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/SELF_HOSTING.md Execute n8n-MCP directly using npx without any prior installation. This is suitable for quick local testing or setup. ```bash npx n8n-mcp ``` -------------------------------- ### HTTP Request Node - Simple URL Fetch Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/TEMPLATE_MINING_ANALYSIS.md Example configuration for an HTTP Request node making a simple GET request to a specified URL. ```json { "url": "https://api.example.com/data", "options": {} } ``` -------------------------------- ### Mock n8n API Error Scenario Source: https://github.com/czlonkowski/n8n-mcp/blob/main/tests/mocks/README.md Mock an error response for a GET request to a workflow endpoint. This example returns a 404 status with a JSON error message. ```typescript useHandlers( http.get('*/api/v1/workflows/:id', () => { return HttpResponse.json( { message: 'Not found', code: 'NOT_FOUND' }, { status: 404 } ); }) ); ``` -------------------------------- ### Mock n8n API Success Scenario Source: https://github.com/czlonkowski/n8n-mcp/blob/main/tests/mocks/README.md Mock a successful GET request for a specific workflow by ID. This example uses `workflowFactory` to generate dynamic mock data. ```typescript useHandlers( http.get('*/api/v1/workflows/:id', ({ params }) => { return HttpResponse.json({ data: workflowFactory.custom({ id: params.id as string }) }); }) ); ``` -------------------------------- ### Display Help for Fetch Command Source: https://github.com/czlonkowski/n8n-mcp/blob/main/MEMORY_TEMPLATE_UPDATE.md View all available options and usage instructions for the fetch command. ```bash npm run fetch:templates -- --help ``` -------------------------------- ### Environment File Setup (.env) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md Sets up essential environment variables for n8n-MCP, including n8n API details and authentication tokens. Ensure to generate a strong random token for MCP_AUTH_TOKEN and AUTH_TOKEN. ```bash AUTH_TOKEN=$(openssl rand -hex 32) cat > .env << EOF N8N_API_URL=https://your-n8n-instance.com N8N_API_KEY=your-n8n-api-key-here MCP_AUTH_TOKEN=$AUTH_TOKEN AUTH_TOKEN=$AUTH_TOKEN EOF ``` -------------------------------- ### AI Agent Prompt for Workflow Creation Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md Example prompt for an AI Agent node to utilize MCP tools for n8n workflow creation. It outlines the steps for searching nodes, getting details, validating, and creating workflows. ```text You are an n8n workflow expert. Use the MCP tools to: 1. Search for appropriate nodes using search_nodes 2. Get configuration details with get_node_essentials 3. Validate configurations with validate_workflow 4. Create the workflow if all validations pass ``` -------------------------------- ### Development Commands Source: https://github.com/czlonkowski/n8n-mcp/blob/main/CONTRIBUTING.md Common commands for building, testing, updating dependencies, and running the server in development mode. ```bash # Build & Test npm run build # Build TypeScript npm run rebuild # Rebuild node database npm run test-nodes # Test critical nodes npm run validate # Validate node data npm test # Run all tests # Update Dependencies npm run update:n8n:check # Check for n8n updates npm run update:n8n # Update n8n packages # Run Server npm run dev # Development with auto-reload npm run dev:http # HTTP dev mode ``` -------------------------------- ### Enhance searchNodes with Examples (TypeScript) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/P0_IMPLEMENTATION_PLAN.md Modifies the `searchNodes` handler to optionally include example configurations for each found node. This enhances search results with practical usage examples. ```typescript async function searchNodes( query: string, options?: { limit?: number; includeExamples?: boolean; }): Promise { const nodes = repository.searchNodes(query, 'OR', options?.limit || 20); const results = nodes.map(node => { const result = { nodeType: node.nodeType, displayName: node.displayName, description: node.description, category: node.category }; // NEW: Add examples if requested if (options?.includeExamples) { const examples = db.prepare(` SELECT parameters_json, template_name, complexity FROM template_node_configs WHERE node_type = ? ORDER BY rank LIMIT 2 `).all(node.nodeType); result.examples = examples.map(ex => ({ config: JSON.parse(ex.parameters_json), source: ex.template_name, complexity: ex.complexity })); } return result; }); return results; } ``` -------------------------------- ### Build and Run n8n-MCP from Source (Cloud Docker) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md This is an alternative for cloud deployments if you need to build from source. It involves cloning the repository, building a local Docker image on the cloud server, and then running it. The environment variables should be configured similarly to other Docker deployments. ```bash # Clone and build git clone https://github.com/czlonkowski/n8n-mcp.git cd n8n-mcp docker build -t n8n-mcp:latest . # Run using local image docker run -d \ --name n8n-mcp \ -p 3000:3000 \ # ... same environment variables as above n8n-mcp:latest ``` -------------------------------- ### Run Prepared Release Script Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/AUTOMATED_RELEASES.md Use this script for a guided release process. It prompts for the new version, updates relevant files, runs tests and builds, and prepares for a git commit. ```bash npm run prepare:release ``` -------------------------------- ### Load Test Environment in Setup Files Source: https://github.com/czlonkowski/n8n-mcp/blob/main/tests/setup/TEST_ENV_DOCUMENTATION.md Call loadTestEnvironment early in your setup files to initialize the test environment configuration. ```typescript import { loadTestEnvironment } from './test-env'; // Load test environment at the start of your setup loadTestEnvironment(); ``` -------------------------------- ### Strategy Pattern: Build System Prompt Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/N8N_AI_WORKFLOW_BUILDER_ANALYSIS.md Selects node-specific examples to append to the core instructions based on the node type. This allows for dynamic prompt generation tailored to different node functionalities. ```typescript buildSystemPrompt(context) { let prompt = CORE_INSTRUCTIONS; if (isSetNode) prompt += SET_NODE_EXAMPLES; else if (isIfNode) prompt += IF_NODE_EXAMPLES; else if (isToolNode) prompt += TOOL_NODE_EXAMPLES; return prompt; } ``` -------------------------------- ### Full Template Rebuild Source: https://github.com/czlonkowski/n8n-mcp/blob/main/MEMORY_TEMPLATE_UPDATE.md Execute this command to rebuild the entire database from scratch. This is recommended only for initial setup or if database corruption is suspected. ```bash # Rebuild entire database from scratch (30-40 minutes) npm run fetch:templates ``` -------------------------------- ### Update .env.example for Integration Testing Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/integration-testing-plan.md Configure environment variables for n8n API access, webhook URLs, and test-specific settings. Ensure these are set up correctly for the testing environment. ```bash # ======================================== # INTEGRATION TESTING CONFIGURATION # ======================================== # n8n API Configuration for Integration Tests N8N_API_URL=http://localhost:5678 N8N_API_KEY=your-api-key-here # Pre-activated Webhook URLs for Testing # Create these workflows manually in n8n and activate them # Store the full webhook URLs (not workflow IDs) N8N_TEST_WEBHOOK_GET_URL=https://n8n-test.n8n-mcp.com/webhook/mcp-test-get N8N_TEST_WEBHOOK_POST_URL=https://n8n-test.n8n-mcp.com/webhook/mcp-test-post N8N_TEST_WEBHOOK_PUT_URL=https://n8n-test.n8n-mcp.com/webhook/mcp-test-put N8N_TEST_WEBHOOK_DELETE_URL=https://n8n-test.n8n-mcp.com/webhook/mcp-test-delete # Test Configuration N8N_TEST_CLEANUP_ENABLED=true # Enable automatic cleanup N8N_TEST_TAG=mcp-integration-test # Tag for test workflows N8N_TEST_NAME_PREFIX=[MCP-TEST] # Name prefix for test workflows ``` -------------------------------- ### AI-Generated Metadata Example Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/TEMPLATE_MINING_ANALYSIS.md Example of structured metadata generated by AI for a template, including categories, use cases, complexity, and required services. ```json { "categories": ["automation", "integration", "data processing"], "complexity": "medium", "use_cases": [ "Extract transaction data from Gmail", "Automate bookkeeping", "Expense tracking" ], "estimated_setup_minutes": 30, "required_services": ["Gmail", "Google Sheets", "Google Gemini"], "key_features": [ "Fetch emails by label", "Extract transaction data", "Use LLM for structured output" ], "target_audience": ["Accountants", "Small business owners"] } ``` -------------------------------- ### Execute Unit Tests Source: https://github.com/czlonkowski/n8n-mcp/blob/main/P0-R3-TEST-PLAN.md Run the new unit tests for fetch-templates-extraction, search-nodes-examples, and get-node-essentials-examples. All tests are expected to pass. ```bash # Run new unit tests npm test tests/unit/scripts/fetch-templates-extraction.test.ts npm test tests/unit/mcp/search-nodes-examples.test.ts npm test tests/unit/mcp/get-node-essentials-examples.test.ts # Expected: All pass, 52 tests ``` -------------------------------- ### Build and Run n8n-MCP from Source (Docker) Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/N8N_DEPLOYMENT.md For advanced users needing custom modifications or contributing to development, this process involves cloning the repository, building a local Docker image, and then running the container using the locally built image. Replace placeholder environment variables as needed. ```bash git clone https://github.com/czlonkowski/n8n-mcp.git cd n8n-mcp # Build Docker image docker build -t n8n-mcp:latest . # Run using your local image docker run -d \ --name n8n-mcp \ -p 3000:3000 \ -e N8N_MODE=true \ -e MCP_MODE=http \ -e MCP_AUTH_TOKEN=$(openssl rand -hex 32) \ -e AUTH_TOKEN=$(openssl rand -hex 32) \ # ... other settings n8n-mcp:latest ``` -------------------------------- ### Example: Update Multiple Webhook Paths and Workflow Name Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/workflow-diff-examples.md This example shows how to update the paths of multiple webhook nodes and rename the workflow simultaneously. ```json { "id": "workflow-456", "operations": [ { "type": "updateNode", "nodeName": "Webhook 1", "changes": { "parameters.path": "v2/webhook1" } }, { "type": "updateNode", "nodeName": "Webhook 2", "changes": { "parameters.path": "v2/webhook2" } }, { "type": "updateName", "name": "API v2 Webhooks" } ] } ``` -------------------------------- ### Webhook Workflow Configuration for GET Method Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/integration-testing-plan.md Configuration for a webhook workflow designed for GET method testing. Requires manual activation in n8n UI. ```typescript /** * Guide for setting up webhook workflows manually in n8n * * These workflows must be created manually and activated because * n8n API doesn't support workflow activation. * * For each HTTP method, create a workflow with: * 1. Single Webhook node * 2. Configured for the specific HTTP method * 3. Unique webhook path * 4. Activated in n8n UI * 5. Workflow ID added to .env */ export const WEBHOOK_WORKFLOW_CONFIGS = { GET: { name: '[MCP-TEST] Webhook GET', description: 'Pre-activated webhook for GET method testing', nodes: [ { name: 'Webhook', type: 'n8n-nodes-base.webhook', typeVersion: 2, parameters: { httpMethod: 'GET', path: 'mcp-test-get', responseMode: 'lastNode' } } ] }, POST: { ``` -------------------------------- ### Local Test and Build Command Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/AUTOMATED_RELEASES.md Before releasing, test your changes locally and build the project using these commands. ```bash npm test && npm run build ``` -------------------------------- ### List and Get n8n-MCP Server Status Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/CLAUDE_CODE_SETUP.md Check the status of your n8n-MCP servers using the `list` command or get detailed information about a specific server like `n8n-mcp`. ```bash claude mcp list ``` ```bash claude mcp get n8n-mcp ``` -------------------------------- ### Rebuild Project and Database Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/README_CLAUDE_SETUP.md Run this command to rebuild the project and ensure the database is set up correctly. This can resolve issues where the server appears but tools do not function. ```bash npm run rebuild ``` -------------------------------- ### Configuring Custom Database Path Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/DOCKER_TROUBLESHOOTING.md Demonstrates the correct format for the NODE_DB_PATH environment variable, ensuring it ends with '.db'. Incorrect paths will be rejected. ```bash # Correct NODE_DB_PATH=/app/data/custom/my-nodes.db # Incorrect (will be rejected) NODE_DB_PATH=/app/data/custom/my-nodes ``` -------------------------------- ### Enhance search_nodes with Examples Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/P0_IMPLEMENTATION_PLAN.md Updates the `searchNodes` function to optionally include real-world examples for each found node. The tool definition is also updated to reflect the new `includeExamples` option. ```APIDOC ## Function: searchNodes ### Description Searches for n8n nodes by a given query string. Optionally includes real-world configuration examples for each matching node. ### Parameters #### Parameters - **query** (string) - Required - The search query string. - **limit** (number) - Optional - The maximum number of nodes to return. Defaults to 20. - **includeExamples** (boolean) - Optional - If true, includes 2 real configuration examples per node. Defaults to false. ### Request Example ```json { "query": "http", "limit": 10, "includeExamples": true } ``` ### Response #### Success Response - **nodeType** (string) - The type of the node. - **displayName** (string) - The display name of the node. - **description** (string) - The description of the node. - **category** (string) - The category the node belongs to. - **examples** (array) - An array of example configurations if `includeExamples` is true. - **config** (object) - The configuration of the example. - **source** (string) - The source template name. - **complexity** (number) - The complexity of the example. #### Response Example (with includeExamples: true) ```json [ { "nodeType": "n8n-nodes-base.httpRequest", "displayName": "HTTP Request", "description": "Make requests to any HTTP(S) endpoint.", "category": "network", "examples": [ { "config": { "url": "https://example.com" }, "source": "Example GET Request", "complexity": 1 } ] } ] ``` ``` -------------------------------- ### Execute Integration Tests Source: https://github.com/czlonkowski/n8n-mcp/blob/main/P0-R3-TEST-PLAN.md Run the new integration tests for template-node-configs and template-examples-e2e. All tests are expected to pass. ```bash # Run new integration tests npm test tests/integration/database/template-node-configs.test.ts npm test tests/integration/mcp/template-examples-e2e.test.ts # Expected: All pass, 33 tests ``` -------------------------------- ### Local Testing: Prepare NPM Package Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/AUTOMATED_RELEASES.md Execute the command to prepare the NPM package for publishing, ensuring it's optimized and ready. ```bash npm run prepare:publish ``` -------------------------------- ### Example n8n Workflow JSON Source: https://github.com/czlonkowski/n8n-mcp/blob/main/docs/local/N8N_AI_WORKFLOW_BUILDER_ANALYSIS.md A concrete example of an n8n workflow represented in JSON format. This demonstrates the structure for defining nodes, their properties, and the connections between them, such as a schedule trigger connected to an HTTP request node. ```json { "name": "Weather Workflow", "nodes": [ { "id": "abc-123", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1, "position": [240, 300], "parameters": { "rule": { "interval": [{ "field": "hours", "hoursInterval": 1 }] } } }, { "id": "def-456", "name": "HTTP Request", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [480, 300], "parameters": { "method": "GET", "url": "https://api.weather.com/forecast" } } ], "connections": { "Schedule Trigger": { "main": [[ { "node": "HTTP Request", "type": "main", "index": 0 } ]] } } } ``` -------------------------------- ### Deploy n8n.io Template to Live Instance Source: https://context7.com/czlonkowski/n8n-mcp/llms.txt Downloads a template from the n8n template library and deploys it to a live instance. It can automatically upgrade versions, apply fixes for expression format and `typeVersion` issues, and strip credentials. ```json { "name": "n8n_deploy_template", "arguments": { "templateId": 1234, "name": "My Chatbot Workflow", "autoUpgradeVersions": true, "autoFix": true, "stripCredentials": true } } // Response: // { // "workflowId": "99", // "name": "My Chatbot Workflow", // "fixesApplied": 2, // "requiredCredentials": ["openAiApi", "slackOAuth2Api"], // "message": "Template deployed successfully. Configure credentials in n8n UI." // } ```