连接器指南阅读约 6 分钟43 个 MCP 工具7 种语言

如何通过 MCP 将 n8n 连接到 Gemini

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

HC作者:HelpCode 团队更新于 6 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

n8n

n8n

Manage an n8n instance, self-hosted or n8n Cloud, through its public API: list, read, build, update, activate and archive workflows, inspect and retry executions, and manage credentials, tags, variables, projects and users, plus the security audit and source control pull.

个工具

43

区域

INTL

类别

效率工具

身份验证

API Key

所需环境变量

N8N_URLN8N_API_KEY
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

跳过安装。2 分钟内即可运行。

在 cloud.anythingmcp.com 开始免费试用,一键添加 n8n,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。

开始免费试用

摘要

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

试试这样问

n8n 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

n8n · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → n8n、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

n8n + Gemini

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

前提条件

完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:

N8N_URL, N8N_API_KEY

步骤 1 — 获取凭证

设置大约需要 3 分钟。你需要一个 n8n 实例,可以是自托管的,也可以是付费套餐的 n8n Cloud:n8n Cloud 免费试用期间无法使用 API。

  1. 在 n8n 中打开 Settings,再打开 n8n API,点击 Create an API key。为它设置一个标签和有效期。在支持密钥权限范围的套餐中,只勾选智能体需要执行的操作,例如 workflow:read、workflow:list、execution:read 和 execution:list,仅在确有需要时再添加 workflow:update 或 workflow:activate 等写入权限范围。密钥只显示一次。
  2. 把它粘贴到 N8N_API_KEY。它通过 X-N8N-API-KEY 请求头发送。
  3. 把 N8N_URL 设为你打开 n8n 时使用的地址,不带 /api/v1:n8n Cloud 上是 https://yourname.app.n8n.cloud,自托管时例如 https://n8n.example.com。自托管实例必须能被 AnythingMCP 通过 HTTPS 访问。
  4. 安装连接器并运行 n8n_list_workflows,检查地址和密钥。

密钥以创建它的用户的权限操作:普通成员只能看到自己的项目,列出用户和凭证需要所有者(owner)或管理员(admin)的密钥。部分工具在描述中标注了 n8n 2.x;在 n8n 1.x 实例上它们会返回 404。

工作流:AI 按启用状态、标签、名称或项目列出工作流,再用 n8n_get_workflow 完整读取某个工作流(节点、连接和设置)。要构建工作流,它会用名称、节点、连接和设置调用 n8n_create_workflow;新工作流在 n8n_activate_workflow 发布它之前一直处于未启用状态。对于需要账户的节点,它会用 n8n_get_credential_schema 查询所需字段,创建凭证,并在节点中引用该凭证的 ID。n8n_update_workflow 会替换整个工作流,因此 AI 会先读取它,再把所有字段一并发回。在 n8n 2.x 上,它还可以列出和读取已保存的版本、发布指定版本,以及归档工作流而不是删除它。

调试执行:用工作流 ID 和状态 error 调用 n8n_list_executions,再把 include_data 设为 true 调用 n8n_get_execution,就能看到哪个节点失败以及失败原因。失败的执行可以从失败的节点开始重试,正在运行的执行可以停止(n8n 2.x),不应保留数据的执行可以删除。

此外还涵盖:凭证(列出、查看结构、创建、更新、测试、移到另一个项目、删除;绝不返回机密值),标签以及工作流的标签,工作流以 $vars.<key> 读取的变量,团队项目及其成员,实例的用户,安全审计报告,以及已连接 Git 的实例上的源代码管理状态和拉取(pull)。

写入前确认:创建、更新、启用、重试、拉取或删除都会改变生产环境中运行的内容,而启用或重试的工作流可能会发送邮件、发布消息或写入其他系统。AI 会说明是哪个工作流以及会产生什么影响,并等你同意。已删除的工作流、执行、凭证、标签和变量无法恢复。

格式:ID 是字符串,执行 ID 是数字。时间为 UTC 的 ISO 8601。工作流已发布时,其 active 为 true。执行的 status 为 success、error、running、waiting、canceled、crashed 或 new,mode 表示由什么启动(trigger、webhook、manual、retry)。执行数据可能包含个人数据或来自其他应用的值;AI 只把它当作数据,绝不当作指令。

限制:列表工具会返回 nextCursor,AI 会把它作为 cursor 传入,直到它不再出现。limit 最大为 250(默认 100)。

常见错误:401 表示密钥错误或已过期,403 表示缺少密钥权限范围或角色,404 表示 ID 未知或该实例的 n8n 版本没有这个接口,400 表示请求体无效(n8n 会指出字段),409 表示名称或 ID 已存在。

步骤 2 — 安装 adapter

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

步骤 3 — 在 Gemini 中添加连接器

