Course: Mastering n8n-mcp

A guided, hands-on tour of how to actually work with n8n-mcp through your AI assistant. Thirteen lessons across four modules, plus tips, tricks, and a closing thought. Every lesson ships with a copy-paste prompt you can drop straight into Claude Code, ChatGPT with MCP, or any compatible client.

Before you start

This course is about working with n8n-mcp, not installing it. To follow along, you should have:

  • An AI client with n8n-mcp connected. Either the hosted service (zero-setup, OAuth, free tier) or self-hosted via npx n8n-mcp or Docker.
  • Recommended: Claude Code with the n8n-mcp-skills plugin installed. The skills auto-load relevant guidance (workflow patterns, expression syntax, validation rules, code-node guides) so the agent makes fewer mistakes and burns fewer tokens.
  • A workspace n8n instance with API access for any lesson under Modules 3 and 4. Modules 1 and 2 only need an AI client.

Setup help: see the Getting Started page or the GitHub README.

How to use this course

  • Read in order the first time. Earlier lessons set up the patterns later lessons assume.
  • Then jump around. Use the outline below as a reference whenever you hit a new situation.
  • Copy the prompts and adapt them. They're starting points, not magic incantations. Replace placeholders, add your specifics.
  • Have a workspace n8n instance ready. Don't practice on production. Spin up a free instance or use a dev project.

What you'll learn

  • How to ship a working workflow in minutes, not hours
  • How to edit existing workflows for ~40× less tokens than a full rewrite
  • How to set up an autonomous testing loop where the agent debugs and fixes itself
  • How to validate, autofix, audit, and roll back workflows safely
  • How to debug a failed execution in a single tool call
  • How to compose n8n-mcp with other AI tools and agents

Course outline

Module 1: Ship a workflow fast

Lesson 1: Start from a template, not from scratch

n8n-mcp ships with 2,352 curated community templates from n8n.io plus 156 ranked patterns mined from that corpus. For most common tasks (webhook to Slack, RSS to email, file sync, AI summarisation), someone has already built it. Find theirs first, customise from there.

The agent calls search_templates with a search mode that matches your intent (by_task, by_nodes, by_metadata, or keyword), picks a result, and runs n8n_deploy_template. That deploy step auto-fixes outdated nodes on the way in, so you land on the freshest version without doing anything extra.

Each template comes back with rich metadata you can filter on: complexity (simple/medium/complex), estimated_setup_minutes, required_services, target_audience, categories, use_cases, and key_features. Use them — "simple, <15 min, no paid OpenAI account" is a totally valid query.

Try this prompt
Find a few templates for processing incoming webhooks and posting to a database. Filter for simple complexity and setup under 15 minutes. Show me the top 3 with their author, view count, and required services, then deploy the simplest one to my instance.

You'll know it worked when: the agent shows the template author's name, a link to n8n.io, the required services, and confirms deployment with a workflow ID. The response also tells you the total number of matching templates (e.g., "307 templates available for webhook_processing"), so you know whether to refine. Template attribution is mandatory in the n8n-mcp behaviour spec, so if the agent skips it, prompt "include the template attribution."

Lesson 2: Generate from a plain-English description (hosted)

On the hosted service, n8n_generate_workflow takes a natural-language description and returns up to five proposals (no deploy yet). You pick one with a deploy_id, the agent deploys it in inactive state, and you wire up credentials in the n8n UI before flipping it on.

Use this when the workflow shape is clear but you don't want to drive node-by-node assembly. Self-hosted users get a redirect message instead of a workflow, so fall back to template search (Lesson 1) or hand-built creation.

Try this prompt
Generate a workflow that watches a Google Drive folder, summarises new PDFs with OpenAI, and posts the summary to a Notion database. Show me the proposals first — don't deploy until I pick one.

You'll know it worked when: you see 3-5 proposals with a one-line summary, expected node count, and a list of credentials each one needs. After deployment, always validate (Lesson 8) before activating.

Lesson 3: Trust the indexed-node coverage

n8n-mcp indexes 1,322 unique nodes, of which 768 are community packages. Each one has its README, version history, and an AI-generated summary baked into the database. That includes niche regional integrations (e.g., BaseLinker for Polish e-commerce), specialist data nodes, and community-maintained service connectors.

Practical effect: you don't need to fall back to manual HTTP Request nodes when a community connector exists. Just ask for it by name. search_nodes returns the package name, isCommunity/isVerified flags, authorName, and even an npmDownloads count as a popularity signal — so you can pick a maintained, popular package when there are several alternatives.

