n8n-decanter: An MCP Guard That Turns Code Nodes Into TypeScript Files
An MCP guard proxy extracts n8n Code node source into typed files in git, blocking the jsCode write while keeping full agent access to structure.
n8n's built-in MCP server lets coding agents edit workflows structurally, but Code node source is stored as a raw string inside workflow JSON, making those edits undiffable, untyped, and impossible to share as reusable modules.
n8n-decanter sits as an MCP proxy between agent and n8n, forwarding every structural write — adding nodes, wiring connections, publishing — while blocking only the direct write to a Code node's jsCode field. Instead, each Code node's source is extracted into its own file in a git repo, with workflow.json kept as a read-only structural mirror.
On push, files compile through esbuild, inlining shared modules and opted-in npm dependencies into the single function body n8n requires. Typechecking wraps each file in a synthetic async function via a custom TypeScript compiler host to validate the node's real runtime context ($input, top-level return/await). Pushes land on the workflow's draft, publishing is a separate gated step, and compliance and drift checks run independently — a --force flag can override drift concerns, but never a structural correctness failure.
The result: engineers keep the agent's speed for structural edits while putting business logic under git, TypeScript, and code review. The tool ships as an MIT-licensed CLI on npm.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work