JD

jacob-dietle/n8n-mcp-sse

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

7 stars 9 forks 质量 62 趋势 15MIT

A Model Context Protocol (MCP) server that allows AI agents to interact with n8n workflows through natural language.

概览

A Model Context Protocol (MCP) server that allows AI agents to interact with n8n workflows through natural language. After clicking the button, Railway will prompt you to configure the necessary environment variables (see below). The Dockerfile in this repository is configured to build the n8n-mcp-server and run it with Supergateway. 2. Replace placeholder values with your actual n8n credentials. The server will be accessible via SSE on http://localhost:8080. Supergateway provides default paths /sse for the event stream and /message for posting messages. The server requires the following environment variables. When deploying to Railway using the button, you will be prompted for these. For local Docker runs, pass them using the -e flag as shown above. * N8N_API_URL: Your n8n instance API URL (e.g., https://n8n.example.com/api/v1). * N8N_API_KEY: Your n8n API Key. and treated as a secret.

README

以下为原文 README 节选,完整内容请查看原文。

One Click Deploy n8n MCP Server

A Model Context Protocol (MCP) server that allows AI agents to interact with n8n workflows through natural language.

Deployment

One-Click Deploy to Railway

Note: After clicking the button, Railway will prompt you to configure the necessary environment variables (see below).

Docker Deployment (Manual / Local Testing)

The Dockerfile in this repository is configured to build the n8n-mcp-server and run it with Supergateway.

  1. Build the Docker Image:

    docker build -t n8n-mcp-server-supergateway .
    
  2. Run the Docker Container:

    docker run --rm -it -p 8080:8080 \
      -e PORT=8080 \
      -e N8N_API_URL="YOUR_N8N_API_URL" \
      -e N8N_API_KEY="YOUR_N8N_API_KEY" \
      -e N8N_WEBHOOK_USERNAME="your_webhook_user" \
      -e N8N_WEBHOOK_PASSWORD="your_webhook_password" \
      -e DEBUG=true \
      n8n-mcp-server-supergateway
    

    Replace placeholder values with your actual n8n credentials. The server will be accessible via SSE on http://localhost:8080. Supergateway provides default paths /sse for the event stream and /message for posting messages.

Configuration

The server requires the following environment variables. When deploying to Railway using the button, you will be prompted for these. For local Docker runs, pass them using the -e flag as shown above.

  • N8N_API_URL: Your n8n instance API URL (e.g., https://n8n.example.com/api/v1). Required.
  • N8N_API_KEY: Your n8n API Key. Required and treated as a secret.
  • N8N_WEBHOOK_USERNAME: A username for basic authentication on n8n webhook nodes (if your workflows use webhook triggers secured with basic auth). Default: anyname.
  • N8N_WEBHOOK_PASSWORD: A password for basic authentication on n8n webhook nodes. Default: somepassword.
  • DEBUG: Set to true for verbose logging from the n8n-mcp-server and Supergateway, or false for production. Default: false.
  • PORT: The port the application will listen on. Railway sets this automatically. Supergateway uses this variable. The Dockerfile default is 8080.

Generating an n8n API Key

  1. Open your n8n instance in a browser.
  2. Go to Settings > API (or a similar path depending on your n8n version).
  3. Create a new API key with appropriate permissions.
  4. Copy the key.

Connecting to the Server (Client Integration)

Once the n8n-mcp-server is running (e.g., deployed on Railway or locally in Docker), it exposes an MCP interface over Server-Sent Events (SSE).

The Supergateway instance within the Docker container (as defined in Dockerfile) typically makes the MCP server available at:

  • SSE Stream: http://:/sse
  • Message Endpoint: http://:/message
在 GitHub 查看完整 README

安装

npx -y supergateway --sse http://<server_address>:<port> // Replace with your actual server URL "--outputTransport stdio --logLevel info" // Optional: for debugging Supergateway on the client
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "n8n-remote-sse": { "command": "npx", "args": [ "-y", "supergateway", "--sse", "http://<server_address>:<port>", // Replace with your actual server URL "--outputTransport", "stdio", "--logLevel", "info" // Optional: for debugging Supergateway on the client ], "env": { // Any environment variables Supergateway client might need, usually none for this mode }, "disabled": false } } }