Pass includeOperations: true and you also get the full resource/operation tree for each result, with no follow-up get_node call. That's the difference between knowing a node exists and knowing exactly what it can do.

Try this prompt
Search community nodes related to [your niche service or community package]. Include the full operations tree. Show me the package, npm downloads, whether it's verified, and the resources/operations available. If there's no community node, say so and propose an HTTP Request fallback.

You'll know it worked when: the agent returns a specific nodeType string (like n8n-nodes-jetapi.jetapi), the package name, an npm downloads count, a verified flag, and the operations tree. If the search returns totalCount: 0, the package isn't indexed yet and HTTP Request is the right call.

Module 2: Edit smartly to save tokens

Lesson 4: Iterate, never one-shot

The single biggest mistake new users make is trying to one-shot a complex workflow in a single prompt. It burns tokens, the result is usually wrong in subtle ways, and you have no idea which part to fix.

Instead: build the bare-bones workflow first (trigger, one or two transforms, terminal node), validate it, then add features one at a time. Each iteration is a focused diff against a working baseline. The data backs this up: across 84,000 users, the update-to-create ratio is 6.21 : 1. Heavy users iterate.

What iteration looks like in practice:

  1. "Build the bare-bones workflow: webhook in, Slack out."
  2. "Now add error handling on the Slack node."
  3. "Now format the message with the customer name from the payload."
  4. "Now route by amount — over $100 goes to #vip, otherwise #general."
Try this prompt
Build me a bare-bones workflow that triggers on a webhook and posts a Slack message. Don't add error handling, retries, or formatting yet. Just the minimum that runs end-to-end.

You'll know it worked when: the workflow has 2-3 nodes, validates clean, and the agent stops instead of adding speculative features. Then continue with follow-up prompts to layer on complexity.

Lesson 5: Make surgical edits with patchNodeField

When you change one URL, one prompt string, or one constant inside a Code node, you do not want the agent re-emitting the entire node. patchNodeField sends a find/replace patch instead of a full node body. We're talking ~144 characters instead of 5,000+ tokens for an HTML email or a long Code node.

From production: median 41× token saving per edit, 99.77% success rate over 2 million calls in 90 days. The trigger phrase that nudges the agent toward this path is "smallest possible change" or "just patch this string."

Try this prompt
In workflow X, change the URL in the "Get Customer" node from /v1 to /v2. Make the smallest possible change — just patch that string, no full node rewrite.

You'll know it worked when: the agent emits a patchNodeField operation with search and replace strings. If it tries to call updateNode with the whole parameters object, prompt "use patchNodeField instead."

When patchNodeField doesn't fit: structural changes (renaming a node, swapping a node type, restructuring complex nested options) need updateNode or a node replacement. Patches are for in-place string edits.

fieldPath gotcha: the dot path walks objects, not arrays. parameters.url, parameters.jsCode, parameters.responseBody all work; but parameters.assignments.assignments[0].value fails with "property does not exist on node X." For string edits inside array items (like Set node assignments), fall back to updateNode with the full updated array.

The response is minimal by design. n8n_update_partial_workflow returns just {id, name, active, nodeCount, operationsApplied} — it does not echo back the workflow JSON. That's the token-saving point. If you need to verify the patch landed, the message tells you to run n8n_get_workflow with mode: "structure".

Stack ops in one call. Multiple operations in a single operations array apply atomically — e.g., patchNodeField + updateName + activateWorkflow in one call returns one response with operationsApplied: 3.

Lesson 6: Validate single nodes mid-build

Don't wait until the whole workflow is assembled to find out a node is misconfigured. validate_node validates a single node's config in isolation, in milliseconds, with full awareness of the chosen resource/operation combination (it knows which fields are required only for that specific path via displayOptions).

