n8n-multi-instance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorking with multiple n8n instances over MCP
通过MCP管理多个n8n实例
When the tool is available, the user has multi-instance mode on: one MCP
connection can reach several n8n instances (e.g. , , or one per client/team).
Every other n8n tool (, , ,
, , , , …) runs
against whichever instance this session is currently targeting. There is no per-call instance
argument: you change the target only by switching. Target the wrong instance and a read returns the
wrong data and a write lands in the wrong place — usually with no error (the one exception is an
ambiguous credential write, which fails closed; see below). So target deliberately.
n8n_instancesprodstagingn8n_get_workflown8n_list_workflowsn8n_update_partial_workflown8n_manage_datatablen8n_manage_credentialsn8n_executionsn8n_test_workflowIf the tool is not present, the account is single-instance: ignore this skill
and use the n8n tools directly.
n8n_instances当工具可用时,用户处于多实例模式:一个MCP连接可以访问多个n8n实例(例如、,或每个客户/团队对应一个实例)。所有其他n8n工具(、、、、、、……)都会针对当前会话所指向的实例运行。没有针对单次调用的实例参数:只能通过切换来更改目标实例。如果指向错误的实例,读取操作会返回错误数据,写入操作会落到错误的位置——通常不会报错(唯一例外是模糊凭据写入,会触发失败关闭;详情见下文)。因此请谨慎选择目标实例。
n8n_instancesprodstagingn8n_get_workflown8n_list_workflowsn8n_update_partial_workflown8n_manage_datatablen8n_manage_credentialsn8n_executionsn8n_test_workflow如果工具不可用,则该账户为单实例模式:忽略本技能,直接使用n8n工具即可。
n8n_instancesGolden rules
黄金准则
Six rules. Each prevents a class of silent misroute.
- Discover first. Call before acting so you know the instance names and which one is
n8n_instances({mode:"list"}).current - Switch by name to your target before doing work on a non-default instance:
. The match is case-insensitive.
n8n_instances({mode:"switch", name:"<instance name>"}) - Switch in its own turn. Never put a and a dependent operation in the same parallel tool-call batch. Calls in one batch have no guaranteed order, so the dependent call can be resolved against the previous instance before the switch's session state is visible. Switch, let it return, then operate.
switch - Verify before high-stakes ops. Immediately before creating/updating/deleting credentials
(and before destructive workflow edits), confirm is the instance you intend — primary check is
current. The system fail-closes only the ambiguous credential case (rule 6); an explicit switch to the wrong instance still writes there silently, so this check is on you.n8n_instances({mode:"list"}) - An unexpected is almost always a wrong-instance misroute, not a deletion. Don't recreate the object. Re-check the current instance and retry (see Recovery).
NOT_FOUND - On , switch on this session, then retry. The system is refusing to write a secret because this session never picked a target itself. Comply — run
INSTANCE_AMBIGUOUShere to confirm the instance, then retry the write. Don't work around it or retry blindly.switch
六条准则,每条都能避免一类静默路由错误。
- 先发现。在执行操作前调用,了解实例名称以及当前
n8n_instances({mode:"list"})指向的实例。current - 切换到目标实例:在非默认实例上执行操作前,调用切换到目标实例。名称匹配不区分大小写。
n8n_instances({mode:"switch", name:"<instance name>"}) - 单独执行切换。不要将操作和依赖操作放在同一个并行工具调用批次中。同一批次中的调用没有固定顺序,因此依赖操作可能在切换的会话状态生效前,就基于之前的实例执行了。先切换,等待返回结果,再执行操作。
switch - 高风险操作前验证。在创建/更新/删除凭据(以及执行破坏性工作流编辑)前,立即确认是你想要的实例——主要通过
current检查。系统仅会在模糊凭据场景(准则6)下触发失败关闭;如果明确切换到错误实例,写入操作仍会静默执行,因此需要你自行检查。n8n_instances({mode:"list"}) - 意外的NOT_FOUND几乎总是路由到错误实例导致的,而非对象被删除。不要重新创建对象。重新检查当前实例并重试(参见恢复指南)。
- 遇到错误时,在当前会话切换实例,然后重试。系统拒绝写入机密信息,因为当前会话从未自行选择目标实例。请执行切换——调用
INSTANCE_AMBIGUOUS确认实例,然后重试写入操作。不要试图绕过或盲目重试。switch
Core workflow
核心工作流
1. n8n_instances({mode:"list"}) # see available[] + current + default
2. n8n_instances({mode:"switch", name:"prod"}) # bind THIS session to "prod"
→ returns { previous, current }; confirm current.name == "prod"
3. (do your work) n8n_list_workflows / n8n_get_workflow / n8n_manage_datatable / ...
4. Before a credential write or a delete:
n8n_instances({mode:"list"}) → re-confirm current, THEN n8n_manage_credentials({action:"create", ...})To move to another instance, just again. The whole session follows the switch.
switch1. n8n_instances({mode:"list"}) # 查看available[] + current + default
2. n8n_instances({mode:"switch", name:"prod"}) # 将当前会话绑定到"prod"
→ 返回{ previous, current }; 确认current.name == "prod"
3. (执行你的操作) n8n_list_workflows / n8n_get_workflow / n8n_manage_datatable / ...
4. 在执行凭据写入或删除操作前:
n8n_instances({mode:"list"}) → 重新确认current,然后执行n8n_manage_credentials({action:"create", ...})要切换到另一个实例,只需再次调用。整个会话会跟随切换后的实例。
switchThe n8n_instances
tool
n8n_instancesn8n_instances
工具
n8n_instancesTwo modes ( is required and enum-validated):
mode- →
{mode:"list"}, no side effects.{ current, default, available }- and
currentare each one instancedefault(or{ id, name, url, isDefault }).null - is every instance, each with an extra
availableboolean. Match byisCurrent; never hard-codename.id
- →
{mode:"switch", name:"<name>"}, and binds this session to the named instance.{ previous, current }is case-insensitive.name
两种模式(为必填项,且为枚举值):
mode- → 返回
{mode:"list"},无副作用。{ current, default, available }- 和
current分别为单个实例对象default(或{ id, name, url, isDefault })。null - 包含所有实例,每个实例额外带有
available布尔值。请通过**isCurrent**匹配实例;切勿硬编码name。id
- → 返回
{mode:"switch", name:"<name>"},并将当前会话绑定到指定名称的实例。{ previous, current }不区分大小写。name
Error envelope (from the n8n_instances
tool)
n8n_instances错误信息(来自n8n_instances
工具)
n8n_instancesEvery error returns . The ones you'll actually hit:
{ error: "<CODE>", message, … }| Code | When | What to do |
|---|---|---|
| | Pick a name from the |
| | Re-call with a |
| multi-instance mode is off | There's nothing to switch; use the n8n tools directly. The user can enable it at the n8n-mcp dashboard. |
| the request has neither an MCP session id nor a credential id | A selection has nowhere to land. Reconnect / initialize a session, then switch. |
| | Use |
| server-side metadata missing | A server bug, not your input — report it. |
Instance names can never be,default,current, orlist(reserved), so you'll never see an instance literally named after a mode or field.switch
所有错误都会返回。你实际会遇到的错误如下:
{ error: "<CODE>", message, … }| 代码 | 触发场景 | 解决方法 |
|---|---|---|
| | 从错误返回的 |
| 调用 | 重新调用并传入 |
| 多实例模式已关闭 | 无需切换;直接使用n8n工具即可。用户可在n8n-mcp控制台启用多实例模式。 |
| 请求既无MCP会话ID也无凭据ID | 无法完成选择。重新连接/初始化会话,然后执行切换。 |
| | 使用 |
| 服务器端元数据缺失 | 属于服务器Bug,与你的输入无关——请上报。 |
实例名称不能为、default、current或list(这些为保留名称),因此你不会看到实例名称与模式或字段重名。switch
INSTANCE_AMBIGUOUS
(from the credential-write path, not the tool)
INSTANCE_AMBIGUOUSINSTANCE_AMBIGUOUS
(来自凭据写入流程,而非工具本身)
INSTANCE_AMBIGUOUSA separate, higher-stakes error. It is not returned by — it's returned by the
server when you call to create/update/delete a credential and the target
instance is ambiguous: this session never switched on its own but inherited a switch made elsewhere
(a fan-out / reconnect), pointing at a non-default instance. Rather than risk writing a secret to
the wrong instance, the server blocks the write (it never reaches n8n, no quota is charged) and
returns:
n8n_instancesn8n_manage_credentialsjson
{
"error": "INSTANCE_AMBIGUOUS",
"message": "… the session issuing this request never switched there itself … Re-run n8n_instances({mode:\"switch\", name:\"…\"}) on this session to confirm the target …",
"lastSelected": { "id": "…", "name": "…" },
"default": { "id": "…", "name": "…" }
}Fix: decide which instance you actually want ( is the inherited switch,
is the account default), run on this session, then
retry the write. See rule 6.
lastSelecteddefaultn8n_instances({mode:"switch", name:"…"})这是一种独立的高风险错误。它不是由返回的——而是当你调用来创建/更新/删除凭据,且目标实例不明确时,由服务器返回:当前会话从未自行切换实例,而是继承了其他地方设置的切换(例如扇出/重新连接),指向非默认实例。为避免将机密信息写入错误实例,服务器会阻止写入(请求不会到达n8n,也不会消耗配额),并返回:
n8n_instancesn8n_manage_credentialsjson
{
"error": "INSTANCE_AMBIGUOUS",
"message": "… 发起此请求的会话从未自行切换到该实例 … 请在当前会话重新调用n8n_instances({mode:\"switch\", name:\"…\"})以确认目标实例 …",
"lastSelected": { "id": "…", "name": "…" },
"default": { "id": "…", "name": "…" }
}修复方法:确定你实际想要的实例(是继承的切换目标,是账户默认实例),在当前会话调用,然后重试写入操作。参见准则6。
lastSelecteddefaultn8n_instances({mode:"switch", name:"…"})How targeting behaves (mental model)
目标实例的行为逻辑(心智模型)
- A binds this session to the chosen instance. The binding persists for the rest of the session and survives reconnects, idle, and backend deploys (~24h, the MCP session lifetime) — you should not need to re-switch before every call.
switch - Other sessions / terminals are independent: switching here does not move them.
- One session targets one instance at a time. There is no per-call instance argument; you
change the target only via .
switch - Reads and non-credential writes route to the currently-selected instance, silently — a
misroute produces wrong data or a , not an error.
NOT_FOUND - Credential writes are the one guarded case. They route the same way, except the server
fail-closes the ambiguous state (a session that never switched, recovered onto a non-default
instance) with . This is a safety net, not a substitute for rule 4: an explicit switch to the wrong instance still writes there.
INSTANCE_AMBIGUOUS - If your selected instance is deleted (the user removes it mid-session), the next call silently falls back to your default instance — no error. So default's data appearing where you expected another instance's can look like "my data vanished." Re-list to see where you are.
- 操作会绑定当前会话到所选实例。该绑定会在会话剩余时间内持续生效,即使重新连接、闲置或后端部署(MCP会话生命周期约24小时)——你无需在每次调用前重新切换。
switch - 其他会话/终端是独立的:当前会话切换实例不会影响它们。
- 一个会话同一时间只能指向一个实例。没有针对单次调用的实例参数;只能通过更改目标实例。
switch - 读取操作和非凭据写入操作会静默路由到当前选中的实例——路由错误会导致返回错误数据或NOT_FOUND,不会触发错误。
- 凭据写入是唯一受保护的场景。它们的路由方式相同,但服务器会在模糊状态下触发失败关闭(会话从未切换实例,恢复后指向非默认实例),返回错误。这只是一个安全网,不能替代准则4:如果明确切换到错误实例,写入操作仍会执行。
INSTANCE_AMBIGUOUS - 如果选中的实例被删除(用户在会话中途移除实例),下一次调用会静默回退到默认实例——不会报错。因此,当你预期看到其他实例的数据,却出现默认实例的数据时,可能会误以为“我的数据消失了”。请重新调用list查看当前指向的实例。
Recovery playbook
恢复指南
| Symptom | What it usually means | Do this |
|---|---|---|
| This session never switched itself; the system won't guess which instance to write the secret to | Run |
| You're pointed at the wrong instance — not that it was deleted | |
| A read returns empty or unfamiliar data | Wrong-instance read, or a silent fallback to | |
| The | Read the |
| This session is on a different instance than you think | |
| Repeated misroutes within one turn | You batched a | Split them: |
After any recovery switch, sanity-check with (read ) as the
primary signal. also returns the resolved instance under ,
but it can be absent on some paths (legacy/chat), so treat it as a secondary confirmation.
n8n_instances({mode:"list"})currentn8n_health_checkdetails.instanceName| 症状 | 通常原因 | 解决方法 |
|---|---|---|
凭据创建/更新/删除时返回 | 当前会话从未自行切换实例;系统无法猜测应将机密信息写入哪个实例 | 在当前会话调用 |
| 你确定存在的工作流/数据表/凭据返回NOT_FOUND | 你指向了错误的实例——不是对象被删除 | 调用 |
| 读取操作返回空数据或陌生数据 | 路由到错误实例,或所选实例被删除后静默回退到 | 调用 |
调用 | | 查看错误信息中的 |
| 当前会话指向的实例与你认为的不同 | 切换到目标实例,然后继续操作。 |
| 同一轮操作中反复出现路由错误 | 你将 | 拆分操作:单独执行 |
在任何恢复切换后,请通过(查看)进行 sanity 检查,这是主要信号。也会在下返回解析后的实例,但在某些路径(旧版/聊天)中可能缺失,因此将其视为次要确认方式。
n8n_instances({mode:"list"})currentn8n_health_checkdetails.instanceNameCredential operations (highest stakes)
凭据操作(最高风险)
Credentials hold live secrets, and a misrouted credential write puts a secret on the wrong
instance. The server protects the ambiguous case automatically — if this session never picked
a target and inherited a switch to a non-default instance, the write fails closed with
(rule 6) and never reaches n8n. But that net is narrow: a credential write on a
session that did switch goes through to whatever instance it switched to, with no second
guess. So:
INSTANCE_AMBIGUOUS- Verify immediately before
currentcreate/update/delete — calln8n_manage_credentialsin the same short sequence, not 10 steps earlier where a later switch could have moved you.n8n_instances({mode:"list"}) - On , switch on this session to confirm the target, then retry — don't work around it.
INSTANCE_AMBIGUOUS - Credential reads (/
action:"list"/"get") are not gated and don't write a secret, but a read off the wrong instance returns the wrong schema or list — so still verify"getSchema"if the result looks wrong.current - For the tool itself (CRUD shapes,
n8n_manage_credentialsdiscovery, never inlining secrets into text fields), seegetSchema.n8n-mcp-tools-expert
凭据包含实时机密信息,路由错误的凭据写入会将机密信息放到错误的实例上。服务器会自动保护模糊场景——如果当前会话从未选择目标实例,而是继承了指向非默认实例的切换,写入操作会触发错误并失败关闭(准则6),且不会到达n8n。但这个安全网的范围很窄:如果会话已经切换实例,凭据写入会直接发送到切换后的实例,不会再次确认。因此:
INSTANCE_AMBIGUOUS- 在执行创建/更新/删除操作前,立即验证
n8n_manage_credentials——在同一个短序列中调用current,不要在10步前检查,因为后续的切换可能已经更改了目标实例。n8n_instances({mode:"list"}) - 遇到错误时,在当前会话切换实例以确认目标,然后重试——不要试图绕过。
INSTANCE_AMBIGUOUS - 凭据读取操作(/
action:"list"/"get")不受限制,也不会写入机密信息,但如果路由到错误实例,会返回错误的架构或列表——因此如果结果不符合预期,仍需验证"getSchema"。current - 关于工具本身(CRUD结构、
n8n_manage_credentials发现、切勿将机密信息内联到文本字段),请参考getSchema。n8n-mcp-tools-expert
Common multi-instance task: copy something between instances
常见多实例任务:在实例间复制对象
To recreate a credential or workflow from instance A on instance B:
1. switch → A; read the source (n8n_manage_credentials get / n8n_get_workflow)
2. switch → B (its own call — never batched with the create below)
3. n8n_instances({mode:"list"}) → confirm current == B
4. create on B (n8n_manage_credentials create / n8n_create_workflow)Do each instance's steps in its own turn; never overlap with the create-on-B call
(rule 3), and switch explicitly on this session before the credential write so it isn't ambiguous
(rules 4 and 6).
switch → B要将实例A上的凭据或工作流复制到实例B:
1. 切换到实例A;读取源对象(n8n_manage_credentials get / n8n_get_workflow)
2. 切换到实例B (单独调用——切勿与后续的创建操作放在同一个批次)
3. n8n_instances({mode:"list"}) → 确认current == B
4. 在实例B上创建对象 (n8n_manage_credentials create / n8n_create_workflow)每个实例的步骤要单独执行;切勿将与在B上创建对象的操作重叠(准则3),并且在凭据写入前要在当前会话明确切换实例,避免出现模糊状态(准则4和6)。
switch → BQuick reference
快速参考
- See instances + where you are: →
n8n_instances({mode:"list"}){ current, default, available } - Change target: — its own turn, then operate
n8n_instances({mode:"switch", name:"<name>"}) - Confirm target: from
current(primary);listfromdetails.instanceName(secondary, may be absent)n8n_health_check - → switch to a name from the error's
UNKNOWN_INSTANCElist, then retryavailable - (credential write) →
INSTANCE_AMBIGUOUSon this session to confirm the target, then retryswitch - Unexpected → verify the instance, switch, retry; do not recreate
NOT_FOUND - Before credential writes → re-, confirm
list, then write (the fail-close only covers the ambiguous case)current
- 查看实例及当前指向:→ 返回
n8n_instances({mode:"list"}){ current, default, available } - 更改目标实例:——单独执行,然后再操作
n8n_instances({mode:"switch", name:"<name>"}) - 确认目标实例:返回的
list(主要方式);current返回的n8n_health_check(次要方式,可能缺失)details.instanceName - → 切换到错误信息中
UNKNOWN_INSTANCE列表里的名称,然后重试available - (凭据写入)→ 在当前会话切换实例确认目标,然后重试
INSTANCE_AMBIGUOUS - 意外的NOT_FOUND → 验证实例,切换后重试;不要重新创建对象
- 凭据写入前 → 重新调用,确认
list,然后执行写入操作(失败关闭仅覆盖模糊场景)current
Integration with other skills
与其他技能的集成
- n8n-mcp-tools-expert — owns (CRUD +
n8n_manage_credentials) and the rule that secrets go through the credential system, never text fields. This skill adds the "which instance?" layer on top.getSchema - using-n8n-mcp-skills — the router; consult it for which skill owns a given build step.
- n8n-mcp-tools-expert —— 负责(CRUD +
n8n_manage_credentials)以及机密信息必须通过凭据系统处理、切勿放入文本字段的规则。本技能在此基础上增加了“选择哪个实例?”的层面。getSchema - using-n8n-mcp-skills —— 路由技能;如需了解哪个技能负责特定构建步骤,请参考该技能。