$git clone https://github.com/leonardsellem/n8n-mcp-serverA Model Context Protocol (MCP) server that allows AI assistants to interact with n8n workflows through natural language.
| 1 | # n8n MCP Server |
| 2 | |
| 3 | [](https://badge.fury.io/js/%40leonardsellem%2Fn8n-mcp-server) |
| 4 | |
| 5 | A Model Context Protocol (MCP) server that allows AI assistants to interact with n8n workflows through natural language. |
| 6 | |
| 7 | ## Overview |
| 8 | |
| 9 | This project provides a Model Context Protocol (MCP) server that empowers AI assistants to seamlessly interact with n8n, a popular workflow automation tool. It acts as a bridge, enabling AI assistants to programmatically manage and control n8n workflows and executions using natural language commands. |
| 10 | |
| 11 | ## Installation |
| 12 | |
| 13 | ### Prerequisites |
| 14 | |
| 15 | - Node.js 20 or later |
| 16 | - n8n instance with API access enabled |
| 17 | |
| 18 | ### Install from npm |
| 19 | |
| 20 | ```bash |
| 21 | npm install -g @leonardsellem/n8n-mcp-server |
| 22 | ``` |
| 23 | |
| 24 | ### Install from source |
| 25 | |
| 26 | ```bash |
| 27 | # Clone the repository |
| 28 | git clone https://github.com/leonardsellem/n8n-mcp-server.git |
| 29 | cd n8n-mcp-server |
| 30 | |
| 31 | # Install dependencies |
| 32 | npm install |
| 33 | |
| 34 | # Build the project |
| 35 | npm run build |
| 36 | |
| 37 | # Optional: Install globally |
| 38 | npm install -g . |
| 39 | ``` |
| 40 | |
| 41 | ### Docker Installation |
| 42 | |
| 43 | You can also run the server using Docker: |
| 44 | |
| 45 | ```bash |
| 46 | # Pull the image |
| 47 | docker pull leonardsellem/n8n-mcp-server |
| 48 | |
| 49 | # Run the container with your n8n API configuration |
| 50 | docker run -e N8N_API_URL=http://your-n8n:5678/api/v1 \ |
| 51 | -e N8N_API_KEY=your_n8n_api_key \ |
| 52 | -e N8N_WEBHOOK_USERNAME=username \ |
| 53 | -e N8N_WEBHOOK_PASSWORD=password \ |
| 54 | leonardsellem/n8n-mcp-server |
| 55 | ``` |
| 56 | |
| 57 | ## Updating the Server |
| 58 | |
| 59 | How you update the server depends on how you initially installed it. |
| 60 | |
| 61 | ### 1. Installed globally via npm |
| 62 | |
| 63 | If you installed the server using `npm install -g @leonardsellem/n8n-mcp-server`: |
| 64 | |
| 65 | 1. Open your terminal or command prompt. |
| 66 | 2. Run the following command to get the latest version: |
| 67 | ```bash |
| 68 | npm install -g @leonardsellem/n8n-mcp-server@latest |
| 69 | ``` |
| 70 | 3. If the server is currently running (e.g., as a background process or service), you'll need to restart it for the changes to take effect. |
| 71 | |
| 72 | ### 2. Installed from source |
| 73 | |
| 74 | If you cloned the repository and installed from source: |
| 75 | |
| 76 | 1. Open your terminal or command prompt. |
| 77 | 2. Navigate to the directory where you cloned the project: |
| 78 | ```bash |
| 79 | cd path/to/n8n-mcp-server |
| 80 | ``` |
| 81 | 3. If you've made any local changes to the code that you want to keep, consider stashing them (optional): |
| 82 | ```bash |
| 83 | git stash |
| 84 | ``` |
| 85 | You can apply them later with `git stash pop`. |
| 86 | 4. Pull the latest changes from the repository (assuming you are on the `main` branch): |
| 87 | ```bash |
| 88 | git pull origin main |
| 89 | ``` |
| 90 | If you are on a different branch, replace `main` with your branch name. |
| 91 | 5. Install or update any changed dependencies: |
| 92 | ```bash |
| 93 | npm install |
| 94 | ``` |
| 95 | 6. Rebuild the project to include the latest updates: |
| 96 | ```bash |
| 97 | npm run build |
| 98 | ``` |
| 99 | 7. If you previously installed it globally from this source folder using `npm install -g .`, you might want to run this command again to update the global link: |
| 100 | ```bash |
| 101 | npm install -g . |
| 102 | ``` |
| 103 | 8. Restart the server. |
| 104 | * If you run the server directly using a command like `node build/index.js` in your AI assistant's MCP configuration, ensure the path is still correct. Using `npm install -g .` and then `n8n-mcp-server` as the command should keep this consistent. |
| 105 | |
| 106 | ### 3. Using Docker |
| 107 | |
| 108 | If you are running the server using Docker: |
| 109 | |
| 110 | 1. Pull the latest image from Docker Hub: |
| 111 | ```bash |
| 112 | docker pull leonardsellem/n8n-mcp-server:latest |
| 113 | ``` |
| 114 | 2. Stop and remove your old container. You'll need your container's name or ID (you can find it using `docker ps`): |
| 115 | ```bash |
| 116 | docker stop <your_container_name_or_id> |
| 117 | docker rm <your_container_name_or_id> |
| 118 | ``` |
| 119 | 3. Start a new container with the updated image. Use the same `docker run` command you used previously, including all your necessary environment variables (refer to the "Docker Installation" section for an example command). For instance: |
| 120 | ```bash |
| 121 | docker run -e N8N_API_URL=http://your-n8n:5678/api/v1 \ |
| 122 | -e N8N_API_KEY=your_n8n_api |