The response is richer than a simple yes/no:

  • errors[] — each with type, property, message, and a concrete fix
  • warnings[] — best-practice nudges (e.g., "Slack API can have rate limits, add retryOnFail")
  • autofix — an object the agent can apply directly (often pre-filled with sensible defaults like {onError: "continueRegularOutput", retryOnFail: true, maxTries: 2})
  • visibleProperties / hiddenProperties — which fields are active given your resource/operation choice (so you don't chase a property the editor would hide anyway)
  • nextSteps[] — human-readable instructions to unblock
Try this prompt
I'm configuring a Slack node to post a message to a channel. Validate just that node config with the runtime profile. If there's an autofix object, show me what it would apply.

You'll know it worked when: you get an explicit valid: false with a list of missing fields scoped to your operation, plus a summary like {hasErrors: true, errorCount: 3, warningCount: 1}. Pair with get_node when the agent needs to look up which fields are valid for a property.

Module 3: Test and validate

Lesson 7: Run the autonomous webhook testing loop

This is the closest thing to autonomous workflow QA. Attach a webhook trigger to any workflow and the agent can test, debug, and fix it without you in the loop:

  1. Agent POSTs a test payload via n8n_test_workflow
  2. Reads the execution result via n8n_executions with mode: "error" (returns only the failed node + input data, saves tokens)
  3. Diagnoses which node failed and why
  4. Patches with patchNodeField or a full diff update
  5. Re-tests until it's green
Try this prompt
Workflow X has a webhook trigger. Send it this test payload:

{customer_id: 42, amount: 99}

Then walk through what each node returned. If anything failed, fix it and re-run until it's green. Report back when you're done or if you can't fix it on your own.

You'll know it worked when: n8n_test_workflow returns a full HTTP response shape ({status: 200, statusText: "OK", data: {...}, headers: {...}}) plus a duration in milliseconds. The agent reports a green execution with the final output, or pauses and asks for guidance after 2-3 unsuccessful fix attempts.

Prerequisite: the workflow must be active for webhook triggers to be reachable. If the agent reports the webhook 404s, ask it to activateWorkflow first (one extra operation) and re-test.

If it doesn't work: some failures (auth issues, missing credentials, third-party API outages) the agent can't fix on its own. The instruction "report back if you can't fix it" gives it permission to stop instead of looping.

Lesson 8: Validate workflows with the right profile

validate_workflow catches what the editor doesn't: unreachable nodes, dead branches, missing error outputs, outdated typeVersions, AI Agent connection mistakes, expression syntax errors, and displayOptions visibility issues.

Four profiles — pick by intent:

  • minimal: required fields only. Use mid-build for fast iteration.
  • runtime: the default. Catches what would error at run time.
  • ai-friendly: balanced for AI-built workflows, fewer false positives.
  • strict: most thorough. Use before promoting to production.
Try this prompt
Validate workflow X with the strict profile. Group every error and warning by node, then suggest the minimal fix for each. Don't apply anything yet — I want to review first.

You'll know it worked when: the response includes a summary with errorCount/warningCount, structured errors[] and warnings[] arrays scoped per node, and an actionable suggestions[] array (often prefixed with "🔧 RECOVERY:" or "📋 SUGGESTED WORKFLOW:").

Validation is also a teacher. For tricky errors like "incorrect error output configuration," the validator returns the exact incorrect-vs-correct JSON for the connections object inline in the error message. If you don't understand a validation error, ask the agent "quote the validator's message verbatim" — it's often a self-contained explanation. For full reference, see /docs/validation.

Lesson 9: Stay current with autofix and version intelligence

Workflows rot. You build one, six months later half the nodes are on outdated typeVersions and one of them quietly stopped working. Two tools fix this together:

  • n8n_autofix_workflow with applyFixes: false first (preview mode). It surfaces what can be auto-upgraded with high confidence, and flags breaking changes for review.
  • get_node with mode: "compare" / "breaking" / "migrations" tells you exactly what changed between two typeVersions before you commit.

The pattern: preview → review breaking changes → apply high-confidence fixes → manually decide on the rest.

Try this prompt
Run autofix on workflow X in preview mode (don't apply yet). For each fix, show me the type, before/after value, and confidence. For anything flagged as a breaking change or version-migration, use get_node compare mode to show me what changed. Then apply only the high-confidence fixes.

You'll know it worked when: the preview returns a fixes[] array (each with node, field, type, before, after, confidence, description) plus a stats.byType / stats.byConfidence breakdown so you can triage.

Heads-up on the gap: validate_workflow often flags more outdated typeVersions than autofix can confidently upgrade. That's by design — autofix is conservative on breaking changes. The validation warnings are still real; they just need a manual decision per node.

Just-deployed workflows: if you call autofix on a workflow you just deployed via n8n_deploy_template, it'll often return "No automatic fixes available" — not because the workflow is clean, but because n8n_deploy_template already ran autofix on the way in (its autoFix: true default). Validate it instead to see what's left as warnings for human review.

Heads-up on compare: for some nodes, get_node with mode: "compare" returns {available: false, reason: "Version metadata not populated for this node..."}. That's a graceful failure, not a bug — in those cases, fall back to autofix preview (which will tell you the confidence level) plus a quick read of the n8n changelog before applying.

Module 4: Operate and harden

Lesson 10: Audit your instance for security

n8n_audit_instance combines n8n's built-in audit with a custom deep scan: ~50 secret-detection regexes (AWS keys, OpenAI tokens, JWTs, Stripe keys, GitHub PATs, Slack tokens, generic bearer tokens), unauthenticated webhooks, missing error handlers, abandoned workflows (default 90 days), and data-retention risks. You get back a markdown report with severity-ranked findings and a remediation playbook.

Why this matters: if you back up workflows to a Git repo, hardcoded bearer tokens in workflow JSON are now in your version history. If the repo is public — or someone leaks a clone — those keys are out. Run this audit before you commit n8n exports anywhere, and on a cadence afterwards.

Try this prompt
Audit my n8n instance for security issues and abandoned workflows older than 60 days. Give me a remediation checklist sorted by severity, with the top 3 things I should fix today and the exact tools you'd use to fix them.

You'll know it worked when: the report opens with a severity summary table (Critical / High / Medium / Low / Total) and groups findings per workflow with stable IDs you can quote: CRED-001 (hardcoded secret), WEBHOOK-001 (unauthenticated webhook), ERR-001 (no error handling), RETENTION-001 (excessive data retention). Detected secrets are masked (first 6 + last 4 chars only) — that's for safe display. Rotate the real secrets out of band; don't try to read them out of the report.

The playbook tells you the next tool. At the bottom of the report, the "Remediation Playbook" section explicitly names the tool chains to fix each finding type, e.g., "n8n_get_workflow → extract value → n8n_manage_credentials({action: "create"}) n8n_update_partial_workflow." Quote those steps back to the agent and it'll execute them.

Lesson 11: Track credential usage before rotating (and reuse patterns)

Two questions you almost always need to answer before touching a credential:

  • Blast radius: which workflows would I break if I rotated this?
  • Pattern reuse: where did I already integrate this API, so I can copy the pattern?

n8n_manage_credentials with includeUsage: true attaches a usedIn: [{id, name, active}] array to every credential, so both questions become a single tool call. The pattern-reuse side is especially powerful for niche APIs: when you integrate something like BaseLinker (a Polish e-commerce platform with no community node) once, the next workflow that needs it can pull your existing HTTP-node configuration as a template.

Try this prompt: blast-radius check
List all my credentials and tell me which workflows reference each one. Flag any credentials that aren't used anywhere — I want to clean those up first.
Try this prompt: pattern reuse
I want to build another workflow that uses the [API name] credential. Find the existing workflows that already use it, show me how they configured the HTTP request, and propose a similar pattern for my new use case.

You'll know it worked when: each credential lists the workflows that use it (with active/inactive status) and a usage count. Unused credentials are safe to delete; heavily used ones need a planned rotation.

Lesson 12: Debug fast with the execution URL

When a workflow fails, don't describe the failure to the agent. Open the failed execution in n8n, copy the URL from the address bar, and paste it into the prompt. The agent goes straight to that execution via n8n_executions with mode: "error", which returns only the failed node and the input data that triggered it. No workflow listing, no execution scanning, no token waste.

The URL pattern is /workflow/<workflow-id>/executions/<execution-id> — the agent extracts both IDs and skips straight to the diagnosis.

Try this prompt
This execution failed:
https://your-n8n.example.com/workflow/abc123/executions/789

Tell me what broke, why, and what input data caused it. Propose a fix but don't apply it until I confirm.

You'll know it worked when: the agent identifies the failed node by name, quotes the error message, and shows the upstream input that triggered it — usually within a single tool call. Compare against the cost of asking it to "find what broke in workflow X" without the URL: that's a multi-call workflow listing → execution listing → per-execution fetch sequence.

Lesson 13: Roll back with workflow versions

Every change to a workflow creates a version. n8n_workflow_versions gives you list, get, rollback (with pre-validation and auto-backup), prune-to-N, and truncate. There's also an automatic safety net: if n8n persists a workflow body but fails to activate it (e.g., a bad typeVersion after an update), n8n-mcp restores the prior version automatically.

Two commands you'll use most:

  • Rollback to yesterday's version when a change broke prod and you can't pinpoint the cause yet.
  • Prune to keep the last N versions to keep the version table tidy on a workflow you iterate on heavily.

Each version comes back with a trigger field that tells you what kind of change made it (partial_update, full_update, rollback, etc.) plus an operationCount and a size. So you can spot "the big change last Tuesday at 14:00" without diff-ing every version.

Two safety nets worth knowing:

  • Versions track updates, not creation. A freshly created workflow has no versions. The first version appears after your first update, numbered 1. So if you need to roll back immediately after a deploy, there's nowhere to roll back to.
  • validateBefore: true (default) blocks broken rollbacks. If you try to restore a version that has validation errors, you'll get "Cannot restore - version N has validation errors" back. To force the rollback anyway (rarely a good idea), pass validateBefore: false.
  • Successful rollback creates a backup. The response includes backupCreated: true and backupVersionId: N — so even a forced rollback to a bad version is itself reversible.
Try this prompt
Show me the version history of workflow X for the last 7 days, including the trigger type and operation count for each version. Roll it back to whatever was running yesterday morning, and validate the rolled-back version before activating.

You'll know it worked when: the agent shows the version table with versionNumber, trigger, operationCount, and createdAt; confirms the rollback target; validates it (Lesson 8); and only then activates. Use truncate only when you're certain you want to wipe all version history — it can't be undone.

Tips & Tricks

Talk, don't type

Most of the prompts in this course are 2-3 sentences. Typing them is slow; speaking them is not. Voice-to-text tools (Whisper Flow, SuperWhisper, or open-source Whisper.cpp running locally) turn a thirty-second instruction into a five-second one. Once you've tried narrating a workflow change instead of typing it, you don't go back.

Stack tools in one prompt

Don't serialise "deploy this template" → "now validate it." Stack the steps in a single prompt and let the agent chain the tool calls. Most lessons in this course are stackable.

Stacking example
Find the best template for webhook → Slack, deploy it, then validate it with the strict profile and autofix anything high-confidence. Show me what changed at the end.

Defer cheap work to a Haiku sub-agent

Going through 200 execution logs to find the failing one is a high-volume, low-intelligence task. You don't need Opus for that. In Claude Code, define a sub-agent (e.g., n8n workflow explorer) with Haiku as the model, scoped to n8n_executions and n8n_get_workflow. The main agent delegates: "explorer, find which execution failed for the SKU sync workflow last week." Same outcome, fraction of the cost.

Pair n8n-mcp with companion MCPs

n8n-mcp is one tool in a stack. The pairings that come up most:

  • Playwright MCP for "go look up X on the web and plug it into this workflow" tasks (find an API endpoint from docs, verify a webhook responds, scrape a value into a config).
  • Filesystem MCP for reading workflow JSON exports from disk before importing, or for committing exports to a local Git repo.
  • GitHub MCP for filing issues against the n8n-mcp repo when you spot a bug, or for diff-ing an exported workflow against a previous commit.

Ask the agent what it has

When you're stuck or starting fresh, the simplest unstuck-prompt is to ask the agent to introspect. It calls tools_documentation and walks through the surface.

Self-discovery prompt
List the n8n-mcp tools you have access to and tell me what each category is for. Then suggest 2-3 things I could try first based on the tools available.

Build a personal pattern library

The compounding effect with n8n-mcp is real: the more workflows you have on your instance, the faster the next one gets. Your existing workflows are your pattern library — a record of how you prefer to handle errors, batch loops, transformations, and integrations. When starting something new, ask the agent to find a similar pattern you've already shipped before searching the public template corpus.

Pattern-library prompt
Before searching public templates, look through my existing workflows for anything that does [pattern, e.g., "retry an HTTP request with exponential backoff"]. If you find one, use it as the pattern for the new workflow.

Mine the corpus with searchMode: "patterns"

For a higher-altitude view of how the community builds a class of workflow, search_templates with searchMode: "patterns" returns the dominant chain plus node frequencies. For task: "webhook_processing" across 313 templates, it comes back with pattern: "Webhook → Set → Code → HTTP Request" and the top sub-chains (e.g., webhook → set in 35% of templates). It's a cheaper, lower-token way to anchor a design than deep-reading individual templates.

Pattern discovery prompt
What's the dominant pattern for webhook processing workflows in the template corpus? Show me the top chains and node frequencies, then propose a baseline structure for my new workflow.

A closing thought

The actions are democratised now. Anyone can spin up a workflow, deploy a template, ask an AI to fix a failing node. The technical part has been solved — or at least, it's been radically lowered.

What hasn't been democratised is knowing which problem to solve. The intuition for what to build, the gut feeling about which integration matters, the experience of having seen this kind of process break before — that's yours, and that's where the value lives. n8n-mcp is the toolbelt. The intuition is what you bring.

Use this course to get fluent with the tools. Then go solve the problem only you can see.

Where to go next