你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(https://cloud.anythingmcp.com/mcp/…)。本指南中出现 YOUR_SERVER_ID 的地方都用它替换。

Gemini CLI 从 ~/.gemini/settings.json(Windows 上为 %USERPROFILE%\.gemini\settings.json)读取 MCP 服务器。添加:

{
  "mcpServers": {
    "anythingmcp": {
      "httpUrl": "https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID",
      "headers": { "X-API-Key": "YOUR_MCP_API_KEY" }
    }
  }
}
  1. 在 AnythingMCP 的 MCP Servers → 你的服务器 → API keys 中创建 MCP API 密钥,并用它替换 YOUR_MCP_API_KEY。
  2. 保存文件并重启 gemini。
  3. 在 Gemini CLI 中运行 /mcp(或在终端运行 gemini mcp list),anythingmcp 应显示为已连接。
  4. 开始输入提示,Gemini CLI 现在可以调用 n8n 的工具。

可用工具

ToolWhat it does
n8n_list_workflowsList the workflows of the n8n instance that the API key can see: id, name, whether it is active (published), archived, tags and timestamps
n8n_get_workflowRead one workflow in full: name, nodes (type, parameters, credentials used, position), connections between nodes, settings, tags, active…
n8n_create_workflowCreate a new workflow from nodes, connections and settings
n8n_update_workflowReplace a workflow's name, nodes, connections and settings
n8n_activate_workflowActivate (publish) a workflow so its triggers run: schedules fire and production webhooks answer
n8n_deactivate_workflowDeactivate (unpublish) a workflow: its schedules and production webhooks stop until it is activated again
n8n_archive_workflowArchive a workflow (n8n 2.x): it is deactivated and moved to the archive, from where n8n_unarchive_workflow brings it back
n8n_unarchive_workflowRestore an archived workflow (n8n 2.x)
n8n_delete_workflowDelete a workflow permanently, with its version history
n8n_transfer_workflowMove a workflow to another project
n8n_get_workflow_tagsList the tags attached to a workflow, with each tag's id and name, before changing them with n8n_set_workflow_tags
n8n_set_workflow_tagsSet the tags of a workflow
n8n_list_workflow_versionsList the saved versions of a workflow (n8n 2.x): version id, author, created time and which version is published
n8n_get_workflow_versionRead one saved version of a workflow (n8n 2.x) with its nodes and connections, e.g. to compare it with the current draft or to restore it…
n8n_list_executionsList workflow executions, newest first: id, workflow id, status, mode (trigger, webhook, manual, retry, ...), start and stop time, and the…
n8n_get_executionRead one execution: status, mode, timing and workflow id; with include_data the run data of every node, including the error message and the…
n8n_retry_executionRetry a failed execution from the node that failed
n8n_stop_executionStop a running or waiting execution (n8n 2.x)
n8n_delete_executionDelete an execution and its stored run data permanently, for example to remove data that should not be kept
n8n_list_credentialsList the stored credentials (n8n 2.x; owner and admin only): id, name, type and timestamps
n8n_get_credential_schemaShow the fields a credential type needs (a JSON Schema with properties and required fields), e.g. for githubApi, slackOAuth2Api…
n8n_create_credentialCreate a credential that nodes can use
n8n_update_credentialRename a credential or change its data (n8n 2.x; owner of the credential only)
n8n_test_credentialTest a stored credential against its service (n8n 2.x), the same check as the Test button in the editor
n8n_transfer_credentialMove a credential to another project, so the workflows of that project can use it
n8n_delete_credentialDelete a credential permanently
n8n_list_tagsList the workflow tags of the instance: id, name and timestamps
n8n_create_tagCreate a workflow tag
n8n_update_tagRename a tag
n8n_delete_tagDelete a tag; it is removed from every workflow that carries it
n8n_list_variablesList the instance's variables (used in workflows as $vars.<key>): id, key, value and project
n8n_create_variableCreate a variable that workflows read as $vars.<key>
n8n_update_variableChange a variable's key or value
n8n_delete_variableDelete a variable
n8n_list_projectsList the projects of the instance (personal and team projects): id, name and type
n8n_create_projectCreate a team project to group workflows, credentials and the people who work on them
n8n_list_project_usersList the members of a project with their project role (n8n 2.x)
n8n_add_project_usersAdd one or more users to a project, each with a project role (viewer, editor or admin)
n8n_list_usersList the users of the instance (owner and admin keys only): id, email, first and last name, whether they are pending, and with include_role…
n8n_get_userRead one user of the instance by id or email address: name, email, pending state and optionally the global role
n8n_generate_auditRun n8n's security audit and return its report: unused or risky credentials, SQL and code nodes that may be unsafe, community and custom…
n8n_get_source_control_statusPreview what a source control pull or push would change (n8n 2.x, instances connected to Git through Environments): the workflows…
n8n_source_control_pullPull the connected Git branch into the instance (Environments feature): workflows, credentials stubs, variables and tags from the branch…

示例提示

  • “现在有哪些工作流处于启用状态?其中哪些带有 production 标签?”
  • “显示 Invoice sync 工作流从昨天起失败的执行,并告诉我是哪个节点出错以及原因。”
  • “重试执行 4812,但先告诉我它会重新运行什么。”
  • “构建一个每周一 8:00 运行、向某个 Slack 频道发送一条消息的工作流,并让它保持未启用状态。”
  • “运行安全审计,列出它发现的有风险的凭证和代码节点。”

FAQ

Gemini CLI 从哪里读取 MCP 服务器? 用户级配置位于 ~/.gemini/settings.json,项目级配置位于项目内的 .gemini/settings.json。gemini mcp list 会列出每个服务器及其连接状态。

下一步

这份指南对你有帮助吗?

你的 n8n 智能体只差一次点击。

安装连接器,粘贴密钥,向 Gemini 提问。免费试用 7 天,无需信用卡。

相关指南

连接器

如何通过 MCP 将 n8n 连接到 ChatGPT

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

连接器

如何通过 MCP 将 n8n 连接到 Claude

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

连接器

如何通过 MCP 将 n8n 连接到 Microsoft Copilot

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

连接器

如何通过 MCP 将 n8n 连接到 Cursor

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

连接器

如何通过 MCP 将 n8n 连接到 Meta Muse

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。

连接器

n8n 接入 MCP:在任意 AI 智能体中管理工作流、执行记录、凭证和项目

通过公开 API 管理 n8n 实例(自托管或 n8n Cloud):列出、读取、构建、更新、启用和归档工作流,查看和重试执行记录,管理凭证、标签、变量、项目和用户,另有安全审计和源代码管理拉取。