n8n-io/n8n · error · Error

Failed to enable MCP access (server reported mcpAccessEnable

Error message

Failed to enable MCP access (server reported mcpAccessEnabled=${String(data.mcpAccessEnabled)})

What it means

enableMcpAccess PATCHes /rest/mcp/settings with mcpAccessEnabled:true and expects the server to confirm it is enabled. If the response's mcpAccessEnabled is not strictly true, the server refused — the most common cause is N8N_MCP_MANAGED_BY_ENV pinning the setting to env, which makes the PATCH a no-op.

Source

Thrown at packages/@n8n/instance-ai/evaluations/clients/n8n-client.ts:637

	/**
	 * Enable MCP access for this instance (owner scope required).
	 * PATCH /rest/mcp/settings  body: { mcpAccessEnabled: true }
	 *
	 * `/rest/e2e/reset` truncates the settings table and clears the cache, so MCP
	 * access is off after a reset regardless of startup env — the fused
	 * `--build-via-mcp` lane setup calls this after seeding. Throws if the server
	 * reports MCP still disabled (e.g. N8N_MCP_MANAGED_BY_ENV refuses the PATCH).
	 */
	async enableMcpAccess(): Promise<void> {
		const data = this.unwrapRestData<{ mcpAccessEnabled?: boolean }>(
			await this.fetch('/rest/mcp/settings', {
				method: 'PATCH',
				body: { mcpAccessEnabled: true },
			}),
		);
		if (data.mcpAccessEnabled !== true) {
			throw new Error(
				`Failed to enable MCP access (server reported mcpAccessEnabled=${String(data.mcpAccessEnabled)})`,
			);
		}
	}

	/**
	 * Mint a fresh MCP API key for the authenticated user.
	 * POST /rest/mcp/api-key/rotate
	 *
	 * Uses rotate rather than GET /rest/mcp/api-key because the GET only returns
	 * the raw JWT when it creates the key; a pre-existing key comes back redacted
	 * (`******abcd`), which would silently break MCP auth if staged into a
	 * `claude` config. Rotate deletes + recreates, so the response is always
	 * unredacted — at the cost of invalidating any prior MCP key for this user.
	 */
	async rotateMcpApiKey(): Promise<string> {
		const data = this.unwrapRestData<{ apiKey?: string }>(
			await this.fetch('/rest/mcp/api-key/rotate', { method: 'POST' }),

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Unset N8N_MCP_MANAGED_BY_ENV (or set it to allow runtime control) and reboot the instance before retrying.
  2. Pre-enable MCP access in the instance's env config so the PATCH is unnecessary.
  3. If env management is intentional, do not call enableMcpAccess — pre-configure the instance.
Defensive patterns

Strategy: validation

Validate before calling

// Detect managed-by-env before calling PATCH:
if (process.env.N8N_MCP_MANAGED_BY_ENV === 'true')
  throw new Error('MCP is env-managed; unset N8N_MCP_MANAGED_BY_ENV to enable at runtime');

Try / catch

try { await client.enableMcpAccess(); }
catch (e) {
  if (e instanceof Error && e.message.includes('mcpAccessEnabled')) { /* unset env-managed flag, reboot, retry */ }
  else throw e;
}

Prevention

When it happens

Trigger: Running the fused `--build-via-mcp` lane setup against an instance booted with N8N_MCP_MANAGED_BY_ENV=true; the setting is locked by an admin policy.

Common situations: Enterprise deployments that pin MCP via env to prevent runtime toggling; CI image configured for reproducibility with managed-by-env.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/4c9b3c3dd133477c. Report an issue: GitHub.