Setting up n8n with an AI agent, from zero
If you have never opened a terminal, this guide still works. It is the walkthrough I gave someone on 19–20 September 2026, from no GitHub account to a Telegram bot posting alerts from a workflow an AI built for me.
The interesting part is not n8n. It is that you do not type most of this. You install four things by hand, then let an AI coding agent — Claude Code, Codex, Copilot, whichever you have — do the rest, including building the workflow itself through n8n's MCP server.
One honest note before we start: I use Zapier, not n8n, day to day. The concepts are identical — a trigger, some nodes, credentials, an error path — which is rather the point. Tools are interchangeable once you know the shape.
What you will have at the end
A workflow that checks whether a website is up every few minutes, and messages you on Telegram when it is not. Five nodes: Schedule Trigger → HTTP Request → If → Telegram (plus the alert branch).
Roughly 1–2 hours if nothing fights you. Most of that is waiting.
Step 1 · A GitHub account
github.com → Sign up. Use an email you will keep.
You are not writing code today, but every tool below assumes you have one, and your AI agent will want to push work somewhere eventually. Turn on 2FA while you are there.
Step 2 · VS Code
code.visualstudio.com → download → install. It is a text editor with a built-in terminal, and that terminal is where everything below happens.
Open it, then Terminal → New Terminal. That panel at the bottom is all the "using the terminal" you need.
Step 3 · Node.js — the step that breaks
n8n runs on Node. Install the LTS version from nodejs.org.
The single most common failure on Windows. In the installer there is a feature tree with dropdowns. If any entry shows a red ✗ and "Entire feature will be unavailable", Node installs but is not added to your PATH, and every later command fails with:
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program.Set it to "Entire feature will be installed on local hard drive". Leave Tools for Native Modules unchecked, you do not need it.
After installing, close the terminal and open a new one. PATH changes do not reach windows that were already open. Then check:
node --version
npm --version
Two version numbers means you are fine. If Windows still says "not recognized", the emergency patch for the current window is:
$env:Path += ";C:\Program Files\nodejs"
That is temporary. Reinstall properly with the dropdown fixed.
Step 4 · Run n8n
Here is the fork in the road, and picking wrong costs you an afternoon.
If you only want to use n8n:
npx n8n
Open http://localhost:5678 and create the owner account. Done.
Do not clone the n8n repository. It is a monorepo meant for people working on n8n, and building it takes 10–20 minutes on a first run — during which it looks completely frozen. If you already went down that path and ran something like pnpm build > build.log 2>&1, it is not hung: the redirect sent all the output to a file. Watch it instead of staring at a dead cursor:
Get-Content build.log -Wait -Tail 20
On Windows, WSL2 is much faster than native — but keep the project in your Linux home (~/), not under /mnt/c/, where file access crawls.
If you would rather not install Node at all, Docker works:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
Step 5 · A Telegram bot
In Telegram, message @BotFather:
/newbot- Give it a name, then a username ending in
bot - He replies with a token like
8123456789:AAH...
Then message your own bot. Say anything. A Telegram bot cannot start a conversation with you — you have to open the door first.
The trap that cost us the most time. The digits before the
:in the token are the bot's id, not yours. Send to it and Telegram replies:{"ok":false,"error_code":403,"description":"Forbidden: the bot can't send messages to the bot"}Your own chat id comes from @userinfobot or @get_id_bot. Ours was a 9-digit number that looked nothing like the bot's.
Put the token into n8n as a credential (Credentials → New → Telegram). Never in a file, never in a message to your AI agent.
Step 6 · Connect n8n to your AI agent over MCP
This is the part that feels like the future. n8n ships an instance-level MCP server, so your coding agent can list nodes, build workflows and run them.
First, in n8n: Settings → Instance-level MCP → Enable MCP access.
Then, in your terminal:
claude mcp add --transport http n8n http://localhost:5678/mcp-server/http
The config lands in ~/.claude.json, scoped to the folder you ran it in. Add -s user if you want it everywhere.
It will fail the first time. You will see:
HTTP/1.1 401 Unauthorized WWW-Authenticate: Bearer realm="n8n MCP Server"That is expected. Run
/mcpinside Claude Code, choose the n8n server, and authenticate in the browser window that opens. You are looking forAuthentication successful. Connected to n8n.
Not to be confused with n8n's MCP Server Trigger node, which is a different thing: that exposes one of your workflows as an MCP tool.
Step 7 · Let the agent build the workflow
Now just ask, in plain language:
Build me a workflow that checks https://example.com every 5 minutes and sends me a Telegram message if it is down. Use my existing Telegram credential.
The agent searches node types, creates the workflow, validates it, attaches your saved credential and runs it. Ours came back as five nodes, valid on the first pass.
Then test the failure path, not the happy path. Point it at a URL that always fails, such as https://httpstat.us/500, and confirm the message actually arrives. A monitor that has never fired is not a monitor.
Two things worth knowing from our run:
- A request that times out has no status code.
{{ $json.statusCode ?? "no response" }}prints something readable instead of a blank. - A slow site can hit the node's timeout and take the error branch rather than your If-false branch. Both need to alert you.
Step 8 · Turn it on
Easy to forget after all that: activate the workflow, and change the URL from your test one to the real site. An inactive workflow only runs when you press Execute.
Why this matters more than n8n
Two things stood out while teaching it.
The setup is now the hard part, and AI removes most of it. Node paths, permissions, build times — none of it teaches you anything about automation. Hand it to an agent and get to the actual work.
Your agent's permission mode decides your afternoon. I run Claude Code with permissions bypassed, so it installs, edits and runs without stopping. The person I was teaching used Codex in approve-each-step mode, and every command waited for a human. Same work, different length of day. Choose deliberately: bypass on a machine and a project you can afford to break, approvals on anything near production.
And the Zapier point again: trigger, nodes, credentials, error path. That shape is the same in Zapier, n8n, Make and whatever replaces them. Learn the shape once and picking up the next tool is an afternoon.